Title: [289552] trunk/Source
Revision
289552
Author
wenson_hs...@apple.com
Date
2022-02-10 10:32:30 -0800 (Thu, 10 Feb 2022)

Log Message

Support `WebPageProxy::replaceSelectionWithPasteboardData()` on iOS
https://bugs.webkit.org/show_bug.cgi?id=236406

Reviewed by Tim Horton.

Source/WebCore:

Move the definition of `readSelectionFromPasteboard` from EditorMac.mm to EditorCocoa.mm.
No change in behavior (yet).

* editing/Editor.h:
* editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::readSelectionFromPasteboard):
* editing/mac/EditorMac.mm:
(WebCore::Editor::readSelectionFromPasteboard): Deleted.

Move this into EditorCocoa.mm.

Source/WebKit:

In preparation for an upcoming patch, make `WebPageProxy::replaceSelectionWithPasteboardData()` (as well as all
downstream codepaths) available on all Cocoa platforms. This is currently macOS-specific, and only used for
service controls (i.e. inserting content via sharing picker API).

* Sources.txt:
* SourcesCocoa.txt:

Move WebPasteboardOverrides.cpp from SourcesCocoa to Sources, now that there are non-Cocoa-specific codepaths in
WebPlatformStrategies that exercise this class.

* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::replaceSelectionWithPasteboardData):
* UIProcess/WebPageProxy.h:
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::replaceSelectionWithPasteboardData): Deleted.

Move this into WebPageProxyCocoa.mm.

* WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp:
(WebKit::WebPasteboardOverrides::overriddenInfo):
* WebProcess/WebCoreSupport/WebPasteboardOverrides.h:
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::getPasteboardItemsCount):
(WebKit::WebPlatformStrategies::allPasteboardItemInfo):
(WebKit::WebPlatformStrategies::informationForItemAtIndex):
(WebKit::WebPlatformStrategies::readBufferFromPasteboard):

Add additional support for returning canned data from `WebPasteboardOverrides::sharedPasteboardOverrides()` in
pasteboard reading codepaths that are exercised by `WebCore::Pasteboard` on iOS.

* WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::replaceSelectionPasteboardName):
(WebKit::WebPage::replaceSelectionWithPasteboardData):
(WebKit::WebPage::readSelectionFromPasteboard):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::readSelectionFromPasteboard): Deleted.

Delete this unimplemented method stub.

* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::replaceSelectionPasteboardName): Deleted.

Move this into WebPageCocoa.mm.

(WebKit::WebPage::replaceSelectionWithPasteboardData): Deleted.
(WebKit::WebPage::readSelectionFromPasteboard): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289551 => 289552)


--- trunk/Source/WebCore/ChangeLog	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebCore/ChangeLog	2022-02-10 18:32:30 UTC (rev 289552)
@@ -1,3 +1,21 @@
+2022-02-10  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Support `WebPageProxy::replaceSelectionWithPasteboardData()` on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=236406
+
+        Reviewed by Tim Horton.
+
+        Move the definition of `readSelectionFromPasteboard` from EditorMac.mm to EditorCocoa.mm.
+        No change in behavior (yet).
+
+        * editing/Editor.h:
+        * editing/cocoa/EditorCocoa.mm:
+        (WebCore::Editor::readSelectionFromPasteboard):
+        * editing/mac/EditorMac.mm:
+        (WebCore::Editor::readSelectionFromPasteboard): Deleted.
+
+        Move this into EditorCocoa.mm.
+
 2022-02-10  Tim Nguyen  <n...@apple.com>
 
         Add webkit-pdfjs-viewer scheme for PDF.js resources

Modified: trunk/Source/WebCore/editing/Editor.h (289551 => 289552)


--- trunk/Source/WebCore/editing/Editor.h	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebCore/editing/Editor.h	2022-02-10 18:32:30 UTC (rev 289552)
@@ -534,10 +534,10 @@
     String stringSelectionForPasteboardWithImageAltText();
     void takeFindStringFromSelection();
     WEBCORE_EXPORT void replaceSelectionWithAttributedString(NSAttributedString *, MailBlockquoteHandling = MailBlockquoteHandling::RespectBlockquote);
+    WEBCORE_EXPORT void readSelectionFromPasteboard(const String& pasteboardName);
 #endif
 
 #if PLATFORM(MAC)
-    WEBCORE_EXPORT void readSelectionFromPasteboard(const String& pasteboardName);
     WEBCORE_EXPORT void replaceNodeFromPasteboard(Node*, const String& pasteboardName);
     WEBCORE_EXPORT RefPtr<SharedBuffer> dataSelectionForPasteboard(const String& pasteboardName);
 #endif

