[webkit-changes] [17701] trunk
Geoffrey Garen
ggaren at apple.com
Fri Nov 10 08:29:03 PST 2006
Why this new bridge, instead of having WebKit call directly into
WebCore? If a file is ObjC-only, the solution is to make it ObjC++,
not to add a new bridge.
Geoff
On Nov 9, 2006, at 11:31 PM, oliver at opensource.apple.com wrote:
> Revision
> 17701
> Author
> oliver
> Date
> 2006-11-09 23:31:04 -0800 (Thu, 09 Nov 2006)
> Log Message
>
> 2006-11-09 Oliver Hunt
>
> Reviewed by Brady.
>
> Pulled MIME type handling out of WebFrameBridge and added
> a general C++ class to store/query MIME info
> Added an Obj-C bridge to provide WebKit with access to the
> MimeTypeRegistry for non-Obj-C++ classes.
>
> * WebCore.exp:
> * WebCore.xcodeproj/project.pbxproj:
> * bridge/mac/WebCoreFrameBridge.h:
> * bridge/mac/WebCoreFrameBridge.mm:
> * bridge/mac/WebMimeTypeRegistryBridge.h: Added.
> * bridge/mac/WebMimeTypeRegistryBridge.mm: Added.
> (+[WebMimeTypeRegistryBridge supportsImageWithMIMEType:]):
> (+[WebMimeTypeRegistryBridge supportsNonImageWithMIMEType:]):
> (+[WebMimeTypeRegistryBridge supportedNonImageMIMETypes]):
> (+[WebMimeTypeRegistryBridge supportedImageMIMETypes]):
> (+[WebMimeTypeRegistryBridge
> supportedImageResourceMIMETypes]):
> * platform/Image.cpp:
> (WebCore::Image::supportsType):
> * platform/Image.h:
> * platform/MimeTypeRegistry.cpp: Added.
> (WebCore::initialiseSupportedImageMIMETypes):
> (WebCore::initialiseSupportedNonImageMimeTypes):
> (WebCore::initialiseMimeTypeRegistry):
> (WebCore::MimeTypeRegistry::isSupportedImageMIMEType):
> (WebCore::MimeTypeRegistry::isSupportedImageResourceMIMEType):
> (WebCore::MimeTypeRegistry::isSupportedNonImageMIMEType):
> (WebCore::MimeTypeRegistry::getSupportedImageMIMETypes):
>
> (WebCore::MimeTypeRegistry::getSupportedImageResourceMIMETypes):
> (WebCore::MimeTypeRegistry::getSupportedNonImageMIMETypes):
> * platform/MimeTypeRegistry.h: Added.
> * platform/mac/ImageMac.mm:
> * platform/mac/MimeTypeRegistryMac.mm: Added.
> (WebCore::getMIMETypeForUTI):
> (WebCore::MimeTypeRegistry::getMIMETypeForExtension):
>
> Updated to make use of MimeTypeRegistry/bridge
>
> * Misc/WebNSPasteboardExtras.m:
> (-[NSPasteboard
> _web_writeImage:element:URL:title:archive:types:]):
> * WebCoreSupport/WebFrameBridge.mm:
> (-[WebFrameBridge determineObjectFromMIMEType:URL:]):
> * WebView/WebDataSource.mm:
> (-[WebDataSource _documentFragmentWithArchive:]):
> * WebView/WebHTMLRepresentation.m:
> (+[WebHTMLRepresentation supportedNonImageMIMETypes]):
> (+[WebHTMLRepresentation supportedImageMIMETypes]):
> * WebView/WebHTMLView.m:
> (-[WebHTMLView _imageExistsAtPaths:]):
> (-[WebHTMLView _documentFragmentWithPaths:]):
>
> Modified Paths
>
> trunk/WebCore/ChangeLog
> trunk/WebCore/WebCore.exp
> trunk/WebCore/WebCore.xcodeproj/project.pbxproj
> trunk/WebCore/bridge/mac/WebCoreFrameBridge.h
> trunk/WebCore/bridge/mac/WebCoreFrameBridge.mm
> trunk/WebCore/platform/Image.cpp
> trunk/WebCore/platform/Image.h
> trunk/WebCore/platform/mac/ImageMac.mm
> trunk/WebKit/ChangeLog
> trunk/WebKit/Misc/WebNSPasteboardExtras.m
> trunk/WebKit/WebCoreSupport/WebFrameBridge.mm
> trunk/WebKit/WebView/WebDataSource.mm
> trunk/WebKit/WebView/WebHTMLRepresentation.m
> trunk/WebKit/WebView/WebHTMLView.m
> Added Paths
>
> trunk/WebCore/bridge/mac/WebMimeTypeRegistryBridge.h
> trunk/WebCore/bridge/mac/WebMimeTypeRegistryBridge.mm
> trunk/WebCore/platform/MimeTypeRegistry.cpp
> trunk/WebCore/platform/MimeTypeRegistry.h
> trunk/WebCore/platform/mac/MimeTypeRegistryMac.mm
> Diff
>
> Modified: trunk/WebCore/ChangeLog (17700 => 17701)
>
> --- trunk/WebCore/ChangeLog 2006-11-10 05:17:06 UTC (rev 17700)
> +++ trunk/WebCore/ChangeLog 2006-11-10 07:31:04 UTC (rev 17701)
> @@ -1,3 +1,42 @@
> +2006-11-09 Oliver Hunt <oliver at apple.com>
> +
> + Reviewed by Brady.
> +
> + Pulled MIME type handling out of WebFrameBridge and added
> + a general C++ class to store/query MIME info
> + Added an Obj-C bridge to provide WebKit with access to the
> + MimeTypeRegistry for non-Obj-C++ classes.
> +
> + * WebCore.exp:
> + * WebCore.xcodeproj/project.pbxproj:
> + * bridge/mac/WebCoreFrameBridge.h:
> + * bridge/mac/WebCoreFrameBridge.mm:
> + * bridge/mac/WebMimeTypeRegistryBridge.h: Added.
> + * bridge/mac/WebMimeTypeRegistryBridge.mm: Added.
> + (+[WebMimeTypeRegistryBridge supportsImageWithMIMEType:]):
> + (+[WebMimeTypeRegistryBridge supportsNonImageWithMIMEType:]):
> + (+[WebMimeTypeRegistryBridge supportedNonImageMIMETypes]):
> + (+[WebMimeTypeRegistryBridge supportedImageMIMETypes]):
> + (+[WebMimeTypeRegistryBridge
> supportedImageResourceMIMETypes]):
> + * platform/Image.cpp:
> + (WebCore::Image::supportsType):
> + * platform/Image.h:
> + * platform/MimeTypeRegistry.cpp: Added.
> + (WebCore::initialiseSupportedImageMIMETypes):
> + (WebCore::initialiseSupportedNonImageMimeTypes):
> + (WebCore::initialiseMimeTypeRegistry):
> + (WebCore::MimeTypeRegistry::isSupportedImageMIMEType):
> +
> (WebCore::MimeTypeRegistry::isSupportedImageResourceMIMEType):
> + (WebCore::MimeTypeRegistry::isSupportedNonImageMIMEType):
> + (WebCore::MimeTypeRegistry::getSupportedImageMIMETypes):
> +
> (WebCore::MimeTypeRegistry::getSupportedImageResourceMIMETypes):
> + (WebCore::MimeTypeRegistry::getSupportedNonImageMIMETypes):
> + * platform/MimeTypeRegistry.h: Added.
> + * platform/mac/ImageMac.mm:
> + * platform/mac/MimeTypeRegistryMac.mm: Added.
> + (WebCore::getMIMETypeForUTI):
> + (WebCore::MimeTypeRegistry::getMIMETypeForExtension):
> +
> 2006-11-09 Maciej Stachowiak <mjs at apple.com>
>
> Reviewed by Oliver.
> Modified: trunk/WebCore/WebCore.exp (17700 => 17701)
>
> --- trunk/WebCore/WebCore.exp 2006-11-10 05:17:06 UTC (rev 17700)
> +++ trunk/WebCore/WebCore.exp 2006-11-10 07:31:04 UTC (rev 17701)
> @@ -116,6 +116,7 @@
> .objc_class_name_WebCoreSettings
> .objc_class_name_WebCoreStringTruncator
> .objc_class_name_WebCoreViewFactory
> +.objc_class_name_WebMimeTypeRegistryBridge
> .objc_class_name_WebDashboardRegion
> .objc_class_name_WebScriptObject
> .objc_class_name_WebScriptObjectPrivate
> @@ -392,6 +393,9 @@
> __ZNK7WebCore9FrameTree24traversePreviousWithWrapEb
> __ZNK7WebCore9FrameTree4findERKNS_12AtomicStringE
> __ZNK7WebCore9FrameTree5childERKNS_12AtomicStringE
> +__ZN7WebCore16MimeTypeRegistry24isSupportedImageMIMETypeERKNS_6String
> E
> +__ZN7WebCore16MimeTypeRegistry32isSupportedImageResourceMIMETypeERKNS
> _6StringE
> +__ZN7WebCore16MimeTypeRegistry27isSupportedNonImageMIMETypeERKNS_6Str
> ingE
> __ZNK7WebCore9Selection17isContentEditableEv
> __ZNK7WebCore9Selection23isContentRichlyEditableEv
> __ZNK7WebCore9Selection7toRangeEv
> Modified: trunk/WebCore/WebCore.xcodeproj/project.pbxproj (17700 =>
> 17701)
>
> --- trunk/WebCore/WebCore.xcodeproj/project.pbxproj 2006-11-10
> 05:17:06 UTC (rev 17700)
> +++ trunk/WebCore/WebCore.xcodeproj/project.pbxproj 2006-11-10
> 07:31:04 UTC (rev 17701)
> @@ -1626,6 +1626,9 @@
> 93F19B1608245E59001E9ABC /* JavaScriptCore.framework in
> Frameworks */ = {isa = PBXBuildFile; fileRef =
> F8216299029F4FB501000131 /* JavaScriptCore.framework */; };
> 93F19B1708245E59001E9ABC /* libicucore.dylib in Frameworks */ =
> {isa = PBXBuildFile; fileRef = 93F1D31A0558CC5C00821BC0 /*
> libicucore.dylib */; };
> 93F19B1808245E59001E9ABC /* libxslt.dylib in Frameworks */ =
> {isa = PBXBuildFile; fileRef = 840633070731A77200DB1FD1 /*
> libxslt.dylib */; };
> + A70023FD0B02BEAB00170215 /* MimeTypeRegistry.cpp in Sources */ =
> {isa = PBXBuildFile; fileRef = A70023FB0B02BEAB00170215 /*
> MimeTypeRegistry.cpp */; };
> + A70023FE0B02BEAB00170215 /* MimeTypeRegistry.h in Headers */ =
> {isa = PBXBuildFile; fileRef = A70023FC0B02BEAB00170215 /*
> MimeTypeRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
> + A70024000B02BECC00170215 /* MimeTypeRegistryMac.mm in Sources */
> = {isa = PBXBuildFile; fileRef = A70023FF0B02BECC00170215 /*
> MimeTypeRegistryMac.mm */; };
> A7638A8B09958EA50007E14F /* WKDisplacementMapFilter.h in Headers
> */ = {isa = PBXBuildFile; fileRef = A7638A8909958EA50007E14F /*
> WKDisplacementMapFilter.h */; };
> A7638A8C09958EA50007E14F /* WKDisplacementMapFilter.m in Sources
> */ = {isa = PBXBuildFile; fileRef = A7638A8A09958EA50007E14F /*
> WKDisplacementMapFilter.m */; };
> A7638A92099592C30007E14F /* WKDisplacementMapFilter.cikernel in
> Resources */ = {isa = PBXBuildFile; fileRef =
> A7638A91099592C30007E14F /* WKDisplacementMapFilter.cikernel */; };
> @@ -1648,6 +1651,8 @@
> A7B97B850979C3A1000E8EB1 /* WKTableTransferFilter.cikernel in
> Resources */ = {isa = PBXBuildFile; fileRef =
> A7B97B740979C3A1000E8EB1 /* WKTableTransferFilter.cikernel */; };
> A7B97B860979C3A1000E8EB1 /* WKTableTransferFilter.h in Headers
> */ = {isa = PBXBuildFile; fileRef = A7B97B750979C3A1000E8EB1 /*
> WKTableTransferFilter.h */; };
> A7B97B870979C3A1000E8EB1 /* WKTableTransferFilter.m in Sources
> */ = {isa = PBXBuildFile; fileRef = A7B97B760979C3A1000E8EB1 /*
> WKTableTransferFilter.m */; };
> + A7D23C540B03E41300582A4F /* WebMimeTypeRegistryBridge.h in
> Headers */ = {isa = PBXBuildFile; fileRef =
> A7D23C520B03E41300582A4F /* WebMimeTypeRegistryBridge.h */;
> settings = {ATTRIBUTES = (Private, ); }; };
> + A7D23C550B03E41300582A4F /* WebMimeTypeRegistryBridge.mm in
> Sources */ = {isa = PBXBuildFile; fileRef =
> A7D23C530B03E41300582A4F /* WebMimeTypeRegistryBridge.mm */; };
> A80E6CE40A1989CA007FB8C5 /* CSSValueList.cpp in Sources */ =
> {isa = PBXBuildFile; fileRef = A80E6CBA0A1989CA007FB8C5 /*
> CSSValueList.cpp */; };
> A80E6CE50A1989CA007FB8C5 /* CSSBorderImageValue.cpp in Sources
> */ = {isa = PBXBuildFile; fileRef = A80E6CBB0A1989CA007FB8C5 /*
> CSSBorderImageValue.cpp */; };
> A80E6CE60A1989CA007FB8C5 /* CSSPrimitiveValue.h in Headers */ =
> {isa = PBXBuildFile; fileRef = A80E6CBC0A1989CA007FB8C5 /*
> CSSPrimitiveValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
> @@ -4441,6 +4446,9 @@
> 93F8B3060A300FEA00F61AB8 /* CodeGeneratorJS.pm */ = {isa =
> PBXFileReference; fileEncoding = 4; lastKnownFileType =
> text.script.perl; name = CodeGeneratorJS.pm; path = ../scripts/
> CodeGeneratorJS.pm; sourceTree = "<group>"; };
> 93F8B3070A300FEA00F61AB8 /* generate-bindings.pl */ = {isa =
> PBXFileReference; fileEncoding = 4; lastKnownFileType =
> text.script.perl; name = "generate-bindings.pl"; path = "scripts/
> generate-bindings.pl"; sourceTree = "<group>"; };
> 93F8B3080A300FEA00F61AB8 /* IDLStructure.pm */ = {isa =
> PBXFileReference; fileEncoding = 4; lastKnownFileType =
> text.script.perl; name = IDLStructure.pm; path = scripts/
> IDLStructure.pm; sourceTree = "<group>"; };
> + A70023FB0B02BEAB00170215 /* MimeTypeRegistry.cpp */ = {isa =
> PBXFileReference; fileEncoding = 30; lastKnownFileType =
> sourcecode.cpp.cpp; path = MimeTypeRegistry.cpp; sourceTree =
> "<group>"; };
> + A70023FC0B02BEAB00170215 /* MimeTypeRegistry.h */ = {isa =
> PBXFileReference; fileEncoding = 30; lastKnownFileType =
> sourcecode.c.h; path = MimeTypeRegistry.h; sourceTree = "<group>"; };
> + A70023FF0B02BECC00170215 /* MimeTypeRegistryMac.mm */ = {isa =
> PBXFileReference; fileEncoding = 30; lastKnownFileType =
> sourcecode.cpp.objcpp; path = MimeTypeRegistryMac.mm; sourceTree =
> "<group>"; };
> A7638A8909958EA50007E14F /* WKDisplacementMapFilter.h */ = {isa
> = PBXFileReference; fileEncoding = 30; lastKnownFileType =
> sourcecode.c.h; path = WKDisplacementMapFilter.h; sourceTree =
> "<group>"; };
> A7638A8A09958EA50007E14F /* WKDisplacementMapFilter.m */ = {isa
> = PBXFileReference; fileEncoding = 30; lastKnownFileType =
> sourcecode.c.objc; path = WKDisplacementMapFilter.m; sourceTree =
> "<group>"; };
> A7638A91099592C30007E14F /* WKDisplacementMapFilter.cikernel */
> = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
> text; path = WKDisplacementMapFilter.cikernel; sourceTree =
> "<group>"; };
> @@ -4463,6 +4471,8 @@
> A7B97B740979C3A1000E8EB1 /* WKTableTransferFilter.cikernel */ =
> {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType =
> text; path = WKTableTransferFilter.cikernel; sourceTree =
> "<group>"; };
> A7B97B750979C3A1000E8EB1 /* WKTableTransferFilter.h */ = {isa =
> PBXFileReference; fileEncoding = 30; lastKnownFileType =
> sourcecode.c.h; path = WKTableTransferFilter.h; sourceTree =
> "<group>"; };
> A7B97B760979C3A1000E8EB1 /* WKTableTransferFilter.m */ = {isa =
> PBXFileReference; fileEncoding = 30; lastKnownFileType =
> sourcecode.c.objc; path = WKTableTransferFilter.m; sourceTree =
> "<group>"; };
> + A7D23C520B03E41300582A4F /* WebMimeTypeRegistryBridge.h */ =
> {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
> sourcecode.c.h; path = WebMimeTypeRegistryBridge.h; sourceTree =
> "<group>"; };
> + A7D23C530B03E41300582A4F /* WebMimeTypeRegistryBridge.mm */ =
> {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
> sourcecode.cpp.objcpp; path = WebMimeTypeRegistryBridge.mm;
> sourceTree = "<group>"; };
> A80E6CBA0A1989CA007FB8C5 /* CSSValueList.cpp */ = {isa =
> PBXFileReference; fileEncoding = 30; lastKnownFileType =
> sourcecode.cpp.cpp; path = CSSValueList.cpp; sourceTree =
> "<group>"; };
> A80E6CBB0A1989CA007FB8C5 /* CSSBorderImageValue.cpp */ = {isa =
> PBXFileReference; fileEncoding = 30; lastKnownFileType =
> sourcecode.cpp.cpp; path = CSSBorderImageValue.cpp; sourceTree =
> "<group>"; };
> A80E6CBC0A1989CA007FB8C5 /* CSSPrimitiveValue.h */ = {isa =
> PBXFileReference; fileEncoding = 30; lastKnownFileType =
> sourcecode.c.h; path = CSSPrimitiveValue.h; sourceTree = "<group>"; };
> @@ -6436,6 +6446,7 @@
> 935207BF09BD412000F2038D /* LocalizedStringsMac.mm */,
> 1402645D0AFDC19B005919E2 /* LoggingMac.mm */,
> 65F5382409B2B57500F3DC4A /* mac-encodings.txt */,
> + A70023FF0B02BECC00170215 /* MimeTypeRegistryMac.mm */,
> 935C476F09AC4D7300A6AAB4 /* PlatformMouseEventMac.mm */,
> BC3FCAA80AC3DB5800BA54AD /* PlatformScrollBar.h */,
> BC7B2AF90450824100A8000F /* PlatformScrollBarMac.mm */,
> @@ -6552,6 +6563,8 @@
> F587855502DE375901EA4122 /* WebCoreViewFactory.m */,
> 5150C2A10702629000AF642C /* WebDashboardRegion.h */,
> 5150C2A50702629800AF642C /* WebDashboardRegion.m */,
> + A7D23C520B03E41300582A4F /* WebMimeTypeRegistryBridge.h */,
> + A7D23C530B03E41300582A4F /* WebMimeTypeRegistryBridge.mm */,
> );
> path = mac;
> sourceTree = "<group>";
> @@ -8571,6 +8584,8 @@
> 935207BD09BD410A00F2038D /* LocalizedStrings.h */,
> A8239DFE09B3CF8A00B60641 /* Logging.cpp */,
> A8239DFF09B3CF8A00B60641 /* Logging.h */,
> + A70023FB0B02BEAB00170215 /* MimeTypeRegistry.cpp */,
> + A70023FC0B02BEAB00170215 /* MimeTypeRegistry.h */,
> AA98B87C0AAA02F8001A44C2 /* Path.cpp */,
> 93032CC909AEC34B00F82A18 /* Path.h */,
> BCC8D1710988301200140BF2 /* Pen.cpp */,
> @@ -9127,6 +9142,8 @@
> 93F1996D08245E59001E9ABC /* DeprecatedPtrListImpl.h in Headers
> */,
> 93F1996E08245E59001E9ABC /* LoaderFunctions.h in Headers */,
> 93F1997708245E59001E9ABC /* WebCorePageState.h in Headers */,
> + A70023FE0B02BEAB00170215 /* MimeTypeRegistry.h in Headers */,
> + A7D23C540B03E41300582A4F /* WebMimeTypeRegistryBridge.h in
> Headers */,
> 93F1998208245E59001E9ABC /* DeprecatedPtrList.h in Headers */,
> 93F1998308245E59001E9ABC /* DeprecatedPtrQueue.h in Headers */,
> 93F1998A08245E59001E9ABC /* RegularExpression.h in Headers */,
> @@ -11756,8 +11773,11 @@
> 1402692D0AFE72D8005919E2 /* ScreenMac.mm in Sources */,
> 65DAD9FC0AFD86B400CE53ED /* FormData.cpp in Sources */,
> 65DADA010AFD86BF00CE53ED /* FormDataStreamMac.mm in Sources */,
> + A70023FD0B02BEAB00170215 /* MimeTypeRegistry.cpp in Sources */,
> + A70024000B02BECC00170215 /* MimeTypeRegistryMac.mm in Sources */,
> 651888880AFF3BF700164720 /* ResourceError.cpp in Sources */,
> 6518888B0AFF3C1400164720 /* ResourceErrorMac.mm in Sources */,
> + A7D23C550B03E41300582A4F /* WebMimeTypeRegistryBridge.mm in
> Sources */,
> );
> runOnlyForDeploymentPostprocessing = 0;
> };
> Modified: trunk/WebCore/bridge/mac/WebCoreFrameBridge.h (17700 =>
> 17701)
>
> --- trunk/WebCore/bridge/mac/WebCoreFrameBridge.h 2006-11-10
> 05:17:06 UTC (rev 17700)
> +++ trunk/WebCore/bridge/mac/WebCoreFrameBridge.h 2006-11-10
> 07:31:04 UTC (rev 17701)
> @@ -132,10 +132,6 @@
>
> - (void)close;
>
> -+ (NSArray *)supportedNonImageMIMETypes;
> -+ (NSArray *)supportedImageMIMETypes;
> -+ (NSArray *)supportedImageResourceMIMETypes; // includes types
> like PDF
> -
> - (void)addData:(NSData *)data;
>
> - (void)saveDocumentState;
> Modified: trunk/WebCore/bridge/mac/WebCoreFrameBridge.mm (17700 =>
> 17701)
>
> --- trunk/WebCore/bridge/mac/WebCoreFrameBridge.mm 2006-11-10
> 05:17:06 UTC (rev 17700)
> +++ trunk/WebCore/bridge/mac/WebCoreFrameBridge.mm 2006-11-10
> 07:31:04 UTC (rev 17701)
> @@ -247,74 +247,6 @@
> return nil;
> }
>
> -+ (NSArray *)supportedNonImageMIMETypes
> -{
> - return [NSArray arrayWithObjects:
> - @"text/html",
> - @"text/xml",
> - @"text/xsl",
> - @"text/",
> - @"application/x-javascript",
> - @"application/xml",
> - @"application/xhtml+xml",
> - @"application/rss+xml",
> - @"application/atom+xml",
> - @"application/x-webarchive",
> - @"multipart/x-mixed-replace",
> -#ifdef SVG_SUPPORT
> - @"image/svg+xml",
> -#endif
> - nil];
> -}
> -
> -+ (NSArray *)supportedImageResourceMIMETypes
> -{
> - static RetainPtr<NSArray> supportedTypes;
> - if (!supportedTypes) {
> - NSMutableSet* set = [[NSMutableSet alloc] init];
> -
> - // FIXME: Doesn't make sense to ask NSImage for a list of
> file types and extensions
> - // because we aren't using NSImage to decode the images
> any more.
> - NSEnumerator* enumerator = [[NSImage imageFileTypes]
> objectEnumerator];
> - while (NSString* type = [enumerator nextObject]) {
> - NSString* mime = wkGetMIMETypeForExtension(type);
> - if (mime)
> - [set addObject:mime];
> - }
> -
> - // image/pjpeg is the MIME type for progressive jpeg.
> These files have the jpg file extension.
> - // I believe we need this this to work around
> wkGetMIMETypeForExtension's limitation of only
> - // providing one MIME type for each extension.
> - [set addObject:@"image/pjpeg"];
> -
> - [set removeObject:@"application/octet-stream"];
> -
> - supportedTypes = [set allObjects];
> -
> - [set release];
> - }
> -
> - return supportedTypes.get();
> -}
> -
> -+ (NSArray *)supportedImageMIMETypes
> -{
> - static RetainPtr<NSArray> supportedTypes;
> - if (!supportedTypes) {
> - NSMutableArray* types = [[self
> supportedImageResourceMIMETypes] mutableCopy];
> - [types removeObject:@"application/pdf"];
> - [types removeObject:@"application/postscript"];
> - NSArray* copy = [types copy];
> - [types release];
> -
> - supportedTypes = copy;
> -
> - [copy release];
> - }
> -
> - return supportedTypes.get();
> -}
> -
> + (WebCoreFrameBridge *)bridgeForDOMDocument:(DOMDocument *)document
> {
> return bridge([document _document]->frame());
> Added: trunk/WebCore/bridge/mac/WebMimeTypeRegistryBridge.h (0 =>
> 17701)
>
> --- trunk/WebCore/bridge/mac/
> WebMimeTypeRegistryBridge.h (rev 0)
> +++ trunk/WebCore/bridge/mac/WebMimeTypeRegistryBridge.h 2006-11-10
> 07:31:04 UTC (rev 17701)
> @@ -0,0 +1,39 @@
> +/*
> + * Copyright (C) 2004, 2005, 2006 Apple Computer, 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
> + * 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.
> + */
> + at interface WebMimeTypeRegistryBridge : NSObject {
> +
> +}
> +
> +//Provide access to WebCore MimeTypeManager
> ++ (BOOL)supportsImageResourceWithMIMEType:(NSString *)mimeType;
> ++ (BOOL)supportsImageWithMIMEType:(NSString *)mimeType;
> ++ (BOOL)supportsNonImageWithMIMEType:(NSString *)mimeType;
> +
> + //Access to the underlying lists of supported types, needed by
> WebKit
> ++ (NSArray *)supportedNonImageMIMETypes;
> ++ (NSArray *)supportedImageMIMETypes;
> ++ (NSArray *)supportedImageResourceMIMETypes; // includes types
> like PDF
> +
> + at end
> Added: trunk/WebCore/bridge/mac/WebMimeTypeRegistryBridge.mm (0 =>
> 17701)
>
> --- trunk/WebCore/bridge/mac/
> WebMimeTypeRegistryBridge.mm (rev 0)
> +++ trunk/WebCore/bridge/mac/WebMimeTypeRegistryBridge.mm
> 2006-11-10 07:31:04 UTC (rev 17701)
> @@ -0,0 +1,99 @@
> +/*
> + * Copyright (C) 2004, 2005, 2006 Apple Computer, 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
> + * 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 "config.h"
> +#import "WebMimeTypeRegistryBridge.h"
> +#import "MimeTypeRegistry.h"
> +#import "RetainPtr.h"
> +
> +using namespace WebCore;
> +
> + at implementation WebMimeTypeRegistryBridge
> +
> ++ (BOOL)supportsImageResourceWithMIMEType:(NSString *)mimeType
> +{
> + return MimeTypeRegistry::isSupportedImageResourceMIMEType
> (mimeType);
> +}
> +
> ++ (BOOL)supportsImageWithMIMEType:(NSString *)mimeType
> +{
> + return MimeTypeRegistry::isSupportedImageMIMEType(mimeType);
> +}
> +
> ++ (BOOL)supportsNonImageWithMIMEType:(NSString *)mimeType
> +{
> + return MimeTypeRegistry::isSupportedNonImageMIMEType(mimeType);
> +}
> +
> +
> ++ (NSArray *)supportedNonImageMIMETypes
> +{
> + static RetainPtr<NSArray> supportedTypes;
> + if (!supportedTypes) {
> + NSMutableArray* atypes = [[NSMutableArray alloc] init];
> + const HashSet<String>& types =
> MimeTypeRegistry::getSupportedNonImageMIMETypes();
> + for (HashSet<String>::const_iterator it = types.begin();
> it != types.end(); ++it) {
> + [atypes addObject:(NSString *)(*it)];
> + }
> + supportedTypes = (NSArray *)[atypes copy];
> + [atypes release];
> + }
> +
> + return supportedTypes.get();
> +}
> +
> ++ (NSArray *)supportedImageMIMETypes
> +{
> + static RetainPtr<NSArray> supportedTypes;
> + if (!supportedTypes) {
> + NSMutableArray* atypes = [[NSMutableArray alloc] init];
> + const HashSet<String>& types =
> MimeTypeRegistry::getSupportedImageMIMETypes();
> + for (HashSet<String>::const_iterator it = types.begin();
> it != types.end(); ++it) {
> + [atypes addObject:(NSString *)(*it)];
> + }
> + supportedTypes = (NSArray *)[atypes copy];
> + [atypes release];
> + }
> +
> + return supportedTypes.get();
> +}
> +
> ++ (NSArray *)supportedImageResourceMIMETypes
> +{
> + static RetainPtr<NSArray> supportedTypes;
> + if (!supportedTypes) {
> + NSMutableArray* atypes = [[NSMutableArray alloc] init];
> + const HashSet<String>& types =
> MimeTypeRegistry::getSupportedImageResourceMIMETypes();
> + for (HashSet<String>::const_iterator it = types.begin();
> it != types.end(); ++it) {
> + [atypes addObject:(NSString *)(*it)];
> + }
> + supportedTypes = (NSArray *)[atypes copy];
> + [atypes release];
> + }
> +
> + return supportedTypes.get();
> +}
> +
> + at end
> Modified: trunk/WebCore/platform/Image.cpp (17700 => 17701)
>
> --- trunk/WebCore/platform/Image.cpp 2006-11-10 05:17:06 UTC (rev
> 17700)
> +++ trunk/WebCore/platform/Image.cpp 2006-11-10 07:31:04 UTC (rev
> 17701)
> @@ -34,6 +34,7 @@
> #include "PlatformString.h"
> #include "Timer.h"
> #include <wtf/Vector.h>
> +#include "MimeTypeRegistry.h"
>
> #if PLATFORM(CG)
> // FIXME: Will go away when we make PDF a subclass.
> @@ -114,6 +115,12 @@
> m_frames[index].m_hasAlpha = m_source.frameHasAlphaAtIndex
> (index);
> }
>
> +
> +bool Image::supportsType(const String& type)
> +{
> + return MimeTypeRegistry::isSupportedImageResourceMIMEType(type);
> +}
> +
> bool Image::isNull() const
> {
> return size().isEmpty();
> Modified: trunk/WebCore/platform/Image.h (17700 => 17701)
>
> --- trunk/WebCore/platform/Image.h 2006-11-10 05:17:06 UTC (rev 17700)
> +++ trunk/WebCore/platform/Image.h 2006-11-10 07:31:04 UTC (rev 17701)
> @@ -103,7 +103,7 @@
> ~Image();
>
> static Image* loadPlatformResource(const char *name);
> - static bool supportsType(const String& type);
> + static bool supportsType(const String& type);
>
> bool isNull() const;
>
> Added: trunk/WebCore/platform/MimeTypeRegistry.cpp (0 => 17701)
>
> --- trunk/WebCore/platform/
> MimeTypeRegistry.cpp (rev 0)
> +++ trunk/WebCore/platform/MimeTypeRegistry.cpp 2006-11-10 07:31:04
> UTC (rev 17701)
> @@ -0,0 +1,156 @@
> +/*
> + * Copyright (C) 2006 Apple Computer, 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
> + * 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.
> + */
> +
> +#include "config.h"
> +#include "MimeTypeRegistry.h"
> +#include "wtf/HashMap.h"
> +#include "wtf/HashSet.h"
> +#include <ApplicationServices/ApplicationServices.h>
> +#include "WebCoreSystemInterface.h"
> +
> +#include "StringHash.h"
> +
> +namespace WebCore
> +{
> +static WTF::HashSet<String> *supportedImageResourceMIMETypes;
> +static WTF::HashSet<String> *supportedImageMIMETypes;
> +static WTF::HashSet<String> *supportedNonImageMIMETypes;
> +
> +#if PLATFORM(CG)
> +extern String getMIMETypeForUTI(const String & uti);
> +#endif
> +
> +static void initialiseSupportedImageMIMETypes()
> +{
> +#if PLATFORM(CG)
> + CFArrayRef supportedTypes = CGImageSourceCopyTypeIdentifiers();
> + int cnt = CFArrayGetCount(supportedTypes);
> + for(int i = 0; i < cnt; i++) {
> + CFStringRef supportedType = (CFStringRef)
> CFArrayGetValueAtIndex(supportedTypes, i);
> + String mimeType=getMIMETypeForUTI(supportedType);
> + if (!mimeType.isEmpty()) {
> + supportedImageMIMETypes->add(mimeType);
> + supportedImageResourceMIMETypes->add(mimeType);
> + }
> + CFRelease(supportedType);
> + }
> + CFRelease(supportedTypes);
> +
> + //We only get one MIME type per UTI, hence our need to add
> these manually
> + supportedImageMIMETypes->add("image/pjpeg");
> + supportedImageResourceMIMETypes->add("image/pjpeg");
> +
> + //We don't want to try to treat all binary data as an image
> + supportedImageMIMETypes->remove("application/octet-stream");
> + supportedImageResourceMIMETypes->remove("application/octet-
> stream");
> +
> + //Don't treat pdf/postscript as images directly
> + supportedImageMIMETypes->remove("application/pdf");
> + supportedImageMIMETypes->remove("application/postscript");
> +
> +#else
> + //assume that all implementations at least support
> + supportedImageMIMETypes->add("jpg", "image/jpeg");
> + supportedImageMIMETypes->add("jpeg", "image/jpeg");
> + supportedImageMIMETypes->add("png", "image/png");
> + supportedImageMIMETypes->add("gif", "image/gif");
> + supportedImageMIMETypes->add("bmp", "image/bmp");
> +#endif;
> +}
> +
> +static void initialiseSupportedNonImageMimeTypes()
> +{
> + supportedNonImageMIMETypes->add("text/html");
> + supportedNonImageMIMETypes->add("text/xml");
> + supportedNonImageMIMETypes->add("text/xsl");
> + supportedNonImageMIMETypes->add("text/plain");
> + supportedNonImageMIMETypes->add("text/");
> + supportedNonImageMIMETypes->add("application/x-javascript");
> + supportedNonImageMIMETypes->add("application/xml");
> + supportedNonImageMIMETypes->add("application/xhtml+xml");
> + supportedNonImageMIMETypes->add("application/rss+xml");
> + supportedNonImageMIMETypes->add("application/atom+xml");
> +#if PLATFORM(MAC)
> + supportedNonImageMIMETypes->add("application/x-webarchive");
> +#endif
> + supportedNonImageMIMETypes->add("multipart/x-mixed-replace");
> +#ifdef SVG_SUPPORT
> + supportedNonImageMIMETypes->add("image/svg+xml");
> +#endif
> +}
> +
> +static void initialiseMimeTypeRegistry()
> +{
> + supportedImageResourceMIMETypes = new WTF::HashSet<String>();
> + supportedImageMIMETypes = new WTF::HashSet<String>();
> + supportedNonImageMIMETypes = new WTF::HashSet<String>();
> +
> + initialiseSupportedNonImageMimeTypes();
> + initialiseSupportedImageMIMETypes();
> +}
> +
> +bool MimeTypeRegistry::isSupportedImageMIMEType(const String
> &mimeType)
> +{
> + if (!supportedImageMIMETypes)
> + initialiseMimeTypeRegistry();
> + return !mimeType.isEmpty() && supportedImageMIMETypes->contains
> (mimeType);
> +}
> +
> +bool MimeTypeRegistry::isSupportedImageResourceMIMEType(const
> String &mimeType)
> +{
> + if (!supportedImageResourceMIMETypes)
> + initialiseMimeTypeRegistry();
> + return !mimeType.isEmpty() && supportedImageResourceMIMETypes-
> >contains(mimeType);
> +}
> +
> +bool MimeTypeRegistry::isSupportedNonImageMIMEType(const String
> &mimeType)
> +{
> + if (!supportedNonImageMIMETypes)
> + initialiseMimeTypeRegistry();
> + return !mimeType.isEmpty() && supportedNonImageMIMETypes-
> >contains(mimeType);
> +}
> +
> +const HashSet<String> &MimeTypeRegistry::getSupportedImageMIMETypes()
> +{
> + if (!supportedImageMIMETypes)
> + initialiseMimeTypeRegistry();
> + return *supportedImageMIMETypes;
> +}
> +
> +const HashSet<String>
> &MimeTypeRegistry::getSupportedImageResourceMIMETypes()
> +{
> + if (!supportedImageResourceMIMETypes)
> + initialiseMimeTypeRegistry();
> + return *supportedImageResourceMIMETypes;
> +}
> +
> +const HashSet<String>
> &MimeTypeRegistry::getSupportedNonImageMIMETypes()
> +{
> + if (!supportedNonImageMIMETypes)
> + initialiseMimeTypeRegistry();
> + return *supportedNonImageMIMETypes;
> +}
> +
> +}
> Added: trunk/WebCore/platform/MimeTypeRegistry.h (0 => 17701)
>
> --- trunk/WebCore/platform/
> MimeTypeRegistry.h (rev 0)
> +++ trunk/WebCore/platform/MimeTypeRegistry.h 2006-11-10 07:31:04
> UTC (rev 17701)
> @@ -0,0 +1,49 @@
> +/*
> + * Copyright (C) 2006 Apple Computer, 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
> + * 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.
> + */
> +
> +#ifndef MimeTypeRegistry_h
> +#define MimeTypeRegistry_h
> +
> +#include "PlatformString.h"
> +#include "wtf/HashSet.h"
> +#include "StringHash.h"
> +
> +namespace WebCore
> +{
> +
> +class MimeTypeRegistry {
> +public:
> + static String getMIMETypeForExtension(const String &ext);
> + static bool isSupportedImageMIMEType(const String &mimeType);
> + static bool isSupportedImageResourceMIMEType(const String
> &mimeType);
> + static bool isSupportedNonImageMIMEType(const String &mimeType);
> + static const HashSet<String> &getSupportedImageMIMETypes();
> + static const HashSet<String>
> &getSupportedImageResourceMIMETypes();
> + static const HashSet<String> &getSupportedNonImageMIMETypes();
> +};
> +
> +}
> +
> +#endif // !MimeTypeRegistry_h
> Modified: trunk/WebCore/platform/mac/ImageMac.mm (17700 => 17701)
>
> --- trunk/WebCore/platform/mac/ImageMac.mm 2006-11-10 05:17:06 UTC
> (rev 17700)
> +++ trunk/WebCore/platform/mac/ImageMac.mm 2006-11-10 07:31:04 UTC
> (rev 17701)
> @@ -75,13 +75,6 @@
> return 0;
> }
>
> -bool Image::supportsType(const String& type)
> -{
> - // FIXME: Would be better if this was looking in a set rather
> than an NSArray.
> - // FIXME: Would be better not to convert to an NSString just
> to check if a type is supported.
> - return [[WebCoreFrameBridge supportedImageResourceMIMETypes]
> containsObject:type];
> -}
> -
> CFDataRef Image::getTIFFRepresentation()
> {
> if (m_tiffRep)
> Added: trunk/WebCore/platform/mac/MimeTypeRegistryMac.mm (0 => 17701)
>
> --- trunk/WebCore/platform/mac/
> MimeTypeRegistryMac.mm (rev 0)
> +++ trunk/WebCore/platform/mac/MimeTypeRegistryMac.mm 2006-11-10
> 07:31:04 UTC (rev 17701)
> @@ -0,0 +1,48 @@
> +/*
> + * Copyright (C) 2006 Apple Computer, 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
> + * 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.
> + */
> +
> +#include "config.h"
> +#include "MimeTypeRegistry.h"
> +#include "WebCoreSystemInterface.h"
> +
> +namespace WebCore
> +{
> +String getMIMETypeForUTI(const String & uti)
> +{
> + CFStringRef utiref = uti.createCFString();
> + CFStringRef mime = UTTypeCopyPreferredTagWithClass(utiref,
> kUTTagClassMIMEType);
> + String mimeType = mime;
> + if (mime)
> + CFRelease(mime);
> + CFRelease(utiref);
> + return mimeType;
> +}
> +
> +String MimeTypeRegistry::getMIMETypeForExtension(const String &ext)
> +{
> + return wkGetMIMETypeForExtension(ext);
> +}
> +
> +}
> Modified: trunk/WebKit/ChangeLog (17700 => 17701)
>
> --- trunk/WebKit/ChangeLog 2006-11-10 05:17:06 UTC (rev 17700)
> +++ trunk/WebKit/ChangeLog 2006-11-10 07:31:04 UTC (rev 17701)
> @@ -1,3 +1,22 @@
> +2006-11-09 Oliver Hunt <oliver at apple.com>
> +
> + Reviewed by Brady.
> +
> + Updated to make use of MimeTypeRegistry/bridge
> +
> + * Misc/WebNSPasteboardExtras.m:
> + (-[NSPasteboard
> _web_writeImage:element:URL:title:archive:types:]):
> + * WebCoreSupport/WebFrameBridge.mm:
> + (-[WebFrameBridge determineObjectFromMIMEType:URL:]):
> + * WebView/WebDataSource.mm:
> + (-[WebDataSource _documentFragmentWithArchive:]):
> + * WebView/WebHTMLRepresentation.m:
> + (+[WebHTMLRepresentation supportedNonImageMIMETypes]):
> + (+[WebHTMLRepresentation supportedImageMIMETypes]):
> + * WebView/WebHTMLView.m:
> + (-[WebHTMLView _imageExistsAtPaths:]):
> + (-[WebHTMLView _documentFragmentWithPaths:]):
> +
> 2006-11-09 Brady Eidson <beidson at apple.com>
>
> Reviewed by Darin
> Modified: trunk/WebKit/Misc/WebNSPasteboardExtras.m (17700 => 17701)
>
> --- trunk/WebKit/Misc/WebNSPasteboardExtras.m 2006-11-10 05:17:06
> UTC (rev 17700)
> +++ trunk/WebKit/Misc/WebNSPasteboardExtras.m 2006-11-10 07:31:04
> UTC (rev 17701)
> @@ -37,6 +37,7 @@
> #import <JavaScriptCore/Assertions.h>
> #import <WebKit/DOMPrivate.h>
> #import <WebKitSystemInterface.h>
> +#import <WebCore/WebMimeTypeRegistryBridge.h>
>
> NSString *WebURLPboardType = nil;
> NSString *WebURLNamePboardType = nil;
> @@ -240,13 +241,12 @@
> if ([types containsObject:NSRTFDPboardType]) {
> // This image data is either the only subresource of
> an archive (HTML image case)
> // or the main resource (standalone image case).
> - NSArray *imageTypes = [WebFrameBridge
> supportedImageResourceMIMETypes];
> NSArray *subresources = [archive subresources];
> WebResource *mainResource = [archive mainResource];
> - WebResource *resource = ![imageTypes containsObject:
> [mainResource MIMEType]] && [subresources count] > 0 ? (WebResource
> *)[subresources objectAtIndex:0] : mainResource;
> + WebResource *resource = ![WebMimeTypeRegistryBridge
> supportsImageResourceWithMIMEType:[mainResource MIMEType]] &&
> [subresources count] > 0 ? (WebResource *)[subresources
> objectAtIndex:0] : mainResource;
> ASSERT(resource != nil);
>
> - ASSERT([imageTypes containsObject:[resource MIMEType]]);
> + ASSERT([WebMimeTypeRegistryBridge
> supportsImageResourceWithMIMEType:[resource MIMEType]]);
> [self _web_writeFileWrapperAsRTFDAttachment:[resource
> _fileWrapperRepresentation]];
> }
> if ([types containsObject:WebArchivePboardType]) {
> Modified: trunk/WebKit/WebCoreSupport/WebFrameBridge.mm (17700 =>
> 17701)
>
> --- trunk/WebKit/WebCoreSupport/WebFrameBridge.mm 2006-11-10
> 05:17:06 UTC (rev 17700)
> +++ trunk/WebKit/WebCoreSupport/WebFrameBridge.mm 2006-11-10
> 07:31:04 UTC (rev 17701)
> @@ -85,6 +85,7 @@
> #import <WebCore/WebCoreSettings.h>
> #import <WebKitSystemInterface.h>
> #import <wtf/RefPtr.h>
> +#import <WebCore/MimeTypeRegistry.h>
>
> // For compatibility with old SPI.
> @interface NSView (OldWebPlugin)
> @@ -797,7 +798,7 @@
> if ([MIMEType length] == 0)
> return ObjectElementFrame; // Go ahead and hope that we
> can display the content.
>
> - if ([[WebCoreFrameBridge supportedImageMIMETypes]
> containsObject:MIMEType])
> + if (MimeTypeRegistry::isSupportedImageMIMEType(MIMEType))
> return ObjectElementFrame;
>
> if ([[self webView] _isMIMETypeRegisteredAsPlugin:MIMEType])
> Modified: trunk/WebKit/WebView/WebDataSource.mm (17700 => 17701)
>
> --- trunk/WebKit/WebView/WebDataSource.mm 2006-11-10 05:17:06 UTC
> (rev 17700)
> +++ trunk/WebKit/WebView/WebDataSource.mm 2006-11-10 07:31:04 UTC
> (rev 17701)
> @@ -56,6 +56,7 @@
> #import <WebKit/DOMHTML.h>
> #import <WebKit/DOMPrivate.h>
> #import <WebKitSystemInterface.h>
> +#import <WebCore/MimeTypeRegistry.h>
>
> using namespace WebCore;
>
> @@ -247,7 +248,7 @@
> DOMDocumentFragment *fragment = [[self _bridge]
> documentFragmentWithMarkupString:markupString baseURLString:
> [[mainResource URL] _web_originalDataAsString]];
> [markupString release];
> return fragment;
> - } else if ([[WebFrameBridge
> supportedImageResourceMIMETypes] containsObject:MIMEType]) {
> + } else if (MimeTypeRegistry::isSupportedImageMIMEType
> (MIMEType)) {
> return [self
> _documentFragmentWithImageResource:mainResource];
>
> }
> Modified: trunk/WebKit/WebView/WebHTMLRepresentation.m (17700 =>
> 17701)
>
> --- trunk/WebKit/WebView/WebHTMLRepresentation.m 2006-11-10
> 05:17:06 UTC (rev 17700)
> +++ trunk/WebKit/WebView/WebHTMLRepresentation.m 2006-11-10
> 07:31:04 UTC (rev 17701)
> @@ -48,6 +48,7 @@
> #import <WebCore/DocumentLoader.h>
> #import <WebCore/FrameMac.h>
> #import <WebCore/Range.h>
> +#import <WebCore/WebMimeTypeRegistryBridge.h>
>
> using namespace WebCore;
>
> @@ -90,12 +91,12 @@
>
> + (NSArray *)supportedNonImageMIMETypes
> {
> - return [WebCoreFrameBridge supportedNonImageMIMETypes];
> + return [WebMimeTypeRegistryBridge supportedNonImageMIMETypes];
> }
>
> + (NSArray *)supportedImageMIMETypes
> {
> - return [WebCoreFrameBridge supportedImageMIMETypes];
> + return [WebMimeTypeRegistryBridge supportedImageMIMETypes];
> }
>
> - init
> Modified: trunk/WebKit/WebView/WebHTMLView.m (17700 => 17701)
>
> --- trunk/WebKit/WebView/WebHTMLView.m 2006-11-10 05:17:06 UTC (rev
> 17700)
> +++ trunk/WebKit/WebView/WebHTMLView.m 2006-11-10 07:31:04 UTC (rev
> 17701)
> @@ -84,6 +84,7 @@
> #import <WebKit/DOMPrivate.h>
> #import <WebKitSystemInterface.h>
> #import <mach-o/dyld.h>
> +#import <WebCore/WebMimeTypeRegistryBridge.h>
>
> using namespace WebCore;
>
> @@ -297,13 +298,12 @@
>
> - (BOOL)_imageExistsAtPaths:(NSArray *)paths
> {
> - NSArray *imageMIMETypes = [WebFrameBridge
> supportedImageResourceMIMETypes];
> NSEnumerator *enumerator = [paths objectEnumerator];
> NSString *path;
>
> while ((path = [enumerator nextObject]) != nil) {
> NSString *MIMEType = WKGetMIMETypeForExtension([path
> pathExtension]);
> - if ([imageMIMETypes containsObject:MIMEType]) {
> + if ([WebMimeTypeRegistryBridge
> supportsImageResourceWithMIMEType:MIMEType]) {
> return YES;
> }
> }
> @@ -334,7 +334,6 @@
> - (DOMDocumentFragment *)_documentFragmentWithPaths:(NSArray *)paths
> {
> DOMDocumentFragment *fragment;
> - NSArray *imageMIMETypes = [WebFrameBridge
> supportedImageResourceMIMETypes];
> NSEnumerator *enumerator = [paths objectEnumerator];
> WebDataSource *dataSource = [self _dataSource];
> NSMutableArray *domNodes = [[NSMutableArray alloc] init];
> @@ -342,7 +341,7 @@
>
> while ((path = [enumerator nextObject]) != nil) {
> NSString *MIMEType = WKGetMIMETypeForExtension([path
> pathExtension]);
> - if ([imageMIMETypes containsObject:MIMEType]) {
> + if ([WebMimeTypeRegistryBridge
> supportsImageResourceWithMIMEType:MIMEType]) {
> WebResource *resource = [[WebResource alloc]
> initWithData:[NSData dataWithContentsOfFile:path]
>
> URL:[NSURL fileURLWithPath:path]
>
> MIMEType:MIMEType
> _______________________________________________
> webkit-changes mailing list
> webkit-changes at opendarwin.org
> http://www.opendarwin.org/mailman/listinfo/webkit-changes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/webkit-changes/attachments/20061110/4b74257b/attachment.html
More information about the webkit-changes
mailing list