WebKit Bugzilla
Attachment 362341 Details for
Bug 194670
: [iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for EWS
bug-194670-20190218145704.patch (text/plain), 64.13 KB, created by
Wenson Hsieh
on 2019-02-18 14:57:04 PST
(
hide
)
Description:
Patch for EWS
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2019-02-18 14:57:04 PST
Size:
64.13 KB
patch
obsolete
>Subversion Revision: 241736 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 287e18b38d27654db01e34ce11096a560b29667c..fde8327236c8ff4807d5721e7eb8718682dd221b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,88 @@ >+2019-02-18 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements >+ https://bugs.webkit.org/show_bug.cgi?id=194670 >+ <rdar://problem/39066529> >+ >+ Reviewed by Tim Horton. >+ >+ Adds support for pasting files on the pasteboard as attachment elements, if the attachment element runtime >+ switch is enabled. Currently, the only types of data that can be pasted as attachments are images, which take a >+ special codepath in WebContentReader::readImage. >+ >+ This patch adds a readDataBuffer method that converts a given blob of data from the pasteboard into an >+ attachment-element-backed representation in the DOM (i.e. either an attachment element or image element that >+ contains an attachment element). In the case where the given pasteboard item has been explicitly marked as an >+ attachment (via the preferredPresentationStyle hint) and the item has at least one type representation that >+ conforms to "public.content", we take this codepath instead of first attempting the web content reading types >+ supported by default in WebKit. >+ >+ See below for more detail. >+ >+ Test: WKAttachmentTestsIOS.InsertPastedFilesAsAttachments >+ >+ * editing/Editor.cpp: >+ (WebCore::Editor::clientReplacementURLForResource): Deleted. >+ * editing/Editor.h: >+ * editing/WebContentReader.h: >+ * editing/cocoa/WebContentReaderCocoa.mm: >+ (WebCore::mimeTypeFromContentType): >+ (WebCore::contentTypeIsSuitableForInlineImageRepresentation): >+ (WebCore::createFragmentAndAddResources): >+ (WebCore::sanitizeMarkupWithArchive): >+ >+ Remove all logic for handling subresource URL replacement. See WebKit ChangeLog for more details on this. >+ >+ (WebCore::WebContentReader::readImage): >+ (WebCore::attachmentForFilePath): >+ (WebCore::attachmentForData): >+ >+ Add a helper that creates an attachment element for a given blob of data and content type. The logic here is >+ quite similar to that of attachmentForFilePath, and we should find a way to either merge them, or pull out more >+ of their similarities into helper functions. >+ >+ (WebCore::WebContentReader::readDataBuffer): >+ (WebCore::replaceSubresourceURLsWithURLsFromClient): Deleted. >+ >+ Remove more logic for handling subresource URL replacement. See WebKit ChangeLog for more details on this. >+ >+ * loader/EmptyClients.cpp: >+ * page/EditorClient.h: >+ * platform/Pasteboard.h: >+ * platform/PasteboardItemInfo.h: >+ (WebCore::PasteboardItemInfo::contentTypeForHighestFidelityItem const): >+ (WebCore::PasteboardItemInfo::pathForHighestFidelityItem const): >+ (WebCore::PasteboardItemInfo::encode const): >+ (WebCore::PasteboardItemInfo::decode): >+ >+ Add contentTypesByFidelity to PasteboardItemInfo, instead of requesting this information using a separate IPC >+ message. This means we can also remove getTypesByFidelityForItemAtIndex, and just use the item's types in >+ fidelity order instead. >+ >+ * platform/PasteboardStrategy.h: >+ * platform/PlatformPasteboard.h: >+ * platform/ios/AbstractPasteboard.h: >+ * platform/ios/PasteboardIOS.mm: >+ (WebCore::Pasteboard::read): >+ >+ Shave off (potentially many) sync IPC messages to the UI process by pulling each call to >+ informationForItemAtIndex out of the inner loop when reading web content. >+ >+ (WebCore::Pasteboard::readRespectingUTIFidelities): >+ >+ Shave off one extraneous sync IPC message by rolling the types in fidelity order into the request for >+ PasteboardItemInfo, instead of being sent in a separate message. >+ >+ * platform/ios/PlatformPasteboardIOS.mm: >+ (WebCore::PlatformPasteboard::informationForItemAtIndex): >+ >+ Populate contentTypesForFileUpload in the case where UIPasteboard is used (i.e. copy and paste). >+ >+ (WebCore::PlatformPasteboard::getTypesByFidelityForItemAtIndex): Deleted. >+ * platform/ios/WebItemProviderPasteboard.h: >+ * platform/ios/WebItemProviderPasteboard.mm: >+ (-[WebItemProviderPasteboard pasteboardTypesByFidelityForItemAtIndex:]): Deleted. >+ > 2019-02-18 Daniel Bates <dabates@apple.com> > > [iOS] Keyups for non-modifier keys identified as "Dead" when not focused in a content-editable element >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 5f81363f879d40d386947157c61ea5e1f174d7c1..136a8a94819b1b739c52f2f19536b9e59d6b6b17 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,54 @@ >+2019-02-18 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements >+ https://bugs.webkit.org/show_bug.cgi?id=194670 >+ <rdar://problem/39066529> >+ >+ Reviewed by Tim Horton. >+ >+ Remove all IPC plumbing for getTypesByFidelityForItemAtIndex, now that the types in fidelity order have been >+ rolled into PasteboardItemInfo. >+ >+ Additionally, remove support for subresource URL replacement. This feature was originally added with the >+ intention that private clients (i.e. Mail) would intercept pasted or dropped images and replace their URLs. >+ However, since <rdar://problem/43216836>, our strategy for this scenario has changed, such that WebKit now >+ handles the drop/paste, and later delivers the image data to the client via NSFileWrappers in the UI process. >+ At this time, there are no adopters of this SPI, and no adopters of the V2 injected bundle editing client. As >+ such, we can simply revert all of this to its state prior to the introduction of the replacement URL SPI, with >+ the exception to changes in WKBundlePageEditorClient.h, wherein there is a nonzero (but likely tiny) chance of >+ completely breaking binary compatability with any third parties on macOS which may have tried to adopt >+ subresource URL replacement. >+ >+ * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: >+ (WebKit::WebPasteboardProxy::getPasteboardTypesByFidelityForItemAtIndex): Deleted. >+ * UIProcess/WebPasteboardProxy.h: >+ * UIProcess/WebPasteboardProxy.messages.in: >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView canPerformActionForWebView:withSender:]): >+ >+ Return YES for -paste: in the case where: >+ 1. The pasteboard contains items that are explicitly marked as attachments. >+ 2. The selection is richly contenteditable. >+ 3. Attachment elements are enabled. >+ >+ Among other things, this allows the callout bar on iOS to show the "Paste" action. >+ >+ * WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h: >+ (API::InjectedBundle::EditorClient::performTwoStepDrop): >+ (API::InjectedBundle::EditorClient::replacementURLForResource): Deleted. >+ * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h: >+ * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: >+ (-[WKWebProcessPlugInBrowserContextController _setEditingDelegate:]): >+ * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp: >+ (WebKit::InjectedBundlePageEditorClient::replacementURLForResource): Deleted. >+ * WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h: >+ * WebProcess/WebCoreSupport/WebEditorClient.cpp: >+ (WebKit::WebEditorClient::replacementURLForResource): Deleted. >+ * WebProcess/WebCoreSupport/WebEditorClient.h: >+ * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: >+ (WebKit::WebPlatformStrategies::getTypesByFidelityForItemAtIndex): Deleted. >+ * WebProcess/WebCoreSupport/WebPlatformStrategies.h: >+ > 2019-02-18 Claudio Saavedra <csaavedra@igalia.com> > > WebPageProxy::didFinishDocumentLoadForFrame() crashing in WPE and GTK+ ports >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index 5f40b799337253c9a4cb74d3f83ee9a617409a18..d4132c3cde8cf1d4f64166f90bbe909fcc7ab199 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,18 @@ >+2019-02-18 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements >+ https://bugs.webkit.org/show_bug.cgi?id=194670 >+ <rdar://problem/39066529> >+ >+ Reviewed by Tim Horton. >+ >+ * WebCoreSupport/WebEditorClient.h: >+ * WebCoreSupport/WebEditorClient.mm: >+ (WebEditorClient::replacementURLForResource): Deleted. >+ * WebCoreSupport/WebPlatformStrategies.h: >+ * WebCoreSupport/WebPlatformStrategies.mm: >+ (WebPlatformStrategies::getTypesByFidelityForItemAtIndex): Deleted. >+ > 2019-02-18 Eric Carlson <eric.carlson@apple.com> > > Add MSE logging configuration >diff --git a/Source/WebKitLegacy/win/ChangeLog b/Source/WebKitLegacy/win/ChangeLog >index c6688d18294ee59519c4fda9a644d9f39c6d61ae..3b78c276680c2a956e3b56c9c64fc573dbd938f7 100644 >--- a/Source/WebKitLegacy/win/ChangeLog >+++ b/Source/WebKitLegacy/win/ChangeLog >@@ -1,3 +1,15 @@ >+2019-02-18 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements >+ https://bugs.webkit.org/show_bug.cgi?id=194670 >+ <rdar://problem/39066529> >+ >+ Reviewed by Tim Horton. >+ >+ * WebCoreSupport/WebEditorClient.cpp: >+ (WebEditorClient::replacementURLForResource): Deleted. >+ * WebCoreSupport/WebEditorClient.h: >+ > 2019-02-10 Darin Adler <darin@apple.com> > > Replace more uses of String::format with StringConcatenate (mostly non-Apple platform-specific cases) >diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp >index 5abdbf88166e1c7f5140a6c112af2d3857470b83..937e74471595d4fa43059f48deb90621c229d7f8 100644 >--- a/Source/WebCore/editing/Editor.cpp >+++ b/Source/WebCore/editing/Editor.cpp >@@ -4258,14 +4258,6 @@ const Font* Editor::fontForSelection(bool& hasMultipleFonts) const > return font; > } > >-String Editor::clientReplacementURLForResource(Ref<SharedBuffer>&& resourceData, const String& mimeType) >-{ >- if (auto* editorClient = client()) >- return editorClient->replacementURLForResource(WTFMove(resourceData), mimeType); >- >- return { }; >-} >- > RefPtr<HTMLImageElement> Editor::insertEditableImage() > { > return InsertEditableImageCommand::insertEditableImage(document()); >diff --git a/Source/WebCore/editing/Editor.h b/Source/WebCore/editing/Editor.h >index 3b4a6d2c17fddbd04c725d88e7ed475c664c35f9..e08da320620168b007754ffc2b938df6f3656614 100644 >--- a/Source/WebCore/editing/Editor.h >+++ b/Source/WebCore/editing/Editor.h >@@ -500,8 +500,6 @@ public: > > bool canCopyExcludingStandaloneImages() const; > >- String clientReplacementURLForResource(Ref<SharedBuffer>&& resourceData, const String& mimeType); >- > #if !PLATFORM(WIN) > WEBCORE_EXPORT void writeSelectionToPasteboard(Pasteboard&); > WEBCORE_EXPORT void writeImageToPasteboard(Pasteboard&, Element& imageElement, const URL&, const String& title); >diff --git a/Source/WebCore/editing/WebContentReader.h b/Source/WebCore/editing/WebContentReader.h >index c774b4a205943d8d4def7626399e43d55c3531e7..7e78db10ee2bba6f0434a85c1c34293b028222f4 100644 >--- a/Source/WebCore/editing/WebContentReader.h >+++ b/Source/WebCore/editing/WebContentReader.h >@@ -78,6 +78,7 @@ private: > bool readImage(Ref<SharedBuffer>&&, const String& type) override; > bool readURL(const URL&, const String& title) override; > bool readVirtualContactFile(const String& filePath, const URL&, const String& urlTitle) override; >+ bool readDataBuffer(SharedBuffer&, const String& type, const String& name) override; > #endif > bool readPlainText(const String&) override; > }; >@@ -101,6 +102,7 @@ private: > bool readRTF(SharedBuffer&) override; > bool readImage(Ref<SharedBuffer>&&, const String&) override { return false; } > bool readURL(const URL&, const String&) override { return false; } >+ bool readDataBuffer(SharedBuffer&, const String&, const String&) override { return false; } > #endif > bool readPlainText(const String&) override { return false; } > }; >diff --git a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm b/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >index 254a368fa774ad6372d46f153c5a95c4ee2428c5..9e8e2656d51de69eaa0e06543788a1fdacf78555 100644 >--- a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >+++ b/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm >@@ -220,9 +220,14 @@ static bool shouldReplaceRichContentWithAttachments() > > #if ENABLE(ATTACHMENT_ELEMENT) > >+static String mimeTypeFromContentType(const String& contentType) >+{ >+ return isDeclaredUTI(contentType) ? MIMETypeFromUTI(contentType) : contentType; >+} >+ > static bool contentTypeIsSuitableForInlineImageRepresentation(const String& contentType) > { >- return MIMETypeRegistry::isSupportedImageMIMEType(isDeclaredUTI(contentType) ? MIMETypeFromUTI(contentType) : contentType); >+ return MIMETypeRegistry::isSupportedImageMIMEType(mimeTypeFromContentType(contentType)); > } > > static bool supportsClientSideAttachmentData(const Frame& frame) >@@ -370,31 +375,6 @@ static void replaceRichContentWithAttachments(Frame& frame, DocumentFragment& fr > #endif > } > >-static void replaceSubresourceURLsWithURLsFromClient(DocumentFragment& fragment, const Vector<Ref<ArchiveResource>>& subresources, Vector<Ref<ArchiveResource>>& outUnreplacedResources) >-{ >- ASSERT(fragment.document().frame()); >- auto& frame = *fragment.document().frame(); >- HashMap<AtomicString, AtomicString> subresourceURLToClientURLMap; >- for (auto& subresource : subresources) { >- auto& originalURL = subresource->url(); >- if (!shouldReplaceSubresourceURL(originalURL)) { >- outUnreplacedResources.append(subresource.copyRef()); >- continue; >- } >- >- auto replacementURL = frame.editor().clientReplacementURLForResource(subresource->data(), subresource->mimeType()); >- if (replacementURL.isEmpty()) { >- outUnreplacedResources.append(subresource.copyRef()); >- continue; >- } >- >- subresourceURLToClientURLMap.set(originalURL.string(), replacementURL); >- } >- >- if (!subresourceURLToClientURLMap.isEmpty()) >- replaceSubresourceURLs(fragment, WTFMove(subresourceURLToClientURLMap)); >-} >- > RefPtr<DocumentFragment> createFragmentAndAddResources(Frame& frame, NSAttributedString *string) > { > if (!frame.page() || !frame.document()) >@@ -417,16 +397,13 @@ RefPtr<DocumentFragment> createFragmentAndAddResources(Frame& frame, NSAttribute > return WTFMove(fragmentAndResources.fragment); > } > >- Vector<Ref<ArchiveResource>> unreplacedResources; >- replaceSubresourceURLsWithURLsFromClient(*fragmentAndResources.fragment, fragmentAndResources.resources, unreplacedResources); >- > if (shouldReplaceRichContentWithAttachments()) { >- replaceRichContentWithAttachments(frame, *fragmentAndResources.fragment, unreplacedResources); >+ replaceRichContentWithAttachments(frame, *fragmentAndResources.fragment, fragmentAndResources.resources); > return WTFMove(fragmentAndResources.fragment); > } > > HashMap<AtomicString, AtomicString> blobURLMap; >- for (const Ref<ArchiveResource>& subresource : unreplacedResources) { >+ for (const Ref<ArchiveResource>& subresource : fragmentAndResources.resources) { > auto blob = Blob::create(subresource->data(), subresource->mimeType()); > String blobURL = DOMURL::createObjectURL(document, blob); > blobURLMap.set(subresource->url().string(), blobURL); >@@ -466,16 +443,13 @@ static String sanitizeMarkupWithArchive(Frame& frame, Document& destinationDocum > ASSERT(stagingDocument); > auto fragment = createFragmentFromMarkup(*stagingDocument, markupAndArchive.markup, markupAndArchive.mainResource->url(), DisallowScriptingAndPluginContent); > >- Vector<Ref<ArchiveResource>> unreplacedResources; >- replaceSubresourceURLsWithURLsFromClient(fragment, markupAndArchive.archive->subresources(), unreplacedResources); >- > if (shouldReplaceRichContentWithAttachments()) { >- replaceRichContentWithAttachments(frame, fragment, unreplacedResources); >+ replaceRichContentWithAttachments(frame, fragment, markupAndArchive.archive->subresources()); > return sanitizedMarkupForFragmentInDocument(WTFMove(fragment), *stagingDocument, msoListQuirks, markupAndArchive.markup); > } > > HashMap<AtomicString, AtomicString> blobURLMap; >- for (const Ref<ArchiveResource>& subresource : unreplacedResources) { >+ for (const Ref<ArchiveResource>& subresource : markupAndArchive.archive->subresources()) { > auto& subresourceURL = subresource->url(); > if (!shouldReplaceSubresourceURL(subresourceURL)) > continue; >@@ -700,13 +674,6 @@ bool WebContentReader::readImage(Ref<SharedBuffer>&& buffer, const String& type) > { > ASSERT(frame.document()); > auto& document = *frame.document(); >- >- auto replacementURL = frame.editor().clientReplacementURLForResource(buffer.copyRef(), isDeclaredUTI(type) ? MIMETypeFromUTI(type) : type); >- if (!replacementURL.isEmpty()) { >- addFragment(createFragmentForImageAndURL(document, replacementURL)); >- return true; >- } >- > if (shouldReplaceRichContentWithAttachments()) > addFragment(createFragmentForImageAttachment(frame, document, WTFMove(buffer), type)); > else >@@ -723,7 +690,7 @@ static Ref<HTMLElement> attachmentForFilePath(Frame& frame, const String& path) > auto attachment = HTMLAttachmentElement::create(HTMLNames::attachmentTag, document); > if (!supportsClientSideAttachmentData(frame)) { > attachment->setFile(File::create(path), HTMLAttachmentElement::UpdateDisplayAttributes::Yes); >- return attachment.get(); >+ return attachment; > } > > String contentType; >@@ -745,11 +712,45 @@ static Ref<HTMLElement> attachmentForFilePath(Frame& frame, const String& path) > auto image = HTMLImageElement::create(document); > image->setAttributeWithoutSynchronization(HTMLNames::srcAttr, DOMURL::createObjectURL(document, File::create(path))); > image->setAttachmentElement(WTFMove(attachment)); >- return image.get(); >+ return image; > } > > attachment->updateAttributes(WTFMove(fileSizeForDisplay), contentType, FileSystem::pathGetFileName(path)); >- return attachment.get(); >+ return attachment; >+} >+ >+static Ref<HTMLElement> attachmentForData(Frame& frame, SharedBuffer& buffer, const String& contentType, const String& name) >+{ >+ auto document = makeRef(*frame.document()); >+ auto attachment = HTMLAttachmentElement::create(HTMLNames::attachmentTag, document); >+ auto mimeType = mimeTypeFromContentType(contentType); >+ auto typeForAttachmentElement = mimeType.isEmpty() ? contentType : mimeType; >+ >+ // FIXME: We should instead ask CoreServices for a preferred name corresponding to the given content type. >+ static const char* defaultAttachmentName = "file"; >+ >+ String fileName; >+ if (name.isEmpty()) >+ fileName = defaultAttachmentName; >+ else >+ fileName = name; >+ >+ if (!supportsClientSideAttachmentData(frame)) { >+ attachment->setFile(File::create(Blob::create(buffer, WTFMove(typeForAttachmentElement)), fileName)); >+ return attachment; >+ } >+ >+ frame.editor().registerAttachmentIdentifier(attachment->ensureUniqueIdentifier(), typeForAttachmentElement, fileName, buffer); >+ >+ if (contentTypeIsSuitableForInlineImageRepresentation(typeForAttachmentElement)) { >+ auto image = HTMLImageElement::create(document); >+ image->setAttributeWithoutSynchronization(HTMLNames::srcAttr, DOMURL::createObjectURL(document, File::create(Blob::create(buffer, WTFMove(typeForAttachmentElement)), WTFMove(fileName)))); >+ image->setAttachmentElement(WTFMove(attachment)); >+ return image; >+ } >+ >+ attachment->updateAttributes({ buffer.size() }, WTFMove(typeForAttachmentElement), WTFMove(fileName)); >+ return attachment; > } > > #endif // ENABLE(ATTACHMENT_ELEMENT) >@@ -826,4 +827,28 @@ bool WebContentReader::readURL(const URL& url, const String& title) > return true; > } > >+bool WebContentReader::readDataBuffer(SharedBuffer& buffer, const String& type, const String& name) >+{ >+ if (buffer.isEmpty()) >+ return false; >+ >+ if (!shouldReplaceRichContentWithAttachments()) >+ return false; >+ >+ auto document = makeRefPtr(frame.document()); >+ if (!document) >+ return false; >+ >+ if (!fragment) >+ fragment = document->createDocumentFragment(); >+ >+#if ENABLE(ATTACHMENT_ELEMENT) >+ fragment->appendChild(attachmentForData(frame, buffer, type, name)); >+#else >+ UNUSED_PARAM(type); >+ UNUSED_PARAM(name); >+#endif >+ return true; >+} >+ > } >diff --git a/Source/WebCore/loader/EmptyClients.cpp b/Source/WebCore/loader/EmptyClients.cpp >index 6c2dbdf67211a0b8b15283bf0b74cb863b0a6d2c..a43a1bb36bf8be8f42351fdfa7098f5cacfbf49a 100644 >--- a/Source/WebCore/loader/EmptyClients.cpp >+++ b/Source/WebCore/loader/EmptyClients.cpp >@@ -182,7 +182,6 @@ private: > void willWriteSelectionToPasteboard(Range*) final { } > void didWriteSelectionToPasteboard() final { } > void getClientPasteboardDataForRange(Range*, Vector<String>&, Vector<RefPtr<SharedBuffer>>&) final { } >- String replacementURLForResource(Ref<SharedBuffer>&&, const String&) final { return { }; } > void requestCandidatesForSelection(const VisibleSelection&) final { } > void handleAcceptedCandidateWithSoftSpaces(TextCheckingResult) final { } > >diff --git a/Source/WebCore/page/EditorClient.h b/Source/WebCore/page/EditorClient.h >index 6e0d0bee67a4d4590423b17e92e201847ab84a5c..bc6584b5933bc56bf0c0c7a34eb058aacef88037 100644 >--- a/Source/WebCore/page/EditorClient.h >+++ b/Source/WebCore/page/EditorClient.h >@@ -94,7 +94,6 @@ public: > virtual void willWriteSelectionToPasteboard(Range*) = 0; > virtual void didWriteSelectionToPasteboard() = 0; > virtual void getClientPasteboardDataForRange(Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<SharedBuffer>>& pasteboardData) = 0; >- virtual String replacementURLForResource(Ref<SharedBuffer>&& resourceData, const String& mimeType) = 0; > virtual void requestCandidatesForSelection(const VisibleSelection&) { } > virtual void handleAcceptedCandidateWithSoftSpaces(TextCheckingResult) { } > >diff --git a/Source/WebCore/platform/Pasteboard.h b/Source/WebCore/platform/Pasteboard.h >index 7d2715cd3303a1739d4d3bfb157154b36cb8fbe5..35a831d1c0a309c37615c1b507f637af3814ea50 100644 >--- a/Source/WebCore/platform/Pasteboard.h >+++ b/Source/WebCore/platform/Pasteboard.h >@@ -143,6 +143,7 @@ public: > virtual bool readRTF(SharedBuffer&) = 0; > virtual bool readImage(Ref<SharedBuffer>&&, const String& type) = 0; > virtual bool readURL(const URL&, const String& title) = 0; >+ virtual bool readDataBuffer(SharedBuffer&, const String& type, const String& name) = 0; > #endif > virtual bool readPlainText(const String&) = 0; > }; >diff --git a/Source/WebCore/platform/PasteboardItemInfo.h b/Source/WebCore/platform/PasteboardItemInfo.h >index 22a098a4418ac37c467e571c216bd73a7d988b32..92d8b0bfd67a82df846e589d43df1cdb1c1f42aa 100644 >--- a/Source/WebCore/platform/PasteboardItemInfo.h >+++ b/Source/WebCore/platform/PasteboardItemInfo.h >@@ -40,6 +40,7 @@ enum class PasteboardItemPresentationStyle { > struct PasteboardItemInfo { > Vector<String> pathsForFileUpload; > Vector<String> contentTypesForFileUpload; >+ Vector<String> contentTypesByFidelity; > String suggestedFileName; > bool isNonTextType { false }; > bool containsFileURLAndFileUploadContent { false }; >@@ -55,12 +56,19 @@ struct PasteboardItemInfo { > return pathsForFileUpload[index]; > } > >+ String contentTypeForHighestFidelityItem() const >+ { >+ if (contentTypesForFileUpload.isEmpty()) >+ return { }; >+ >+ return contentTypesForFileUpload.first(); >+ } >+ > String pathForHighestFidelityItem() const > { > if (pathsForFileUpload.isEmpty()) > return { }; > >- ASSERT(!pathsForFileUpload.first().isEmpty()); > return pathsForFileUpload.first(); > } > >@@ -71,7 +79,7 @@ struct PasteboardItemInfo { > template<class Encoder> > void PasteboardItemInfo::encode(Encoder& encoder) const > { >- encoder << pathsForFileUpload << contentTypesForFileUpload << suggestedFileName << isNonTextType << containsFileURLAndFileUploadContent; >+ encoder << pathsForFileUpload << contentTypesForFileUpload << contentTypesByFidelity << suggestedFileName << isNonTextType << containsFileURLAndFileUploadContent; > encoder.encodeEnum(preferredPresentationStyle); > } > >@@ -85,6 +93,9 @@ Optional<PasteboardItemInfo> PasteboardItemInfo::decode(Decoder& decoder) > if (!decoder.decode(result.contentTypesForFileUpload)) > return WTF::nullopt; > >+ if (!decoder.decode(result.contentTypesByFidelity)) >+ return WTF::nullopt; >+ > if (!decoder.decode(result.suggestedFileName)) > return WTF::nullopt; > >diff --git a/Source/WebCore/platform/PasteboardStrategy.h b/Source/WebCore/platform/PasteboardStrategy.h >index 1e9b880fd1a5e1852530ab935cce0d875c63d957..dc16f0fa0c5a9012c6525f5a9530fe7658151365 100644 >--- a/Source/WebCore/platform/PasteboardStrategy.h >+++ b/Source/WebCore/platform/PasteboardStrategy.h >@@ -53,7 +53,6 @@ public: > virtual Vector<PasteboardItemInfo> allPasteboardItemInfo(const String& pasteboardName) = 0; > virtual PasteboardItemInfo informationForItemAtIndex(int index, const String& pasteboardName) = 0; > virtual void updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName) = 0; >- virtual void getTypesByFidelityForItemAtIndex(Vector<String>& types, uint64_t index, const String& pasteboardName) = 0; > #endif // PLATFORM(IOS_FAMILY) > #if PLATFORM(COCOA) > virtual void getTypes(Vector<String>& types, const String& pasteboardName) = 0; >diff --git a/Source/WebCore/platform/PlatformPasteboard.h b/Source/WebCore/platform/PlatformPasteboard.h >index c35f08ecd6458778395d835a3426abd3fcf5f8ba..e03315098e155a926f7198e2c726b3757c12442f 100644 >--- a/Source/WebCore/platform/PlatformPasteboard.h >+++ b/Source/WebCore/platform/PlatformPasteboard.h >@@ -61,7 +61,6 @@ public: > WEBCORE_EXPORT PlatformPasteboard(); > WEBCORE_EXPORT Vector<PasteboardItemInfo> allPasteboardItemInfo(); > WEBCORE_EXPORT PasteboardItemInfo informationForItemAtIndex(int index); >- WEBCORE_EXPORT void getTypesByFidelityForItemAtIndex(Vector<String>& types, int index); > WEBCORE_EXPORT void updateSupportedTypeIdentifiers(const Vector<String>& types); > #endif > WEBCORE_EXPORT static String uniqueName(); >diff --git a/Source/WebCore/platform/ios/AbstractPasteboard.h b/Source/WebCore/platform/ios/AbstractPasteboard.h >index 8f2dd0a6e399aa31bc6ebb75bbae1133401ce54e..ea564428514821ef6b9ddb44d34faa970fa075d3 100644 >--- a/Source/WebCore/platform/ios/AbstractPasteboard.h >+++ b/Source/WebCore/platform/ios/AbstractPasteboard.h >@@ -54,7 +54,6 @@ NS_ASSUME_NONNULL_BEGIN > - (nullable WebItemProviderRegistrationInfoList *)takeRegistrationList; > #endif > - (void)setItems:(NSArray<NSDictionary *> *)items; >-- (NSArray<NSString *> *)pasteboardTypesByFidelityForItemAtIndex:(NSUInteger)index; > @property (readonly, nonatomic) NSInteger numberOfFiles; > @property (readonly, nonatomic) NSArray<NSURL *> *allDroppedFileURLs; > >diff --git a/Source/WebCore/platform/ios/PasteboardIOS.mm b/Source/WebCore/platform/ios/PasteboardIOS.mm >index 2071531cdc77ab4f00d1768e5e6d50d91bc65cc8..5ef3ce8a9aa8f9c09305dd9d262bcb84d8a760a8 100644 >--- a/Source/WebCore/platform/ios/PasteboardIOS.mm >+++ b/Source/WebCore/platform/ios/PasteboardIOS.mm >@@ -285,13 +285,31 @@ void Pasteboard::read(PasteboardWebContentReader& reader, WebContentReadingPolic > NSArray *types = supportedWebContentPasteboardTypes(); > int numberOfTypes = [types count]; > >+#if ENABLE(ATTACHMENT_ELEMENT) >+ bool canReadAttachment = policy == WebContentReadingPolicy::AnyType && RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled(); >+#else >+ bool canReadAttachment = false; >+#endif >+ > for (int i = 0; i < numberOfItems; i++) { >+ auto info = strategy.informationForItemAtIndex(i, m_pasteboardName); >+#if ENABLE(ATTACHMENT_ELEMENT) >+ if (canReadAttachment) { >+ auto typeForFileUpload = info.contentTypeForHighestFidelityItem(); >+ if (!typeForFileUpload.isEmpty() && info.preferredPresentationStyle == PasteboardItemPresentationStyle::Attachment) { >+ auto buffer = strategy.readBufferFromPasteboard(i, typeForFileUpload, m_pasteboardName); >+ if (buffer && reader.readDataBuffer(*buffer, typeForFileUpload, info.suggestedFileName)) >+ continue; >+ } >+ } >+#endif >+ > for (int typeIndex = 0; typeIndex < numberOfTypes; typeIndex++) { > NSString *type = [types objectAtIndex:typeIndex]; > if (!isTypeAllowedByReadingPolicy(type, policy)) > continue; > >- auto itemResult = readPasteboardWebContentDataForType(reader, strategy, type, i, strategy.informationForItemAtIndex(i, m_pasteboardName)); >+ auto itemResult = readPasteboardWebContentDataForType(reader, strategy, type, i, info); > if (itemResult == ReaderResult::PasteboardWasChangedExternally) > return; > >@@ -325,10 +343,8 @@ void Pasteboard::readRespectingUTIFidelities(PasteboardWebContentReader& reader, > #endif > // Try to read data from each type identifier that this pasteboard item supports, and WebKit also recognizes. Type identifiers are > // read in order of fidelity, as specified by each pasteboard item. >- Vector<String> typesForItemInOrderOfFidelity; >- strategy.getTypesByFidelityForItemAtIndex(typesForItemInOrderOfFidelity, index, m_pasteboardName); > ReaderResult result = ReaderResult::DidNotReadType; >- for (auto& type : typesForItemInOrderOfFidelity) { >+ for (auto& type : info.contentTypesByFidelity) { > if (!isTypeAllowedByReadingPolicy(type, policy)) > continue; > >diff --git a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm b/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm >index 200dbc3d094a9181452ecf090c16c1b12d0cb891..aea98a78f9a7c4ad2531e0a42a5f77938e6d1b5d 100644 >--- a/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm >+++ b/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm >@@ -78,16 +78,6 @@ void PlatformPasteboard::getTypes(Vector<String>& types) > types.append(pasteboardType); > } > >-void PlatformPasteboard::getTypesByFidelityForItemAtIndex(Vector<String>& types, int index) >-{ >- if (index >= [m_pasteboard numberOfItems] || ![m_pasteboard respondsToSelector:@selector(pasteboardTypesByFidelityForItemAtIndex:)]) >- return; >- >- NSArray *pasteboardTypesByFidelity = [m_pasteboard pasteboardTypesByFidelityForItemAtIndex:index]; >- for (NSString *typeIdentifier in pasteboardTypesByFidelity) >- types.append(typeIdentifier); >-} >- > RefPtr<SharedBuffer> PlatformPasteboard::bufferForType(const String& type) > { > if (NSData *data = [m_pasteboard dataForPasteboardType:type]) >@@ -139,6 +129,7 @@ PasteboardItemInfo PlatformPasteboard::informationForItemAtIndex(int index) > return { }; > > PasteboardItemInfo info; >+ NSItemProvider *itemProvider = [[m_pasteboard itemProviders] objectAtIndex:index]; > if ([m_pasteboard respondsToSelector:@selector(fileUploadURLsAtIndex:fileTypes:)]) { > NSArray<NSString *> *fileTypes = nil; > NSArray *urls = [m_pasteboard fileUploadURLsAtIndex:index fileTypes:&fileTypes]; >@@ -149,17 +140,27 @@ PasteboardItemInfo PlatformPasteboard::informationForItemAtIndex(int index) > info.pathsForFileUpload.uncheckedAppend(url.path); > > info.contentTypesForFileUpload.reserveInitialCapacity(fileTypes.count); >- for (NSString *fileType : fileTypes) >+ for (NSString *fileType in fileTypes) >+ info.contentTypesForFileUpload.uncheckedAppend(fileType); >+ } else { >+ NSArray *fileTypes = itemProvider.web_fileUploadContentTypes; >+ info.contentTypesForFileUpload.reserveInitialCapacity(fileTypes.count); >+ info.pathsForFileUpload.reserveInitialCapacity(fileTypes.count); >+ for (NSString *fileType in fileTypes) { > info.contentTypesForFileUpload.uncheckedAppend(fileType); >+ info.pathsForFileUpload.uncheckedAppend({ }); >+ } > } > >- NSItemProvider *itemProvider = [[m_pasteboard itemProviders] objectAtIndex:index]; > #if PASTEBOARD_SUPPORTS_PRESENTATION_STYLE_AND_TEAM_DATA > info.preferredPresentationStyle = pasteboardItemPresentationStyle(itemProvider.preferredPresentationStyle); > #endif > info.containsFileURLAndFileUploadContent = itemProvider.web_containsFileURLAndFileUploadContent; > info.suggestedFileName = itemProvider.suggestedName; >- for (NSString *typeIdentifier in itemProvider.registeredTypeIdentifiers) { >+ NSArray<NSString *> *registeredTypeIdentifiers = itemProvider.registeredTypeIdentifiers; >+ info.contentTypesByFidelity.reserveInitialCapacity(registeredTypeIdentifiers.count); >+ for (NSString *typeIdentifier in registeredTypeIdentifiers) { >+ info.contentTypesByFidelity.uncheckedAppend(typeIdentifier); > CFStringRef cfTypeIdentifier = (CFStringRef)typeIdentifier; > if (!UTTypeIsDeclared(cfTypeIdentifier)) > continue; >@@ -177,7 +178,6 @@ PasteboardItemInfo PlatformPasteboard::informationForItemAtIndex(int index) > continue; > > info.isNonTextType = true; >- break; > } > > return info; >diff --git a/Source/WebCore/platform/ios/WebItemProviderPasteboard.h b/Source/WebCore/platform/ios/WebItemProviderPasteboard.h >index 29f9a71d70f6ac487c640941beb6d41af19e1811..e45d24e75f7029558e1a38c913f3c463c055fc7f 100644 >--- a/Source/WebCore/platform/ios/WebItemProviderPasteboard.h >+++ b/Source/WebCore/platform/ios/WebItemProviderPasteboard.h >@@ -39,6 +39,7 @@ NS_ASSUME_NONNULL_BEGIN > > @interface NSItemProvider (WebCoreExtras) > @property (nonatomic, readonly) BOOL web_containsFileURLAndFileUploadContent; >+@property (nonatomic, readonly) NSArray<NSString *> *web_fileUploadContentTypes; > @end > > /*! A WebItemProviderRegistrar encapsulates a single call to register something to an item provider. >diff --git a/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm b/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm >index 816a30f15fa56445a6c133777b6636eb46b20384..db9e955202601d38d8883b84d7d7e27b52558c3c 100644 >--- a/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm >+++ b/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm >@@ -487,11 +487,6 @@ - (void)updateSupportedTypeIdentifiers:(NSArray<NSString *> *)types > _supportedTypeIdentifiers = types; > } > >-- (NSArray<NSString *> *)pasteboardTypesByFidelityForItemAtIndex:(NSUInteger)index >-{ >- return [self itemProviderAtIndex:index].registeredTypeIdentifiers ?: @[ ]; >-} >- > - (NSArray<NSString *> *)pasteboardTypes > { > NSMutableSet<NSString *> *allTypes = [NSMutableSet set]; >diff --git a/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm b/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm >index 1dad704ec996b1ef9d4c1a99b170bf7623d3689a..ba4d78e40fd505be7c679e7a84d21a1966b51e05 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm >@@ -179,10 +179,6 @@ void WebPasteboardProxy::writeCustomData(const WebCore::PasteboardCustomData& da > } > > #if PLATFORM(IOS_FAMILY) >-void WebPasteboardProxy::getPasteboardTypesByFidelityForItemAtIndex(uint64_t index, const String& pasteboardName, Vector<String>& types) >-{ >- PlatformPasteboard(pasteboardName).getTypesByFidelityForItemAtIndex(types, index); >-} > > void WebPasteboardProxy::writeURLToPasteboard(const PasteboardURL& url, const String& pasteboardName) > { >diff --git a/Source/WebKit/UIProcess/WebPasteboardProxy.h b/Source/WebKit/UIProcess/WebPasteboardProxy.h >index 349f1ae2aa81ba7021ff3f78903200c761f79f0f..2564d1358d51354de2e3f67668b229f90eabb531 100644 >--- a/Source/WebKit/UIProcess/WebPasteboardProxy.h >+++ b/Source/WebKit/UIProcess/WebPasteboardProxy.h >@@ -69,7 +69,6 @@ private: > void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override; > > #if PLATFORM(IOS_FAMILY) >- void getPasteboardTypesByFidelityForItemAtIndex(uint64_t index, const String& pasteboardName, Vector<String>& types); > void writeURLToPasteboard(const WebCore::PasteboardURL&, const String& pasteboardName); > void writeWebContentToPasteboard(const WebCore::PasteboardWebContent&, const String& pasteboardName); > void writeImageToPasteboard(const WebCore::PasteboardImage&, const String& pasteboardName); >diff --git a/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in b/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in >index f5d0d6bdd2e453305f31dbe3db7c25d5fee674e3..164f29ffc8abb110299de59fe059d11310dafa66 100644 >--- a/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in >+++ b/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in >@@ -33,7 +33,6 @@ messages -> WebPasteboardProxy { > AllPasteboardItemInfo(String pasteboardName) -> (Vector<WebCore::PasteboardItemInfo> allInfo) LegacySync > InformationForItemAtIndex(uint64_t index, String pasteboardName) -> (struct WebCore::PasteboardItemInfo info) LegacySync > UpdateSupportedTypeIdentifiers(Vector<String> identifiers, String pasteboardName) >- GetPasteboardTypesByFidelityForItemAtIndex(uint64_t index, String pasteboardName) -> (Vector<String> types) LegacySync > #endif > > WriteCustomData(struct WebCore::PasteboardCustomData data, String pasteboardName) -> (uint64_t changeCount) LegacySync >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index d7c14cefe03bce87da08ad8a6b62b72ad22504aa..7bd80fdd826ca364294ace7254d4f07c9ffd4df8 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -2732,6 +2732,15 @@ - (BOOL)canPerformActionForWebView:(SEL)action withSender:(id)sender > if ([pasteboard containsPasteboardTypes:types inItemSet:indices]) > return YES; > >+#if PLATFORM(IOS) >+ if (editorState.isContentRichlyEditable && _webView.configuration._attachmentElementEnabled) { >+ for (NSItemProvider *itemProvider in pasteboard.itemProviders) { >+ if (itemProvider.preferredPresentationStyle == UIPreferredPresentationStyleAttachment && itemProvider.web_fileUploadContentTypes.count) >+ return YES; >+ } >+ } >+#endif // PLATFORM(IOS) >+ > auto focusedDocumentOrigin = editorState.originIdentifierForPasteboard; > if (focusedDocumentOrigin.isEmpty()) > return NO; >diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h b/Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h >index ea3dd1b518e5c85daa21fd14023692496d041f2a..696cffcbdf80e512e1d3fdda7f108f31db30e6b1 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h >+++ b/Source/WebKit/WebProcess/InjectedBundle/API/APIInjectedBundleEditorClient.h >@@ -66,7 +66,6 @@ public: > virtual void getPasteboardDataForRange(WebKit::WebPage&, WebCore::Range*, Vector<WTF::String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData) { } > virtual void didWriteToPasteboard(WebKit::WebPage&) { } > virtual bool performTwoStepDrop(WebKit::WebPage&, WebCore::DocumentFragment&, WebCore::Range&, bool) { return false; } >- virtual WTF::String replacementURLForResource(WebKit::WebPage&, Ref<WebCore::SharedBuffer>&&, const WTF::String&) { return { }; } > }; > > } // namespace InjectedBundle >diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h b/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h >index e9acb2d10dc0e1ce7f9753dc0ee3f7e61a944be1..c8209a18166eb8fccb842b39535648d169da6011 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h >+++ b/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInEditingDelegate.h >@@ -61,7 +61,6 @@ WK_API_AVAILABLE(macosx(10.12.3), ios(10.3)) > - (NSDictionary<NSString *, NSData *> *)_webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller pasteboardDataForRange:(WKWebProcessPlugInRangeHandle *)range; > - (void)_webProcessPlugInBrowserContextControllerDidWriteToPasteboard:(WKWebProcessPlugInBrowserContextController *)controller; > - (BOOL)_webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller performTwoStepDrop:(WKWebProcessPlugInNodeHandle *)fragment atDestination:(WKWebProcessPlugInRangeHandle *)destination isMove:(BOOL)isMove WK_API_AVAILABLE(macosx(10.13), ios(11.0)); >-- (NSString *)_webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller replacementURLForResource:(NSData *)resourceData mimeType:(NSString *)mimeType WK_API_AVAILABLE(macosx(10.14), ios(12.0)); > > @end > >diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm b/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm >index 8cdf09506aabb1b8453ef89b35d95a5745ac9b26..6bea51aeccd18636d128ba82559e36d52594dc7f 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm >+++ b/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm >@@ -663,16 +663,6 @@ - (void)_setEditingDelegate:(id <WKWebProcessPlugInEditingDelegate>)editingDeleg > return [m_controller->_editingDelegate.get() _webProcessPlugInBrowserContextController:m_controller performTwoStepDrop:wrapper(*nodeHandle) atDestination:wrapper(*rangeHandle) isMove:isMove]; > } > >- WTF::String replacementURLForResource(WebKit::WebPage&, Ref<WebCore::SharedBuffer>&& resourceData, const WTF::String& mimeType) >- { >- if (!m_delegateMethods.replacementURLForResource) >- return { }; >- >- NSString *type = (NSString *)mimeType; >- auto data = resourceData->createNSData(); >- return [m_controller->_editingDelegate.get() _webProcessPlugInBrowserContextController:m_controller replacementURLForResource:data.get() mimeType:type]; >- } >- > WKWebProcessPlugInBrowserContextController *m_controller; > const struct DelegateMethods { > DelegateMethods(RetainPtr<id <WKWebProcessPlugInEditingDelegate>> delegate) >@@ -683,7 +673,6 @@ - (void)_setEditingDelegate:(id <WKWebProcessPlugInEditingDelegate>)editingDeleg > , getPasteboardDataForRange([delegate respondsToSelector:@selector(_webProcessPlugInBrowserContextController:pasteboardDataForRange:)]) > , didWriteToPasteboard([delegate respondsToSelector:@selector(_webProcessPlugInBrowserContextControllerDidWriteToPasteboard:)]) > , performTwoStepDrop([delegate respondsToSelector:@selector(_webProcessPlugInBrowserContextController:performTwoStepDrop:atDestination:isMove:)]) >- , replacementURLForResource([delegate respondsToSelector:@selector(_webProcessPlugInBrowserContextController:replacementURLForResource:mimeType:)]) > { > } > >@@ -694,7 +683,6 @@ - (void)_setEditingDelegate:(id <WKWebProcessPlugInEditingDelegate>)editingDeleg > bool getPasteboardDataForRange; > bool didWriteToPasteboard; > bool performTwoStepDrop; >- bool replacementURLForResource; > } m_delegateMethods; > }; > >diff --git a/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp b/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp >index 9512302b282e41ed1b24719a2d0448dc747fffdf..ce027b5a7be6827a78e7b7725bdbb3264a62520a 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp >+++ b/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.cpp >@@ -190,14 +190,4 @@ void InjectedBundlePageEditorClient::didWriteToPasteboard(WebPage& page) > m_client.didWriteToPasteboard(toAPI(&page), m_client.base.clientInfo); > } > >-String InjectedBundlePageEditorClient::replacementURLForResource(WebPage& page, Ref<SharedBuffer>&& resourceData, const String& mimeType) >-{ >- if (!m_client.replacementURLForResource) >- return { }; >- >- auto data = adoptWK(WKDataCreate(reinterpret_cast<const unsigned char*>(resourceData->data()), resourceData->size())); >- auto type = adoptWK(toCopiedAPI(mimeType)); >- return toWTFString(m_client.replacementURLForResource(toAPI(&page), data.get(), type.get(), m_client.base.clientInfo)); >-} >- > } // namespace WebKit >diff --git a/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h b/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h >index 1d976b6752b2ffd00e4b2d9fc0add6e0fb329c72..689941a18e8d9e94ca426f942b1eb8a0b3cf84bb 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h >+++ b/Source/WebKit/WebProcess/InjectedBundle/InjectedBundlePageEditorClient.h >@@ -31,7 +31,7 @@ > > namespace API { > template<> struct ClientTraits<WKBundlePageEditorClientBase> { >- typedef std::tuple<WKBundlePageEditorClientV0, WKBundlePageEditorClientV1, WKBundlePageEditorClientV2> Versions; >+ typedef std::tuple<WKBundlePageEditorClientV0, WKBundlePageEditorClientV1> Versions; > }; > } > >@@ -67,7 +67,6 @@ private: > void getPasteboardDataForRange(WebPage&, WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData) final; > void didWriteToPasteboard(WebPage&) final; > bool performTwoStepDrop(WebPage&, WebCore::DocumentFragment&, WebCore::Range& destination, bool isMove) final; >- String replacementURLForResource(WebPage&, Ref<WebCore::SharedBuffer>&& resourceData, const String&) final; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp >index 96a4dd18f214b594328c5078d7e22555ed7e7f3e..93405713bd8eff74c8afbd19be47403a5750466a 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp >@@ -297,11 +297,6 @@ bool WebEditorClient::performTwoStepDrop(DocumentFragment& fragment, Range& dest > return m_page->injectedBundleEditorClient().performTwoStepDrop(*m_page, fragment, destination, isMove); > } > >-String WebEditorClient::replacementURLForResource(Ref<WebCore::SharedBuffer>&& resourceData, const String& mimeType) >-{ >- return m_page->injectedBundleEditorClient().replacementURLForResource(*m_page, WTFMove(resourceData), mimeType); >-} >- > void WebEditorClient::registerUndoStep(UndoStep& step) > { > // FIXME: Add assertion that the command being reapplied is the same command that is >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h >index 7be8ddfca3f6d0ca897b7e685ce1993fb80023d8..b12ba602fae38356acdbcae95a1fbacf09793174 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h >@@ -83,7 +83,6 @@ private: > void willWriteSelectionToPasteboard(WebCore::Range*) final; > void didWriteSelectionToPasteboard() final; > void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData) final; >- String replacementURLForResource(Ref<WebCore::SharedBuffer>&& resourceData, const String& mimeType) final; > > void registerUndoStep(WebCore::UndoStep&) final; > void registerRedoStep(WebCore::UndoStep&) final; >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp >index 1fad3cb1abf8172f43956484da6d64e46f42c483..34666244693c966cf915717f209dc919ee4ac4c0 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp >@@ -245,10 +245,6 @@ int WebPlatformStrategies::getNumberOfFiles(const String& pasteboardName) > } > > #if PLATFORM(IOS_FAMILY) >-void WebPlatformStrategies::getTypesByFidelityForItemAtIndex(Vector<String>& types, uint64_t index, const String& pasteboardName) >-{ >- WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardTypesByFidelityForItemAtIndex(index, pasteboardName), Messages::WebPasteboardProxy::GetPasteboardTypesByFidelityForItemAtIndex::Reply(types), 0); >-} > > void WebPlatformStrategies::writeToPasteboard(const PasteboardURL& url, const String& pasteboardName) > { >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h >index dc26176a22bcbf75f5d113b21a536b32796579bb..f7f1041d8942cfe8ba379776b595b97ce92e268c 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h >@@ -57,7 +57,6 @@ private: > Vector<WebCore::PasteboardItemInfo> allPasteboardItemInfo(const String& pasteboardName) override; > WebCore::PasteboardItemInfo informationForItemAtIndex(int index, const String& pasteboardName) override; > void updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName) override; >- void getTypesByFidelityForItemAtIndex(Vector<String>& types, uint64_t index, const String& pasteboardName) override; > #endif > #if PLATFORM(COCOA) > int getNumberOfFiles(const String& pasteboardName) override; >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h b/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h >index 55f40e0b53b1266b68fce4e3898e883cce9a72a7..e4c2fd6cf5f8fe43982b25ffda28e786bbf6f77d 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h >@@ -78,7 +78,6 @@ private: > void willWriteSelectionToPasteboard(WebCore::Range*) final; > void didWriteSelectionToPasteboard() final; > void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData) final; >- String replacementURLForResource(Ref<WebCore::SharedBuffer>&& resourceData, const String& mimeType) final; > > void setInsertionPasteboard(const String&) final; > bool requestDOMPasteAccess() final { return false; } >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm b/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm >index c35233ed12197972a5a4c4617516a4c865af6ea1..0fc814faca074d3bb568c5e627f01e11fd1b6b35 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm >@@ -419,12 +419,6 @@ void WebEditorClient::getClientPasteboardDataForRange(WebCore::Range*, Vector<St > // Not implemented WebKit, only WebKit2. > } > >-String WebEditorClient::replacementURLForResource(Ref<SharedBuffer>&&, const String&) >-{ >- // Not implemented in WebKitLegacy. >- return { }; >-} >- > #if (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) > > // FIXME: Remove both this stub and the real version of this function below once we don't need the real version on any supported platform. >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h b/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h >index 4767b882613713831b8131a96020ff9fc8bfe723..d160a8386538378815c29330bd1861733581f704 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h >@@ -58,7 +58,6 @@ private: > Vector<WebCore::PasteboardItemInfo> allPasteboardItemInfo(const String& pasteboardName) override; > WebCore::PasteboardItemInfo informationForItemAtIndex(int index, const String& pasteboardName) override; > void updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName) override; >- void getTypesByFidelityForItemAtIndex(Vector<String>& types, uint64_t index, const String& pasteboardName) override; > #endif > int getNumberOfFiles(const String& pasteboardName) override; > void getTypes(Vector<String>& types, const String& pasteboardName) override; >diff --git a/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm b/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm >index 6c1dcb357ba09ed7832a89e1bd7ba3239c9776d1..08a902620c66b3cfec7e104a0348e3f2643144cc 100644 >--- a/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm >+++ b/Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm >@@ -158,10 +158,6 @@ long WebPlatformStrategies::writeCustomData(const WebCore::PasteboardCustomData& > } > > #if PLATFORM(IOS_FAMILY) >-void WebPlatformStrategies::getTypesByFidelityForItemAtIndex(Vector<String>& types, uint64_t index, const String& pasteboardName) >-{ >- PlatformPasteboard(pasteboardName).getTypesByFidelityForItemAtIndex(types, index); >-} > > void WebPlatformStrategies::writeToPasteboard(const PasteboardURL& url, const String& pasteboardName) > { >diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp b/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp >index 2e7ea5819432ad557caf788fd139674b1b67417f..2e89d412ba4537643c5dd3ccca1bf1822ea002c6 100644 >--- a/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp >+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.cpp >@@ -269,12 +269,6 @@ void WebEditorClient::getClientPasteboardDataForRange(WebCore::Range*, Vector<St > notImplemented(); > } > >-String WebEditorClient::replacementURLForResource(Ref<WebCore::SharedBuffer>&&, const String&) >-{ >- notImplemented(); >- return { }; >-} >- > bool WebEditorClient::shouldDeleteRange(Range* range) > { > COMPtr<IWebEditingDelegate> ed; >diff --git a/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h b/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h >index cc5e4d645be56704a092d11fc006c32313995adb..b70f7cb666b49fa6418e7021aad35a232fcc0ba3 100644 >--- a/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h >+++ b/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h >@@ -54,7 +54,6 @@ private: > void willWriteSelectionToPasteboard(WebCore::Range*) final; > void didWriteSelectionToPasteboard() final; > void getClientPasteboardDataForRange(WebCore::Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<WebCore::SharedBuffer>>& pasteboardData) final; >- String replacementURLForResource(Ref<WebCore::SharedBuffer>&&, const String&) final; > > void didEndUserTriggeredSelectionChanges() final { } > void respondToChangedContents() final; >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index b9e2f12bcf7cbfdb382d49ba09c2c9d25ff09042..5bc63b0078185e650bd86295289aed3c7adc4356 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,22 @@ >+2019-02-18 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [iOS] Support pasting item-provider-backed data on the pasteboard as attachment elements >+ https://bugs.webkit.org/show_bug.cgi?id=194670 >+ <rdar://problem/39066529> >+ >+ Reviewed by Tim Horton. >+ >+ Remove code and tests for subresource URL replacement, and also add a new test to verify that copied data can be >+ pasted in an editable area as attachment elements. >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/BundleEditingDelegatePlugIn.mm: >+ (-[BundleEditingDelegatePlugIn webProcessPlugIn:didCreateBrowserContextController:]): >+ (-[BundleEditingDelegatePlugIn _webProcessPlugInBrowserContextController:replacementURLForResource:mimeType:]): Deleted. >+ * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm: >+ (TestWebKitAPI::TEST): >+ * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: >+ (WTR::InjectedBundlePage::InjectedBundlePage): >+ > 2019-02-18 Alex Christensen <achristensen@webkit.org> > > Fix API test after r241728 >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/BundleEditingDelegatePlugIn.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/BundleEditingDelegatePlugIn.mm >index 33f2bb83260f12d6d2b8390e7450d0f5baf6601c..c63c0a8ecf446057d52e640536fb18be824cdb2a 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/BundleEditingDelegatePlugIn.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/BundleEditingDelegatePlugIn.mm >@@ -47,7 +47,6 @@ @implementation BundleEditingDelegatePlugIn { > RetainPtr<id <BundleEditingDelegateProtocol>> _remoteObject; > BOOL _editingDelegateShouldInsertText; > BOOL _shouldOverridePerformTwoStepDrop; >- RetainPtr<NSDictionary<NSString *, NSString *>> _mimeTypeToReplacementURLMap; > } > > - (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController didCreateBrowserContextController:(WKWebProcessPlugInBrowserContextController *)browserContextController >@@ -64,7 +63,6 @@ - (void)webProcessPlugIn:(WKWebProcessPlugInController *)plugInController didCre > _editingDelegateShouldInsertText = YES; > > _shouldOverridePerformTwoStepDrop = [[plugInController.parameters valueForKey:@"BundleOverridePerformTwoStepDrop"] boolValue]; >- _mimeTypeToReplacementURLMap = [plugInController.parameters valueForKey:@"MIMETypeToReplacementURLMap"]; > > _WKRemoteObjectInterface *interface = [_WKRemoteObjectInterface remoteObjectInterfaceWithProtocol:@protocol(BundleEditingDelegateProtocol)]; > _remoteObject = [browserContextController._remoteObjectRegistry remoteObjectProxyWithInterface:interface]; >@@ -100,12 +98,6 @@ - (BOOL)_webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserCont > return _shouldOverridePerformTwoStepDrop; > } > >-- (NSString *)_webProcessPlugInBrowserContextController:(WKWebProcessPlugInBrowserContextController *)controller replacementURLForResource:(NSData *)resourceData mimeType:(NSString *)mimeType >-{ >- assert(!!resourceData); >- return [_mimeTypeToReplacementURLMap objectForKey:mimeType]; >-} >- > @end > > #endif // WK_API_ENABLED >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >index b00ef893d875aea63459524a1fccdaf235297d28..84864fc57f8e2d4dd6b9db8ef998cbf2a48a49b7 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >@@ -1158,39 +1158,6 @@ TEST(WKAttachmentTests, InsertDuplicateAttachmentAndUpdateData) > EXPECT_FALSE([[originalAttachment info].fileWrapper isEqual:fileWrapper.get()]); > } > >-TEST(WKAttachmentTests, InjectedBundleReplaceURLsWhenPastingAttributedString) >-{ >- platformCopyRichTextWithMultipleAttachments(); >- >- auto configuration = retainPtr([WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"BundleEditingDelegatePlugIn"]); >- [[configuration processPool] _setObject:@{ @"image/png" : @"cid:foo-bar" } forBundleParameter:@"MIMETypeToReplacementURLMap"]; >- auto webView = webViewForTestingAttachments(CGSizeMake(500, 500), configuration.get()); >- { >- ObserveAttachmentUpdatesForScope observer(webView.get()); >- [webView _synchronouslyExecuteEditCommand:@"Paste" argument:nil]; >- EXPECT_EQ(2U, observer.observer().inserted.count); >- } >- [webView expectElementTagsInOrder:@[ @"IMG", @"ATTACHMENT", @"ATTACHMENT" ]]; >- EXPECT_WK_STREQ("cid:foo-bar", [webView valueOfAttribute:@"src" forQuerySelector:@"img"]); >- EXPECT_WK_STREQ(@"", [webView stringByEvaluatingJavaScript:@"document.querySelectorAll('img')[0].attachmentIdentifier"]); >-} >- >-TEST(WKAttachmentTests, InjectedBundleReplaceURLWhenPastingImage) >-{ >- platformCopyPNG(); >- >- NSString *replacementURL = @"cid:foo-bar"; >- auto configuration = retainPtr([WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"BundleEditingDelegatePlugIn"]); >- [[configuration processPool] _setObject:@{ @"image/tiff" : replacementURL, @"image/png" : replacementURL } forBundleParameter:@"MIMETypeToReplacementURLMap"]; >- auto webView = webViewForTestingAttachments(CGSizeMake(500, 500), configuration.get()); >- { >- ObserveAttachmentUpdatesForScope observer(webView.get()); >- [webView _synchronouslyExecuteEditCommand:@"Paste" argument:nil]; >- EXPECT_EQ(0U, observer.observer().inserted.count); >- } >- EXPECT_WK_STREQ("cid:foo-bar", [webView valueOfAttribute:@"src" forQuerySelector:@"img"]); >-} >- > TEST(WKAttachmentTests, InsertAttachmentUsingFileWrapperWithFilePath) > { > auto webView = webViewForTestingAttachments(); >@@ -1881,6 +1848,49 @@ TEST(WKAttachmentTestsIOS, InsertDroppedContactAsAttachment) > EXPECT_WK_STREQ("text/vcard", info.contentType); > } > >+TEST(WKAttachmentTestsIOS, InsertPastedFilesAsAttachments) >+{ >+ auto pdfItem = adoptNS([[NSItemProvider alloc] init]); >+ [pdfItem setSuggestedName:@"doc"]; >+ [pdfItem setPreferredPresentationStyle:UIPreferredPresentationStyleAttachment]; >+ [pdfItem registerData:testPDFData() type:(__bridge NSString *)kUTTypePDF]; >+ >+ auto textItem = adoptNS([[NSItemProvider alloc] init]); >+ [textItem setSuggestedName:@"hello"]; >+ [textItem setPreferredPresentationStyle:UIPreferredPresentationStyleAttachment]; >+ [textItem registerData:[@"helloworld" dataUsingEncoding:NSUTF8StringEncoding] type:(__bridge NSString *)kUTTypePlainText]; >+ >+ UIPasteboard.generalPasteboard.itemProviders = @[ pdfItem.get(), textItem.get() ]; >+ >+ RetainPtr<_WKAttachment> textAttachment; >+ RetainPtr<_WKAttachment> pdfAttachment; >+ auto webView = webViewForTestingAttachments(); >+ { >+ ObserveAttachmentUpdatesForScope observer(webView.get()); >+ [webView _synchronouslyExecuteEditCommand:@"Paste" argument:nil]; >+ EXPECT_EQ(2U, observer.observer().inserted.count); >+ _WKAttachment *firstAttachment = observer.observer().inserted.firstObject; >+ if ([firstAttachment.info.contentType isEqualToString:@"text/plain"]) { >+ textAttachment = firstAttachment; >+ pdfAttachment = observer.observer().inserted.lastObject; >+ } else { >+ EXPECT_WK_STREQ(firstAttachment.info.contentType, @"application/pdf"); >+ textAttachment = observer.observer().inserted.lastObject; >+ pdfAttachment = firstAttachment; >+ } >+ observer.expectAttachmentUpdates(@[ ], @[ pdfAttachment.get(), textAttachment.get() ]); >+ } >+ >+ [webView expectElementCount:2 querySelector:@"attachment"]; >+ EXPECT_WK_STREQ("doc", [webView valueOfAttribute:@"title" forQuerySelector:@"attachment[type^=application]"]); >+ EXPECT_WK_STREQ("doc", [pdfAttachment info].name); >+ EXPECT_WK_STREQ("hello", [webView valueOfAttribute:@"title" forQuerySelector:@"attachment[type^=text]"]); >+ EXPECT_WK_STREQ("hello", [textAttachment info].name); >+ [pdfAttachment expectRequestedDataToBe:testPDFData()]; >+ [textAttachment expectRequestedDataToBe:[@"helloworld" dataUsingEncoding:NSUTF8StringEncoding]]; >+ EXPECT_TRUE([webView canPerformAction:@selector(paste:) withSender:nil]); >+} >+ > #if HAVE(PENCILKIT) > static BOOL forEachViewInHierarchy(UIView *view, void(^mapFunction)(UIView *subview, BOOL *stop)) > { >diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp >index 5281d05ae4638426e9d8de0f31ad2cd0915bac5a..653c544bb09ae5bc74e53255a812700d2eda1345 100644 >--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp >+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp >@@ -358,8 +358,8 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page) > }; > WKBundlePageSetUIClient(m_page, &uiClient.base); > >- WKBundlePageEditorClientV2 editorClient = { >- { 2, this }, >+ WKBundlePageEditorClientV1 editorClient = { >+ { 1, this }, > shouldBeginEditing, > shouldEndEditing, > shouldInsertNode, >@@ -375,7 +375,6 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page) > 0, /* getPasteboardDataForRange */ > 0, /* didWriteToPasteboard */ > 0, /* performTwoStepDrop */ >- 0, /* replacementURLForResource */ > }; > WKBundlePageSetEditorClient(m_page, &editorClient.base); >
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194670
:
362074
|
362338
| 362341