Modified: trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm (289551 => 289552)


--- trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebCore/editing/cocoa/EditorCocoa.mm	2022-02-10 18:32:30 UTC (rev 289552)
@@ -263,4 +263,13 @@
     return type;
 }
 
+void Editor::readSelectionFromPasteboard(const String& pasteboardName)
+{
+    Pasteboard pasteboard(PagePasteboardContext::create(m_document.pageID()), pasteboardName);
+    if (m_document.selection().selection().isContentRichlyEditable())
+        pasteWithPasteboard(&pasteboard, { PasteOption::AllowPlainText });
+    else
+        pasteAsPlainTextWithPasteboard(pasteboard);
 }
+
+}

Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (289551 => 289552)


--- trunk/Source/WebCore/editing/mac/EditorMac.mm	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm	2022-02-10 18:32:30 UTC (rev 289552)
@@ -184,15 +184,6 @@
     client()->setInsertionPasteboard(String());
 }
 
-void Editor::readSelectionFromPasteboard(const String& pasteboardName)
-{
-    Pasteboard pasteboard(PagePasteboardContext::create(m_document.pageID()), pasteboardName);
-    if (m_document.selection().selection().isContentRichlyEditable())
-        pasteWithPasteboard(&pasteboard, { PasteOption::AllowPlainText });
-    else
-        pasteAsPlainTextWithPasteboard(pasteboard);
-}
-
 static void maybeCopyNodeAttributesToFragment(const Node& node, DocumentFragment& fragment)
 {
     // This is only supported for single-Node fragments.

Modified: trunk/Source/WebKit/ChangeLog (289551 => 289552)


--- trunk/Source/WebKit/ChangeLog	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebKit/ChangeLog	2022-02-10 18:32:30 UTC (rev 289552)
@@ -1,3 +1,59 @@
+2022-02-10  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Support `WebPageProxy::replaceSelectionWithPasteboardData()` on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=236406
+
+        Reviewed by Tim Horton.
+
+        In preparation for an upcoming patch, make `WebPageProxy::replaceSelectionWithPasteboardData()` (as well as all
+        downstream codepaths) available on all Cocoa platforms. This is currently macOS-specific, and only used for
+        service controls (i.e. inserting content via sharing picker API).
+
+        * Sources.txt:
+        * SourcesCocoa.txt:
+
+        Move WebPasteboardOverrides.cpp from SourcesCocoa to Sources, now that there are non-Cocoa-specific codepaths in
+        WebPlatformStrategies that exercise this class.
+
+        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+        (WebKit::WebPageProxy::replaceSelectionWithPasteboardData):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::replaceSelectionWithPasteboardData): Deleted.
+
+        Move this into WebPageProxyCocoa.mm.
+
+        * WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp:
+        (WebKit::WebPasteboardOverrides::overriddenInfo):
+        * WebProcess/WebCoreSupport/WebPasteboardOverrides.h:
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::WebPlatformStrategies::getPasteboardItemsCount):
+        (WebKit::WebPlatformStrategies::allPasteboardItemInfo):
+        (WebKit::WebPlatformStrategies::informationForItemAtIndex):
+        (WebKit::WebPlatformStrategies::readBufferFromPasteboard):
+
+        Add additional support for returning canned data from `WebPasteboardOverrides::sharedPasteboardOverrides()` in
+        pasteboard reading codepaths that are exercised by `WebCore::Pasteboard` on iOS.
+
+        * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
+        (WebKit::replaceSelectionPasteboardName):
+        (WebKit::WebPage::replaceSelectionWithPasteboardData):
+        (WebKit::WebPage::readSelectionFromPasteboard):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::readSelectionFromPasteboard): Deleted.
+
+        Delete this unimplemented method stub.
+
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::replaceSelectionPasteboardName): Deleted.
+
+        Move this into WebPageCocoa.mm.
+
+        (WebKit::WebPage::replaceSelectionWithPasteboardData): Deleted.
+        (WebKit::WebPage::readSelectionFromPasteboard): Deleted.
+
 2022-02-10  Tim Nguyen  <n...@apple.com>
 
         Add webkit-pdfjs-viewer scheme for PDF.js resources

Modified: trunk/Source/WebKit/Sources.txt (289551 => 289552)


