WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
proposed patch
HTMLWriter.txt (text/plain), 25.71 KB, created by
Alexey Proskuryakov
on 2017-08-31 09:22:57 PDT
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Alexey Proskuryakov
Created:
2017-08-31 09:22:57 PDT
Size:
25.71 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 220974) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,24 @@ >+2017-08-30 Alexey Proskuryakov <ap@apple.com> >+ >+ Layering violation in Editor::createFragment >+ https://bugs.webkit.org/show_bug.cgi?id=176123 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebCore.xcodeproj/project.pbxproj: >+ * editing/cocoa/WebArchiveResourceAsWebResourceHandler.h: >+ * editing/cocoa/WebArchiveResourceAsWebResourceHandler.mm: >+ Added a wrapper class for ArchiveResource, suitable for use as a WebResourceHandler. >+ >+ * editing/cocoa/EditorCocoa.mm: >+ (WebCore::attributesForAttributedStringConversion): >+ (WebCore::Editor::createFragment): >+ On newer OS versions, don't use WebKitLegacy to convert NSAttributedString to a >+ document fragment. We now only use system frameworks to convert the attributed >+ string to HTML source, and parse HTML into a fragment directly in WebCore. >+ >+ * platform/URL.h: Exported fakeURLWithRelativePart. >+ > 2017-08-21 Andy Estes <aestes@apple.com> > > [Payment Request] Implement the PaymentRequest constructor >Index: Source/WebCore/WebCore.xcodeproj/project.pbxproj >=================================================================== >--- Source/WebCore/WebCore.xcodeproj/project.pbxproj (revision 220974) >+++ Source/WebCore/WebCore.xcodeproj/project.pbxproj (working copy) >@@ -6610,6 +6610,8 @@ > E182568F0EF2B02D00933242 /* JSWorkerGlobalScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E182568D0EF2B02D00933242 /* JSWorkerGlobalScope.cpp */; }; > E18256900EF2B02D00933242 /* JSWorkerGlobalScope.h in Headers */ = {isa = PBXBuildFile; fileRef = E182568E0EF2B02D00933242 /* JSWorkerGlobalScope.h */; }; > E18258AC0EF3CD7000933242 /* JSWorkerGlobalScopeCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18258AB0EF3CD7000933242 /* JSWorkerGlobalScopeCustom.cpp */; }; >+ E18536841F4E481400FE091B /* WebArchiveResourceAsWebResourceHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = E18536811F4E472700FE091B /* WebArchiveResourceAsWebResourceHandler.h */; }; >+ E18536851F50906100FE091B /* WebArchiveResourceAsWebResourceHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = E18536821F4E472700FE091B /* WebArchiveResourceAsWebResourceHandler.mm */; }; > E18772F1126E2629003DD586 /* Language.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18772F0126E2629003DD586 /* Language.cpp */; }; > E18DF33518AAF12C00773E59 /* SerializedCryptoKeyWrap.h in Headers */ = {isa = PBXBuildFile; fileRef = E18DF33418AAF12C00773E59 /* SerializedCryptoKeyWrap.h */; settings = {ATTRIBUTES = (Private, ); }; }; > E18DF33818AAF14D00773E59 /* SerializedCryptoKeyWrapMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E18DF33618AAF14D00773E59 /* SerializedCryptoKeyWrapMac.mm */; }; >@@ -15265,6 +15267,8 @@ > E182568D0EF2B02D00933242 /* JSWorkerGlobalScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerGlobalScope.cpp; sourceTree = "<group>"; }; > E182568E0EF2B02D00933242 /* JSWorkerGlobalScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorkerGlobalScope.h; sourceTree = "<group>"; }; > E18258AB0EF3CD7000933242 /* JSWorkerGlobalScopeCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerGlobalScopeCustom.cpp; sourceTree = "<group>"; }; >+ E18536811F4E472700FE091B /* WebArchiveResourceAsWebResourceHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebArchiveResourceAsWebResourceHandler.h; sourceTree = "<group>"; }; >+ E18536821F4E472700FE091B /* WebArchiveResourceAsWebResourceHandler.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebArchiveResourceAsWebResourceHandler.mm; sourceTree = "<group>"; }; > E18772F0126E2629003DD586 /* Language.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Language.cpp; sourceTree = "<group>"; }; > E18DF33418AAF12C00773E59 /* SerializedCryptoKeyWrap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerializedCryptoKeyWrap.h; sourceTree = "<group>"; }; > E18DF33618AAF14D00773E59 /* SerializedCryptoKeyWrapMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SerializedCryptoKeyWrapMac.mm; sourceTree = "<group>"; }; >@@ -19896,6 +19900,8 @@ > 9B55EEE81B3E8898005342BC /* EditorCocoa.mm */, > 7C3E510818DF8F3500C112F7 /* HTMLConverter.h */, > 7C3E510918DF8F3500C112F7 /* HTMLConverter.mm */, >+ E18536811F4E472700FE091B /* WebArchiveResourceAsWebResourceHandler.h */, >+ E18536821F4E472700FE091B /* WebArchiveResourceAsWebResourceHandler.mm */, > ); > path = cocoa; > sourceTree = "<group>"; >@@ -29909,6 +29915,7 @@ > 0806E57A12893045007CED32 /* SVGMatrix.h in Headers */, > 08CA3D4412894A3800FFF260 /* SVGMatrixTearOff.h in Headers */, > 7CE58D5C1DD7EC9C00128552 /* SVGMatrixValue.h in Headers */, >+ E18536841F4E481400FE091B /* WebArchiveResourceAsWebResourceHandler.h in Headers */, > B2227A4B0D00BF220071B782 /* SVGMetadataElement.h in Headers */, > B2A1F2B10CEF0ABF00442F6A /* SVGMissingGlyphElement.h in Headers */, > B2227A4E0D00BF220071B782 /* SVGMPathElement.h in Headers */, >@@ -32385,6 +32392,7 @@ > A1CC56781F4614A500A4555B /* JSPaymentRequest.cpp in Sources */, > A1F600571F4765050077E83F /* JSPaymentRequestUpdateEvent.cpp in Sources */, > A1F600591F4765050077E83F /* JSPaymentRequestUpdateEventInit.cpp in Sources */, >+ E18536851F50906100FE091B /* WebArchiveResourceAsWebResourceHandler.mm in Sources */, > A1CC567A1F4614AA00A4555B /* JSPaymentResponse.cpp in Sources */, > A1CC567C1F4614AF00A4555B /* JSPaymentShippingOption.cpp in Sources */, > A1CC567E1F4614B400A4555B /* JSPaymentShippingType.cpp in Sources */, >Index: Source/WebCore/editing/cocoa/EditorCocoa.mm >=================================================================== >--- Source/WebCore/editing/cocoa/EditorCocoa.mm (revision 220974) >+++ Source/WebCore/editing/cocoa/EditorCocoa.mm (working copy) >@@ -40,6 +40,7 @@ > #import "Frame.h" > #import "FrameLoader.h" > #import "FrameSelection.h" >+#import "HTMLBodyElement.h" > #import "HTMLConverter.h" > #import "HTMLImageElement.h" > #import "HTMLSpanElement.h" >@@ -48,20 +49,24 @@ > #import "RenderElement.h" > #import "RenderStyle.h" > #import "Text.h" >+#import "WebArchiveResourceAsWebResourceHandler.h" > #import <pal/spi/cocoa/NSAttributedStringSPI.h> > #import <wtf/BlockObjCExceptions.h> > #import <wtf/SoftLinking.h> > >-#if PLATFORM(IOS) >+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) >+@interface NSAttributedString () >+- (NSString *)_htmlDocumentFragmentString:(NSRange)range documentAttributes:(NSDictionary *)dict subresources:(NSArray **)subresources; >+@end >+#elif PLATFORM(IOS) > SOFT_LINK_PRIVATE_FRAMEWORK(WebKitLegacy) >-#endif >- >-#if PLATFORM(MAC) >+#elif PLATFORM(MAC) > SOFT_LINK_FRAMEWORK_IN_UMBRELLA(WebKit, WebKitLegacy) > #endif > >-// FIXME: Get rid of this and change NSAttributedString conversion so it doesn't use WebKitLegacy (cf. rdar://problem/30597352). >+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300) > SOFT_LINK(WebKitLegacy, _WebCreateFragment, void, (WebCore::Document& document, NSAttributedString *string, WebCore::FragmentAndResources& result), (document, string, result)) >+#endif > > namespace WebCore { > >@@ -145,15 +150,66 @@ RetainPtr<NSDictionary> Editor::fontAttr > return attributes; > } > >+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) >+ >+static NSDictionary *attributesForAttributedStringConversion() >+{ >+ // This function needs to be kept in sync with identically named one in WebKitLegacy, which is used on older OS versions. >+ RetainPtr<NSArray> excludedElements = adoptNS([[NSArray alloc] initWithObjects: >+ // Omit style since we want style to be inline so the fragment can be easily inserted. >+ @"style", >+ // Omit xml so the result is not XHTML. >+ @"xml", >+ // Omit tags that will get stripped when converted to a fragment anyway. >+ @"doctype", @"html", @"head", @"body", >+ // Omit deprecated tags. >+ @"applet", @"basefont", @"center", @"dir", @"font", @"menu", @"s", @"strike", @"u", >+ // Omit object so no file attachments are part of the fragment. >+ @"object", nil]); >+ >+#if PLATFORM(IOS) >+ static NSString * const NSExcludedElementsDocumentAttribute = @"ExcludedElements"; >+#endif >+ >+ NSDictionary *dictionary = @{ >+ NSExcludedElementsDocumentAttribute: excludedElements.get(), >+ @"InterchangeNewline": @YES, >+ @"CoalesceTabSpans": @YES, >+ @"OutputBaseURL": (NSURL *)URL::fakeURLWithRelativePart(emptyString()), >+ @"WebResourceHandler": [WebArchiveResourceAsWebResourceHandler class], >+ }; >+ >+ return dictionary; >+} >+ >+FragmentAndResources Editor::createFragment(NSAttributedString *string) >+{ >+ FragmentAndResources result; >+ Document& document = *m_frame.document(); >+ >+ NSArray *subresources = nil; >+ NSString *htmlFragmentString = [string _htmlDocumentFragmentString:NSMakeRange(0, [string length]) documentAttributes:attributesForAttributedStringConversion() subresources:&subresources]; >+ RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); >+ fragment->parseHTML(htmlFragmentString, document.body(), DisallowScriptingAndPluginContent); >+ >+ result.fragment = fragment; >+ for (WebArchiveResourceAsWebResourceHandler *resource in subresources) >+ result.resources.append(*resource->resource); >+ >+ return result; >+} >+ >+#else >+ > FragmentAndResources Editor::createFragment(NSAttributedString *string) > { >- // FIXME: The algorithm to convert an attributed string into HTML should be implemented here in WebCore. >- // For now, though, we call into WebKitLegacy, which in turn calls into AppKit/TextKit. > FragmentAndResources result; > _WebCreateFragment(*m_frame.document(), string, result); > return result; > } > >+#endif >+ > static RefPtr<SharedBuffer> archivedDataForAttributedString(NSAttributedString *attributedString) > { > if (!attributedString.length) >Index: Source/WebCore/editing/cocoa/WebArchiveResourceAsWebResourceHandler.h >=================================================================== >--- Source/WebCore/editing/cocoa/WebArchiveResourceAsWebResourceHandler.h (nonexistent) >+++ Source/WebCore/editing/cocoa/WebArchiveResourceAsWebResourceHandler.h (working copy) >@@ -0,0 +1,38 @@ >+/* >+ * Copyright (C) 2017 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 INC. 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 INC. 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. >+ */ >+ >+#pragma once >+ >+#import <wtf/RefPtr.h> >+ >+namespace WebCore { >+class ArchiveResource; >+} >+ >+@interface WebArchiveResourceAsWebResourceHandler : NSObject { >+@package >+ RefPtr<WebCore::ArchiveResource> resource; >+} >+@end >Index: Source/WebCore/editing/cocoa/WebArchiveResourceAsWebResourceHandler.mm >=================================================================== >--- Source/WebCore/editing/cocoa/WebArchiveResourceAsWebResourceHandler.mm (nonexistent) >+++ Source/WebCore/editing/cocoa/WebArchiveResourceAsWebResourceHandler.mm (working copy) >@@ -0,0 +1,66 @@ >+/* >+ * Copyright (C) 2017 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 INC. 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 INC. 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 "config.h" >+#import "WebArchiveResourceAsWebResourceHandler.h" >+ >+#import "ArchiveResource.h" >+ >+using namespace WebCore; >+ >+@implementation WebArchiveResourceAsWebResourceHandler >+ >+- (instancetype)initWithData:(NSData *)data URL:(NSURL *)URL MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)textEncodingName frameName:(NSString *)frameName >+{ >+ if (!(self = [super init])) >+ return nil; >+ >+ if (!data || !URL || !MIMEType) { >+ [self release]; >+ return nil; >+ } >+ >+ resource = WebCore::ArchiveResource::create(SharedBuffer::create([[data copy] autorelease]), URL, MIMEType, textEncodingName, frameName, nil); >+ if (!resource) { >+ [self release]; >+ return nil; >+ } >+ >+ return self; >+} >+ >+- (NSURL *)URL >+{ >+ if (!resource) >+ return nil; >+ return resource->url(); >+} >+ >++ (id)resourceForData:(NSData *)data URL:(NSURL *)url MIMEType:(NSString *)mimeType textEncodingName:(NSString *)textEncodingName frameName:(NSString *)frameName >+{ >+ return [[[WebArchiveResourceAsWebResourceHandler alloc] initWithData:data URL:url MIMEType:mimeType textEncodingName:textEncodingName frameName:frameName] autorelease]; >+} >+ >+@end >Index: Source/WebCore/platform/URL.h >=================================================================== >--- Source/WebCore/platform/URL.h (revision 220974) >+++ Source/WebCore/platform/URL.h (working copy) >@@ -75,7 +75,7 @@ public: > WEBCORE_EXPORT URL(const URL& base, const String& relative); > URL(const URL& base, const String& relative, const TextEncoding&); > >- static URL fakeURLWithRelativePart(const String&); >+ WEBCORE_EXPORT static URL fakeURLWithRelativePart(const String&); > WEBCORE_EXPORT static URL fileURLWithFileSystemPath(const String&); > > String strippedForUseAsReferrer() const; >Index: Source/WebKitLegacy/mac/ChangeLog >=================================================================== >--- Source/WebKitLegacy/mac/ChangeLog (revision 221396) >+++ Source/WebKitLegacy/mac/ChangeLog (working copy) >@@ -1,3 +1,21 @@ >+2017-08-30 Alexey Proskuryakov <ap@apple.com> >+ >+ Layering violation in Editor::createFragment >+ https://bugs.webkit.org/show_bug.cgi?id=176123 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Misc/WebNSURLExtras.h: >+ * Misc/WebNSURLExtras.mm: >+ * WebView/WebFrame.mm: >+ * WebView/WebHTMLView.mm: >+ Removed multiple copies of webkit-fake-url creation code, switching to URL::fakeURLWithRelativePart(). >+ >+ * WebCoreSupport/WebEditorClient.mm: >+ (_WebCreateFragment): Added a stub implementation for older OSes. This is needed >+ because WebKitLegacy.exp is not passed through preprocessor, so there is no sane >+ way to avoid exporting the symbol just on newer OSes. >+ > 2017-08-30 Andy Estes <aestes@apple.com> > > [Mac] Upstream Accessibility-related WebKitSystemInterface functions >Index: Source/WebKitLegacy/mac/Misc/WebNSURLExtras.h >=================================================================== >--- Source/WebKitLegacy/mac/Misc/WebNSURLExtras.h (revision 220974) >+++ Source/WebKitLegacy/mac/Misc/WebNSURLExtras.h (working copy) >@@ -71,11 +71,6 @@ @interface NSURL (WebNSURLExtras) > > - (NSURL *)_webkit_URLFromURLOrSchemelessFileURL; > >-#if TARGET_OS_IPHONE >-// FIXME: This method name needs a prefix. >-+ (NSURL *)uniqueURLWithRelativePart:(NSString *)relativePart; >-#endif >- > @end > > @interface NSString (WebNSURLExtras) >Index: Source/WebKitLegacy/mac/Misc/WebNSURLExtras.mm >=================================================================== >--- Source/WebKitLegacy/mac/Misc/WebNSURLExtras.mm (revision 220974) >+++ Source/WebKitLegacy/mac/Misc/WebNSURLExtras.mm (working copy) >@@ -46,11 +46,6 @@ > using namespace WebCore; > using namespace WTF; > >-#if PLATFORM(IOS) >-// Fake URL scheme. >-#define WebDataProtocolScheme @"webkit-fake-url" >-#endif >- > #define URL_BYTES_BUFFER_LENGTH 2048 > > @implementation NSURL (WebNSURLExtras) >@@ -217,20 +212,6 @@ - (NSURL *)_webkit_URLFromURLOrSchemeles > > return [NSURL URLWithString:[@"file:" stringByAppendingString:[self absoluteString]]]; > } >- >-#if PLATFORM(IOS) >-+ (NSURL *)uniqueURLWithRelativePart:(NSString *)relativePart >-{ >- CFUUIDRef UUIDRef = CFUUIDCreate(kCFAllocatorDefault); >- NSString *UUIDString = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, UUIDRef); >- CFRelease(UUIDRef); >- NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@/%@", WebDataProtocolScheme, UUIDString, relativePart]]; >- CFRelease(UUIDString); >- >- return URL; >-} >- >-#endif // PLATFORM(IOS) > @end > > @implementation NSString (WebNSURLExtras) >Index: Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm >=================================================================== >--- Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm (revision 220974) >+++ Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm (working copy) >@@ -99,9 +99,11 @@ - (NSString *)languageForWordRange:(NSRa > @end > #endif > >+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300) > @interface NSAttributedString (WebNSAttributedStringDetails) > - (DOMDocumentFragment *)_documentFromRange:(NSRange)range document:(DOMDocument *)document documentAttributes:(NSDictionary *)attributes subresources:(NSArray **)subresources; > @end >+#endif > > static WebViewInsertAction kit(EditorInsertAction action) > { >@@ -433,8 +435,20 @@ NSURL *WebEditorClient::canonicalizeURLS > return URL; > } > >+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) >+ >+// FIXME: Remove this function once we don't use it on any supported platform. >+__attribute__((__noreturn__)) >+void _WebCreateFragment(Document&, NSAttributedString *, FragmentAndResources&) >+{ >+ RELEASE_ASSERT_NOT_REACHED(); >+} >+ >+#else >+ > static NSDictionary *attributesForAttributedStringConversion() > { >+ // This function needs to be kept in sync with identically named one in WebCore, which is used on newer OS versions. > NSArray *excludedElements = [[NSArray alloc] initWithObjects: > // Omit style since we want style to be inline so the fragment can be easily inserted. > @"style", >@@ -469,6 +483,8 @@ void _WebCreateFragment(Document& docume > result.resources.append([resource _coreResource]); > } > >+#endif >+ > void WebEditorClient::setInsertionPasteboard(const String& pasteboardName) > { > #if !PLATFORM(IOS) >Index: Source/WebKitLegacy/mac/WebView/WebFrame.mm >=================================================================== >--- Source/WebKitLegacy/mac/WebView/WebFrame.mm (revision 220974) >+++ Source/WebKitLegacy/mac/WebView/WebFrame.mm (working copy) >@@ -2292,7 +2292,7 @@ - (DOMDocumentFragment *)_documentFragme > - (DOMDocumentFragment *)_documentFragmentForImageData:(NSData *)data withRelativeURLPart:(NSString *)relativeURLPart andMIMEType:(NSString *)mimeType > { > WebResource *resource = [[WebResource alloc] initWithData:data >- URL:[NSURL uniqueURLWithRelativePart:relativeURLPart] >+ URL:URL::fakeURLWithRelativePart(relativeURLPart) > MIMEType:mimeType > textEncodingName:nil > frameName:nil]; >Index: Source/WebKitLegacy/mac/WebView/WebHTMLView.mm >=================================================================== >--- Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (revision 220974) >+++ Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (working copy) >@@ -1,4 +1,4 @@ >-/* >+ /* > * Copyright (C) 2005-2010, 2016 Apple Inc. All rights reserved. > * (C) 2006, 2007 Graham Dennis (graham.dennis@gmail.com) > * >@@ -781,9 +781,6 @@ const float _WebHTMLViewPrintingMaximumS > #define MIN_BOLD_WEIGHT 7 > #define STANDARD_BOLD_WEIGHT 9 > >-// Fake URL scheme. >-#define WebDataProtocolScheme @"webkit-fake-url" >- > #if !PLATFORM(IOS) > // <rdar://problem/4985524> References to WebCoreScrollView as a subview of a WebHTMLView may be present > // in some NIB files, so NSUnarchiver must be still able to look up this now-unused class. >@@ -1202,17 +1199,6 @@ + (NSArray *)_excludedElementsForAttribu > return elements; > } > >-static NSURL* uniqueURLWithRelativePart(NSString *relativePart) >-{ >- CFUUIDRef UUIDRef = CFUUIDCreate(kCFAllocatorDefault); >- NSString *UUIDString = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, UUIDRef); >- CFRelease(UUIDRef); >- NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@/%@", WebDataProtocolScheme, UUIDString, relativePart]]; >- CFRelease(UUIDString); >- >- return URL; >-} >- > - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard > inContext:(DOMRange *)context > allowPlainText:(BOOL)allowPlainText >@@ -2590,7 +2576,7 @@ - (DOMDocumentFragment *)_documentFragme > } > if (pboardType == NSTIFFPboardType) { > WebResource *resource = [[WebResource alloc] initWithData:[pasteboard dataForType:NSTIFFPboardType] >- URL:uniqueURLWithRelativePart(@"image.tiff") >+ URL:(NSURL *)URL::fakeURLWithRelativePart("image.tiff") > MIMEType:@"image/tiff" > textEncodingName:nil > frameName:nil]; >@@ -2600,7 +2586,7 @@ - (DOMDocumentFragment *)_documentFragme > } > if (pboardType == NSPDFPboardType) { > WebResource *resource = [[WebResource alloc] initWithData:[pasteboard dataForType:NSPDFPboardType] >- URL:uniqueURLWithRelativePart(@"application.pdf") >+ URL:(NSURL *)URL::fakeURLWithRelativePart("application.pdf") > MIMEType:@"application/pdf" > textEncodingName:nil > frameName:nil]; >@@ -2611,7 +2597,7 @@ - (DOMDocumentFragment *)_documentFragme > > if ([pboardType isEqualToString:(NSString*)kUTTypePNG]) { > WebResource *resource = [[WebResource alloc] initWithData:[pasteboard dataForType:(NSString*)kUTTypePNG] >- URL:uniqueURLWithRelativePart(@"image.png") >+ URL:(NSURL *)URL::fakeURLWithRelativePart("image.png") > MIMEType:@"image/png" > textEncodingName:nil > frameName:nil]; >@@ -7590,20 +7576,16 @@ - (BOOL)_findString:(NSString *)string o > > @end > >-// This is used by AppKit and is included here so that WebDataProtocolScheme is only defined once. >+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED < 110000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300) > @implementation NSURL (WebDataURL) > > + (NSURL *)_web_uniqueWebDataURL > { >- CFUUIDRef UUIDRef = CFUUIDCreate(kCFAllocatorDefault); >- NSString *UUIDString = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, UUIDRef); >- CFRelease(UUIDRef); >- NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@", WebDataProtocolScheme, UUIDString]]; >- CFRelease(UUIDString); >- return URL; >+ return URL::fakeURLWithRelativePart(emptyString()); > } > > @end >+#endif > > #if !PLATFORM(IOS) > @implementation WebResponderChainSink
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
darin
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 176123
:
319396
|
319421
|
319467
|
321245