Extract call to -[WebHTMLRepresentation supportedNonImageMIMETypes] from WebArchiveDu...
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Oct 2010 05:29:18 +0000 (05:29 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Oct 2010 05:29:18 +0000 (05:29 +0000)
Reviewed by Adam Roben.

Part 1 of 4: <http://webkit.org/b/48278> Convert DumpRenderTree webarchive code to CoreFoundation

The call to -[WebHTMLRepresentation supportedNonImageMIMETypes]
is not cross-platform between Mac and Windows, so extract it
into a platform-specific source file.

* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: Added
WebArchiveDumpSupportMac.mm to the project.
* DumpRenderTree/mac/WebArchiveDumpSupport.h:
(supportedNonImageMIMETypes): Added declaration.
* DumpRenderTree/mac/WebArchiveDumpSupport.mm:
(convertWebResourceDataToString): Replaced call to
-[WebHTMLRepresentation supportedNonImageMIMETypes] with
supportedNonImageMIMETypes().
* DumpRenderTree/mac/WebArchiveDumpSupportMac.mm: Added.
(supportedNonImageMIMETypes): Added.  Extracted from
WebArchiveDumpSupport.mm.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70611 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
WebKitTools/DumpRenderTree/mac/WebArchiveDumpSupport.h
WebKitTools/DumpRenderTree/mac/WebArchiveDumpSupport.mm
WebKitTools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm [new file with mode: 0644]

index 9bd7c29..7c41875 100644 (file)
@@ -1,3 +1,27 @@
+2010-10-26  David Kilzer  <ddkilzer@apple.com>
+
+        Extract call to -[WebHTMLRepresentation supportedNonImageMIMETypes] from WebArchiveDumpSupport.mm
+
+        Reviewed by Adam Roben.
+
+        Part 1 of 4: <http://webkit.org/b/48278> Convert DumpRenderTree webarchive code to CoreFoundation
+
+        The call to -[WebHTMLRepresentation supportedNonImageMIMETypes]
+        is not cross-platform between Mac and Windows, so extract it
+        into a platform-specific source file.
+
+        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: Added
+        WebArchiveDumpSupportMac.mm to the project.
+        * DumpRenderTree/mac/WebArchiveDumpSupport.h:
+        (supportedNonImageMIMETypes): Added declaration.
+        * DumpRenderTree/mac/WebArchiveDumpSupport.mm:
+        (convertWebResourceDataToString): Replaced call to
+        -[WebHTMLRepresentation supportedNonImageMIMETypes] with
+        supportedNonImageMIMETypes().
+        * DumpRenderTree/mac/WebArchiveDumpSupportMac.mm: Added.
+        (supportedNonImageMIMETypes): Added.  Extracted from
+        WebArchiveDumpSupport.mm.
+
 2010-10-26  Antonio Gomes  <agomes@rim.com>
 
         Reviewed by Martin Robinson.
index f7d0fa7..c3ff062 100644 (file)
@@ -48,6 +48,7 @@
                29CFBA2E12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29CFBA2D12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm */; };
                3713EDE2115BE19300705720 /* ColorBits-A.png in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 3713EDDF115BE16F00705720 /* ColorBits-A.png */; };
                3713EDE3115BE19300705720 /* ColorBits.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 3713EDE0115BE16F00705720 /* ColorBits.ttf */; };