--- trunk/Source/WebKit/Sources.txt	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebKit/Sources.txt	2022-02-10 18:32:30 UTC (rev 289552)
@@ -821,6 +821,7 @@
 WebProcess/WebCoreSupport/WebMediaKeySystemClient.cpp
 WebProcess/WebCoreSupport/WebMessagePortChannelProvider.cpp
 WebProcess/WebCoreSupport/WebNotificationClient.cpp
+WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp
 WebProcess/WebCoreSupport/WebPerformanceLoggingClient.cpp
 WebProcess/WebCoreSupport/WebPermissionController.cpp
 WebProcess/WebCoreSupport/WebPlatformStrategies.cpp

Modified: trunk/Source/WebKit/SourcesCocoa.txt (289551 => 289552)


--- trunk/Source/WebKit/SourcesCocoa.txt	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2022-02-10 18:32:30 UTC (rev 289552)
@@ -674,7 +674,6 @@
 WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm
 
 WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.cpp
-WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp
 WebProcess/WebCoreSupport/WebValidationMessageClient.cpp
 
 WebProcess/WebCoreSupport/ios/WebChromeClientIOS.mm

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (289551 => 289552)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2022-02-10 18:32:30 UTC (rev 289552)
@@ -861,6 +861,11 @@
     ModalContainerControlClassifier::sharedClassifier().classify(WTFMove(texts), WTFMove(completion));
 }
 
+void WebPageProxy::replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference& data)
+{
+    send(Messages::WebPage::ReplaceSelectionWithPasteboardData(types, data));
+}
+
 } // namespace WebKit
 
 #undef MESSAGE_CHECK_COMPLETION

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (289551 => 289552)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2022-02-10 18:32:30 UTC (rev 289552)
@@ -1179,6 +1179,7 @@
     void registerWebProcessAccessibilityToken(const IPC::DataReference&);
     // Called by the UI process when it is ready to send its tokens to the web process.
     void registerUIProcessAccessibilityTokens(const IPC::DataReference& elemenToken, const IPC::DataReference& windowToken);
+    void replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference&);
     bool readSelectionFromPasteboard(const String& pasteboardName);
     String stringSelectionForPasteboard();
     RefPtr<WebCore::SharedBuffer> dataSelectionForPasteboard(const String& pasteboardType);
@@ -1188,10 +1189,6 @@
     WebCore::DestinationColorSpace colorSpace();
 #endif
 
-#if ENABLE(SERVICE_CONTROLS)
-    void replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference&);
-#endif
-
     void pageScaleFactorDidChange(double);
     void pluginScaleFactorDidChange(double);
     void pluginZoomFactorDidChange(double);

Modified: trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (289551 => 289552)


--- trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm	2022-02-10 18:32:30 UTC (rev 289552)
@@ -246,13 +246,6 @@
     return result;
 }
 
-#if ENABLE(SERVICE_CONTROLS)
-void WebPageProxy::replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference& data)
-{
-    send(Messages::WebPage::ReplaceSelectionWithPasteboardData(types, data));
-}
-#endif
-
 #if ENABLE(DRAG_SUPPORT)
 
 void WebPageProxy::setPromisedDataForImage(const String& pasteboardName, const SharedMemory::IPCHandle& imageHandle, const String& filename, const String& extension,

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp (289551 => 289552)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp	2022-02-10 18:32:30 UTC (rev 289552)
@@ -26,9 +26,11 @@
 #include "config.h"
 #include "WebPasteboardOverrides.h"
 
+#include <WebCore/PasteboardItemInfo.h>
 #include <wtf/NeverDestroyed.h>
 
 namespace WebKit {
+using namespace WebCore;
 
 WebPasteboardOverrides& WebPasteboardOverrides::sharedPasteboardOverrides()
 {
@@ -83,6 +85,20 @@
     return result;
 }
 
+std::optional<WebCore::PasteboardItemInfo> WebPasteboardOverrides::overriddenInfo(const String& pasteboardName)
+{
+    auto types = this->overriddenTypes(pasteboardName);
+    if (types.isEmpty())
+        return std::nullopt;
+
+    PasteboardItemInfo item;
+    item.platformTypesByFidelity = types;
+    // FIXME: This is currently appropriate for all clients that rely on PasteboardItemInfo, but we may need to adjust
+    // this in the future so that we don't treat 'inline' types such as plain text as uploaded files.
+    item.platformTypesForFileUpload = types;
+    return { WTFMove(item) };
+}
+
 bool WebPasteboardOverrides::getDataForOverride(const String& pasteboardName, const String& type, Vector<uint8_t>& data) const
 {
     auto pasteboardIterator = m_overridesMap.find(pasteboardName);

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPasteboardOverrides.h (289551 => 289552)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPasteboardOverrides.h	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPasteboardOverrides.h	2022-02-10 18:32:30 UTC (rev 289552)
@@ -30,6 +30,10 @@
 #include <wtf/text/StringHash.h>
 #include <wtf/text/WTFString.h>
 
+namespace WebCore {
+struct PasteboardItemInfo;
+}
+
 namespace WebKit {
 
 class WebPasteboardOverrides {
@@ -40,6 +44,7 @@
     void addOverride(const String& pasteboardName, const String& type, const Vector<uint8_t>&);
     void removeOverride(const String& pasteboardName, const String& type);
 
+    std::optional<WebCore::PasteboardItemInfo> overriddenInfo(const String& pasteboardName);
     Vector<String> overriddenTypes(const String& pasteboardName);
 
     bool getDataForOverride(const String& pasteboardName, const String& type, Vector<uint8_t>&) const;

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (289551 => 289552)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2022-02-10 18:32:30 UTC (rev 289552)
@@ -387,6 +387,11 @@
 
 int WebPlatformStrategies::getPasteboardItemsCount(const String& pasteboardName, const PasteboardContext* context)
 {
+    if (!WebPasteboardOverrides::sharedPasteboardOverrides().overriddenTypes(pasteboardName).isEmpty()) {
+        // Override pasteboards currently only support single pasteboard items.
+        return 1;
+    }
+
     uint64_t itemsCount { 0 };
     WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardItemsCount(pasteboardName, pageIdentifier(context)), Messages::WebPasteboardProxy::GetPasteboardItemsCount::Reply(itemsCount), 0);
     return itemsCount;
@@ -394,6 +399,9 @@
 
 std::optional<Vector<PasteboardItemInfo>> WebPlatformStrategies::allPasteboardItemInfo(const String& pasteboardName, int64_t changeCount, const PasteboardContext* context)
 {
+    if (auto info = WebPasteboardOverrides::sharedPasteboardOverrides().overriddenInfo(pasteboardName))
+        return { { WTFMove(*info) } };
+
     std::optional<Vector<PasteboardItemInfo>> allInfo;
     WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::AllPasteboardItemInfo(pasteboardName, changeCount, pageIdentifier(context)), Messages::WebPasteboardProxy::AllPasteboardItemInfo::Reply(allInfo), 0);
     return allInfo;
@@ -401,6 +409,9 @@
 
 std::optional<PasteboardItemInfo> WebPlatformStrategies::informationForItemAtIndex(size_t index, const String& pasteboardName, int64_t changeCount, const PasteboardContext* context)
 {
+    if (auto info = WebPasteboardOverrides::sharedPasteboardOverrides().overriddenInfo(pasteboardName))
+        return info;
+
     std::optional<PasteboardItemInfo> info;
     WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::InformationForItemAtIndex(index, pasteboardName, changeCount, pageIdentifier(context)), Messages::WebPasteboardProxy::InformationForItemAtIndex::Reply(info), 0);
     return info;
@@ -408,6 +419,10 @@
 
 RefPtr<WebCore::SharedBuffer> WebPlatformStrategies::readBufferFromPasteboard(std::optional<size_t> index, const String& pasteboardType, const String& pasteboardName, const PasteboardContext* context)
 {
+    Vector<uint8_t> overrideBuffer;
+    if (WebPasteboardOverrides::sharedPasteboardOverrides().getDataForOverride(pasteboardName, pasteboardType, overrideBuffer))
+        return SharedBuffer::create(WTFMove(overrideBuffer));
+
     SharedMemory::IPCHandle ipcHandle;
     WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadBufferFromPasteboard(index, pasteboardType, pasteboardName, pageIdentifier(context)), Messages::WebPasteboardProxy::ReadBufferFromPasteboard::Reply(ipcHandle), 0);
     if (ipcHandle.handle.isNull())

Modified: trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (289551 => 289552)


--- trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm	2022-02-10 18:32:30 UTC (rev 289552)
@@ -32,6 +32,7 @@
 #import "UserMediaCaptureManager.h"
 #import "WKAccessibilityWebPageObjectBase.h"
 #import "WebPageProxyMessages.h"
+#import "WebPasteboardOverrides.h"
 #import "WebPaymentCoordinator.h"
 #import "WebRemoteObjectRegistry.h"
 #import <pal/spi/cocoa/LaunchServicesSPI.h>
@@ -450,6 +451,32 @@
 
 #endif
 
+static String& replaceSelectionPasteboardName()
+{
+    static NeverDestroyed<String> string("ReplaceSelectionPasteboard");
+    return string;
+}
+
+void WebPage::replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference& data)
+{
+    for (auto& type : types)
+        WebPasteboardOverrides::sharedPasteboardOverrides().addOverride(replaceSelectionPasteboardName(), type, { data });
+
+    readSelectionFromPasteboard(replaceSelectionPasteboardName(), [](bool) { });
+
+    for (auto& type : types)
+        WebPasteboardOverrides::sharedPasteboardOverrides().removeOverride(replaceSelectionPasteboardName(), type);
+}
+
+void WebPage::readSelectionFromPasteboard(const String& pasteboardName, CompletionHandler<void(bool&&)>&& completionHandler)
+{
+    auto& frame = m_page->focusController().focusedOrMainFrame();
+    if (frame.selection().isNone())
+        return completionHandler(false);
+    frame.editor().readSelectionFromPasteboard(pasteboardName);
+    completionHandler(true);
+}
+
 } // namespace WebKit
 
 #endif // PLATFORM(COCOA)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (289551 => 289552)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2022-02-10 18:32:30 UTC (rev 289552)
@@ -964,7 +964,7 @@
     void requestAcceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&);
 #endif
 
-#if PLATFORM(COCOA) && ENABLE(SERVICE_CONTROLS)
+#if PLATFORM(COCOA)
     void replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference&);
 #endif
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (289551 => 289552)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2022-02-10 18:32:30 UTC (rev 289552)
@@ -454,10 +454,7 @@
     GetStringSelectionForPasteboard() -> (String stringValue) Synchronous
     GetDataSelectionForPasteboard(String pasteboardType) -> (WebKit::SharedMemory::IPCHandle ipcHandle) Synchronous
     ReadSelectionFromPasteboard(String pasteboardName) -> (bool result) Synchronous
-
-#if ENABLE(SERVICE_CONTROLS)
     ReplaceSelectionWithPasteboardData(Vector<String> types, IPC::DataReference data)
-#endif
 
     ShouldDelayWindowOrderingEvent(WebKit::WebMouseEvent event) -> (bool result) Synchronous
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (289551 => 289552)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2022-02-10 18:32:30 UTC (rev 289552)
@@ -597,12 +597,6 @@
     [m_mockAccessibilityElement setRemoteTokenData:elementTokenData];
 }
 