+               440590711268453800CFD48D /* WebArchiveDumpSupportMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 440590701268453800CFD48D /* WebArchiveDumpSupportMac.mm */; };
                4437730E125CBC3600AAE02C /* WebArchiveDumpSupport.mm in Sources */ = {isa = PBXBuildFile; fileRef = 44A997830FCDE86400580F10 /* WebArchiveDumpSupport.mm */; };
                4437730F125CBC4D00AAE02C /* WebArchiveDumpSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 44A997820FCDE86400580F10 /* WebArchiveDumpSupport.h */; };
                5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5185F69F10714A57007AA393 /* HistoryDelegate.mm */; };
                375F09770DAC3CB600C8B4E5 /* WebKitWeightWatcher700.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher700.ttf; path = fonts/WebKitWeightWatcher700.ttf; sourceTree = "<group>"; };
                375F09780DAC3CB600C8B4E5 /* WebKitWeightWatcher800.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher800.ttf; path = fonts/WebKitWeightWatcher800.ttf; sourceTree = "<group>"; };
                375F09790DAC3CB600C8B4E5 /* WebKitWeightWatcher900.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher900.ttf; path = fonts/WebKitWeightWatcher900.ttf; sourceTree = "<group>"; };
+               440590701268453800CFD48D /* WebArchiveDumpSupportMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebArchiveDumpSupportMac.mm; path = mac/WebArchiveDumpSupportMac.mm; sourceTree = "<group>"; };
                44A997820FCDE86400580F10 /* WebArchiveDumpSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebArchiveDumpSupport.h; path = mac/WebArchiveDumpSupport.h; sourceTree = "<group>"; };
                44A997830FCDE86400580F10 /* WebArchiveDumpSupport.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebArchiveDumpSupport.mm; path = mac/WebArchiveDumpSupport.mm; sourceTree = "<group>"; };
                5185F69E10714A57007AA393 /* HistoryDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HistoryDelegate.h; path = mac/HistoryDelegate.h; sourceTree = "<group>"; };
                                A8D79CE90FC28B2C004AC8FE /* DumpRenderTreeFileDraggingSource.m */,
                                44A997820FCDE86400580F10 /* WebArchiveDumpSupport.h */,
                                44A997830FCDE86400580F10 /* WebArchiveDumpSupport.mm */,
+                               440590701268453800CFD48D /* WebArchiveDumpSupportMac.mm */,
                                BC9D90210C97472D0099A4A3 /* WorkQueue.cpp */,
                                BC9D90220C97472E0099A4A3 /* WorkQueue.h */,
                                BC9D90230C97472E0099A4A3 /* WorkQueueItem.h */,
                                BCA18B490C9B02C400114369 /* TextInputController.m in Sources */,
                                BCA18B6A0C9B08C200114369 /* UIDelegate.mm in Sources */,
                                4437730E125CBC3600AAE02C /* WebArchiveDumpSupport.mm in Sources */,
+                               440590711268453800CFD48D /* WebArchiveDumpSupportMac.mm in Sources */,
                                BC9D90240C97472E0099A4A3 /* WorkQueue.cpp in Sources */,
                                BCA18B260C9B015C00114369 /* WorkQueueItemMac.mm in Sources */,
                                5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */,
index 8654dd5..ab0b530 100644 (file)
 #ifndef WebArchiveDumpSupport_h
 #define WebArchiveDumpSupport_h
 
+#include <CoreFoundation/CoreFoundation.h>
+
 @class NSString;
 @class WebArchive;
 
 NSString *serializeWebArchiveToXML(WebArchive *webArchive);
 
+#pragma mark -
+#pragma mark Platform-specific methods
+
+CFArrayRef supportedNonImageMIMETypes();
+
 #endif /* WebArchiveDumpSupport_h */
index 6d8e17a..8632fec 100644 (file)
@@ -27,7 +27,6 @@
 
 #import <Foundation/Foundation.h>
 #import <WebKit/WebArchive.h>
-#import <WebKit/WebHTMLRepresentation.h>
 
 static void convertMIMEType(NSMutableString *mimeType)
 {
@@ -46,7 +45,7 @@ static void convertWebResourceDataToString(NSMutableDictionary *resource)
     NSMutableString *mimeType = [resource objectForKey:@"WebResourceMIMEType"];
     convertMIMEType(mimeType);
 
-    if ([mimeType hasPrefix:@"text/"] || [[WebHTMLRepresentation supportedNonImageMIMETypes] containsObject:mimeType]) {
+    if ([mimeType hasPrefix:@"text/"] || [(NSArray *)supportedNonImageMIMETypes() containsObject:mimeType]) {
         NSString *textEncodingName = [resource objectForKey:@"WebResourceTextEncodingName"];
         NSStringEncoding stringEncoding;
         if ([textEncodingName length] > 0)
diff --git a/WebKitTools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm b/WebKitTools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm
new file mode 100644 (file)
index 0000000..c3949e6
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebArchiveDumpSupport.h"
+
+#import <WebKit/WebHTMLRepresentation.h>
+
+CFArrayRef supportedNonImageMIMETypes()
+{
+    return (CFArrayRef)[WebHTMLRepresentation supportedNonImageMIMETypes];
+}