-void WebPage::readSelectionFromPasteboard(const String&, CompletionHandler<void(bool&&)>&& completionHandler)
-{
-    notImplemented();
-    completionHandler(false);
-}
-
 void WebPage::getStringSelectionForPasteboard(CompletionHandler<void(String&&)>&& completionHandler)
 {
     notImplemented();

Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm (289551 => 289552)


--- trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2022-02-10 18:29:46 UTC (rev 289551)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2022-02-10 18:32:30 UTC (rev 289552)
@@ -458,25 +458,6 @@
     return didPerformAction;
 }
 
-#if ENABLE(SERVICE_CONTROLS)
-static String& replaceSelectionPasteboardName()
-{
-    static NeverDestroyed<String> string("ReplaceSelectionPasteboard");
-    return string;
-}
-
-void WebPage::replaceSelectionWithPasteboardData(const Vector<String>& types, const IPC::DataReference& data)
-{
-    for (auto& type : types)
-        WebPasteboardOverrides::sharedPasteboardOverrides().addOverride(replaceSelectionPasteboardName(), type, { data });
-
-    readSelectionFromPasteboard(replaceSelectionPasteboardName(), [](bool) { });
-
-    for (auto& type : types)
-        WebPasteboardOverrides::sharedPasteboardOverrides().removeOverride(replaceSelectionPasteboardName(), type);
-}
-#endif
-
 bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent&)
 {
     return false;
@@ -494,15 +475,6 @@
     [accessibilityRemoteObject() setRemoteParent:remoteElement.get()];
 }
 
-void WebPage::readSelectionFromPasteboard(const String& pasteboardName, CompletionHandler<void(bool&&)>&& completionHandler)
-{
-    auto& frame = m_page->focusController().focusedOrMainFrame();
-    if (frame.selection().isNone())
-        return completionHandler(false);
-    frame.editor().readSelectionFromPasteboard(pasteboardName);
-    completionHandler(true);
-}
-
 void WebPage::getStringSelectionForPasteboard(CompletionHandler<void(String&&)>&& completionHandler)
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to