⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 286825 in webkit


Ignore:
Timestamp:
Dec 9, 2021, 7:08:53 PM (5 years ago)
Author:
Devin Rousso
Message:

Add a DOMPasteAccessCategory to control which pasteboard the WebProcess is granted access to when pasting
https://bugs.webkit.org/show_bug.cgi?id=233939

Reviewed by Wenson Hsieh.

Implementing -pasteFont: <https://webkit.org/b/191379> requires that we read from the font
pasteboard instead of the general pasteboard. In order to allow web content to trigger this
(e.g. document.execCommand("PasteFont"))) we must have a way for the WebProcess to signal
that it wishes to read from the font pasteboard instead of the general pasteboard. As such,
create and pass along a DOMPasteAccessCategory to requestDOMPasteAccess.

No change in behavior.

Source/WebCore:

  • dom/DOMPasteAccess.h:

Create DOMPasteAccessCategory.

  • page/EditorClient.h:
  • page/Frame.h:
  • page/Frame.cpp:

(WebCore::Frame::requestDOMPasteAccess):

  • loader/EmptyClients.cpp:

(WebCore::EmptyEditorClient::requestDOMPasteAccess):
Pass along the DOMPasteAccessCategory.

Source/WebKit:

  • Scripts/webkit/messages.py:

(headers_for_type):
Indicate which header is associated with DOMPasteAccessCategory.

  • UIProcess/Cocoa/WebViewImpl.h:
  • UIProcess/Cocoa/WebViewImpl.mm:

(-[WKDOMPasteMenuDelegate initWithWebViewImpl:pasteAccessCategory:]): Added.
(-[WKDOMPasteMenuDelegate menuDidClose:]):
(-[WKDOMPasteMenuDelegate _web_grantDOMPasteAccess]): Added.
(WebKit::WebViewImpl::handleProcessSwapOrExit):
(WebKit::pasteboardNameForAccessCategory): Added.
(WebKit::pasteboardForAccessCategory): Added.
(WebKit::WebViewImpl::requestDOMPasteAccess):
(WebKit::WebViewImpl::handleDOMPasteRequestForCategoryWithResult):
(WebKit::WebViewImpl::hideDOMPasteMenuWithResult): Added.
(-[WKDOMPasteMenuDelegate initWithWebViewImpl:]): Deleted.
(WebKit::WebViewImpl::handleDOMPasteRequestWithResult): Deleted.

  • UIProcess/API/mac/WKView.mm:

(-[WKView _web_grantDOMPasteAccess]): Deleted.

  • UIProcess/API/mac/WKWebViewMac.mm:

(-[WKWebView _web_grantDOMPasteAccess]): Deleted.
Pass the DOMPasteAccessCategory to the WKDOMPasteMenuDelegate and use it as the target
of the NSMenuItem so that we can pass along the DOMPasteAccessCategory in the action.

  • UIProcess/ios/WKContentViewInteraction.h:
  • UIProcess/ios/WKContentViewInteraction.mm:

(pasteboardNameForAccessCategory): Added.
(pasteboardForAccessCategory): Added.
(-[WKContentView _handleDOMPasteRequestWithResult:]):
(-[WKContentView _requestDOMPasteAccessForCategory:elementRect:originIdentifier:completionHandler:]): Added.
(-[WKContentView _requestDOMPasteAccessWithElementRect:originIdentifier:completionHandler:]): Deleted.

  • UIProcess/PageClient.h:
  • UIProcess/API/gtk/PageClientImpl.h:
  • UIProcess/API/gtk/PageClientImpl.cpp:

(WebKit::PageClientImpl::requestDOMPasteAccess):

  • UIProcess/API/wpe/PageClientImpl.h:
  • UIProcess/API/wpe/PageClientImpl.cpp:

(WebKit::PageClientImpl::requestDOMPasteAccess):

  • UIProcess/ios/PageClientImplIOS.h:
  • UIProcess/ios/PageClientImplIOS.mm:

(WebKit::PageClientImpl::requestDOMPasteAccess):

  • UIProcess/mac/PageClientImplMac.h:
  • UIProcess/mac/PageClientImplMac.mm:

(WebKit::PageClientImpl::requestDOMPasteAccess):

  • UIProcess/playstation/PageClientImpl.h:
  • UIProcess/playstation/PageClientImpl.cpp:

(WebKit::PageClientImpl::requestDOMPasteAccess):

  • UIProcess/win/PageClientImpl.h:
  • UIProcess/win/PageClientImpl.cpp:

(WebKit::PageClientImpl::requestDOMPasteAccess):

  • WebProcess/WebCoreSupport/WebEditorClient.h:
  • WebProcess/WebCoreSupport/WebEditorClient.cpp:

(WebKit::WebEditorClient::requestDOMPasteAccess):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::requestDOMPasteAccess):
Pass along the DOMPasteAccessCategory.

  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::pasteAccessCategoryForCommand): Added.
(WebKit::WebPageProxy::executeEditCommand):
(WebKit::WebPageProxy::requestDOMPasteAccess):
(WebKit::WebPageProxy::willPerformPasteCommand):
(WebKit::isPasteCommandName): Deleted.

  • UIProcess/ios/WebPageProxyIOS.mm:

(WebKit::WebPageProxy::willPerformPasteCommand):

  • UIProcess/mac/WebPageProxyMac.mm:

(WebKit::WebPageProxy::willPerformPasteCommand)
Create a mapping between paste command name and DOMPasteAccessCategory.

Source/WebKitLegacy/mac:

  • WebCoreSupport/WebEditorClient.h:

(WebEditorClient::requestDOMPasteAccess):

Source/WebKitLegacy/win:

  • WebCoreSupport/WebEditorClient.h:

(WebEditorClient::requestDOMPasteAccess):

Location:
trunk/Source
Files:
40 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r286824 r286825  
     12021-12-09  Devin Rousso  <drousso@apple.com>
     2
     3        Add a `DOMPasteAccessCategory` to control which pasteboard the WebProcess is granted access to when pasting
     4        https://bugs.webkit.org/show_bug.cgi?id=233939
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        Implementing `-pasteFont:` <https://webkit.org/b/191379> requires that we read from the font
     9        pasteboard instead of the general pasteboard. In order to allow web content to trigger this
     10        (e.g. `document.execCommand("PasteFont"))`) we must have a way for the WebProcess to signal
     11        that it wishes to read from the font pasteboard instead of the general pasteboard. As such,
     12        create and pass along a `DOMPasteAccessCategory` to `requestDOMPasteAccess`.
     13
     14        No change in behavior.
     15
     16        * dom/DOMPasteAccess.h:
     17        Create `DOMPasteAccessCategory`.
     18
     19        * page/EditorClient.h:
     20        * page/Frame.h:
     21        * page/Frame.cpp:
     22        (WebCore::Frame::requestDOMPasteAccess):
     23        * loader/EmptyClients.cpp:
     24        (WebCore::EmptyEditorClient::requestDOMPasteAccess):
     25        Pass along the `DOMPasteAccessCategory`.
     26
    1272021-12-09  Said Abou-Hallawa  <said@apple.com>
    228
  • trunk/Source/WebCore/dom/DOMPasteAccess.h

    r286705 r286825  
    3030namespace WebCore {
    3131
     32enum class DOMPasteAccessCategory : uint8_t {
     33    General,
     34};
     35
    3236enum class DOMPasteAccessPolicy : uint8_t {
    3337    NotRequestedYet,
     
    4650namespace WTF {
    4751
     52template<> struct EnumTraits<WebCore::DOMPasteAccessCategory> {
     53    using values = EnumValues<
     54        WebCore::DOMPasteAccessCategory,
     55        WebCore::DOMPasteAccessCategory::General
     56    >;
     57};
     58
    4859template<> struct EnumTraits<WebCore::DOMPasteAccessResponse> {
    4960    using values = EnumValues<
  • trunk/Source/WebCore/loader/EmptyClients.cpp

    r286705 r286825  
    287287    void clearUndoRedoOperations() final { }
    288288
    289     DOMPasteAccessResponse requestDOMPasteAccess(const String&) final { return DOMPasteAccessResponse::DeniedForGesture; }
     289    DOMPasteAccessResponse requestDOMPasteAccess(DOMPasteAccessCategory, const String&) final { return DOMPasteAccessResponse::DeniedForGesture; }
    290290
    291291    bool canCopyCut(Frame*, bool defaultValue) const final { return defaultValue; }
  • trunk/Source/WebCore/page/EditorClient.h

    r286705 r286825  
    3737namespace WebCore {
    3838
     39enum class DOMPasteAccessCategory : uint8_t;
    3940enum class DOMPasteAccessResponse : uint8_t;
    4041
     
    102103    virtual void handleAcceptedCandidateWithSoftSpaces(TextCheckingResult) { }
    103104
    104     virtual DOMPasteAccessResponse requestDOMPasteAccess(const String& originIdentifier) = 0;
     105    virtual DOMPasteAccessResponse requestDOMPasteAccess(DOMPasteAccessCategory, const String& originIdentifier) = 0;
    105106
    106107    // Notify an input method that a composition was voluntarily discarded by WebCore, so that it could clean up too.
  • trunk/Source/WebCore/page/Frame.cpp

    r286705 r286825  
    562562#endif // PLATFORM(IOS_FAMILY)
    563563
    564 bool Frame::requestDOMPasteAccess()
     564bool Frame::requestDOMPasteAccess(DOMPasteAccessCategory pasteAccessCategory)
    565565{
    566566    if (m_settings->javaScriptCanAccessClipboard() && m_settings->domPasteAllowed())
     
    590590            return false;
    591591
    592         auto response = client->requestDOMPasteAccess(m_doc->originIdentifierForPasteboard());
     592        auto response = client->requestDOMPasteAccess(pasteAccessCategory, m_doc->originIdentifierForPasteboard());
    593593        gestureToken->didRequestDOMPasteAccess(response);
    594594        switch (response) {
  • trunk/Source/WebCore/page/Frame.h

    r286705 r286825  
    177177    void setHasHadUserInteraction() { m_hasHadUserInteraction = true; }
    178178
    179     bool requestDOMPasteAccess();
     179    bool requestDOMPasteAccess(DOMPasteAccessCategory = DOMPasteAccessCategory::General);
    180180
    181181    String debugDescription() const;
  • trunk/Source/WebKit/ChangeLog

    r286824 r286825  
     12021-12-09  Devin Rousso  <drousso@apple.com>
     2
     3        Add a `DOMPasteAccessCategory` to control which pasteboard the WebProcess is granted access to when pasting
     4        https://bugs.webkit.org/show_bug.cgi?id=233939
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        Implementing `-pasteFont:` <https://webkit.org/b/191379> requires that we read from the font
     9        pasteboard instead of the general pasteboard. In order to allow web content to trigger this
     10        (e.g. `document.execCommand("PasteFont"))`) we must have a way for the WebProcess to signal
     11        that it wishes to read from the font pasteboard instead of the general pasteboard. As such,
     12        create and pass along a `DOMPasteAccessCategory` to `requestDOMPasteAccess`.
     13
     14        No change in behavior.
     15
     16        * Scripts/webkit/messages.py:
     17        (headers_for_type):
     18        Indicate which header is associated with `DOMPasteAccessCategory`.
     19
     20        * UIProcess/Cocoa/WebViewImpl.h:
     21        * UIProcess/Cocoa/WebViewImpl.mm:
     22        (-[WKDOMPasteMenuDelegate initWithWebViewImpl:pasteAccessCategory:]): Added.
     23        (-[WKDOMPasteMenuDelegate menuDidClose:]):
     24        (-[WKDOMPasteMenuDelegate _web_grantDOMPasteAccess]): Added.
     25        (WebKit::WebViewImpl::handleProcessSwapOrExit):
     26        (WebKit::pasteboardNameForAccessCategory): Added.
     27        (WebKit::pasteboardForAccessCategory): Added.
     28        (WebKit::WebViewImpl::requestDOMPasteAccess):
     29        (WebKit::WebViewImpl::handleDOMPasteRequestForCategoryWithResult):
     30        (WebKit::WebViewImpl::hideDOMPasteMenuWithResult): Added.
     31        (-[WKDOMPasteMenuDelegate initWithWebViewImpl:]): Deleted.
     32        (WebKit::WebViewImpl::handleDOMPasteRequestWithResult): Deleted.
     33        * UIProcess/API/mac/WKView.mm:
     34        (-[WKView _web_grantDOMPasteAccess]): Deleted.
     35        * UIProcess/API/mac/WKWebViewMac.mm:
     36        (-[WKWebView _web_grantDOMPasteAccess]): Deleted.
     37        Pass the `DOMPasteAccessCategory` to the `WKDOMPasteMenuDelegate` and use it as the `target`
     38        of the `NSMenuItem` so that we can pass along the `DOMPasteAccessCategory` in the `action`.
     39
     40        * UIProcess/ios/WKContentViewInteraction.h:
     41        * UIProcess/ios/WKContentViewInteraction.mm:
     42        (pasteboardNameForAccessCategory): Added.
     43        (pasteboardForAccessCategory): Added.
     44        (-[WKContentView _handleDOMPasteRequestWithResult:]):
     45        (-[WKContentView _requestDOMPasteAccessForCategory:elementRect:originIdentifier:completionHandler:]): Added.
     46        (-[WKContentView _requestDOMPasteAccessWithElementRect:originIdentifier:completionHandler:]): Deleted.
     47        * UIProcess/PageClient.h:
     48        * UIProcess/API/gtk/PageClientImpl.h:
     49        * UIProcess/API/gtk/PageClientImpl.cpp:
     50        (WebKit::PageClientImpl::requestDOMPasteAccess):
     51        * UIProcess/API/wpe/PageClientImpl.h:
     52        * UIProcess/API/wpe/PageClientImpl.cpp:
     53        (WebKit::PageClientImpl::requestDOMPasteAccess):
     54        * UIProcess/ios/PageClientImplIOS.h:
     55        * UIProcess/ios/PageClientImplIOS.mm:
     56        (WebKit::PageClientImpl::requestDOMPasteAccess):
     57        * UIProcess/mac/PageClientImplMac.h:
     58        * UIProcess/mac/PageClientImplMac.mm:
     59        (WebKit::PageClientImpl::requestDOMPasteAccess):
     60        * UIProcess/playstation/PageClientImpl.h:
     61        * UIProcess/playstation/PageClientImpl.cpp:
     62        (WebKit::PageClientImpl::requestDOMPasteAccess):
     63        * UIProcess/win/PageClientImpl.h:
     64        * UIProcess/win/PageClientImpl.cpp:
     65        (WebKit::PageClientImpl::requestDOMPasteAccess):
     66        * WebProcess/WebCoreSupport/WebEditorClient.h:
     67        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
     68        (WebKit::WebEditorClient::requestDOMPasteAccess):
     69        * WebProcess/WebPage/WebPage.h:
     70        * WebProcess/WebPage/WebPage.cpp:
     71        (WebKit::WebPage::requestDOMPasteAccess):
     72        Pass along the `DOMPasteAccessCategory`.
     73
     74        * UIProcess/WebPageProxy.messages.in:
     75        * UIProcess/WebPageProxy.h:
     76        * UIProcess/WebPageProxy.cpp:
     77        (WebKit::pasteAccessCategoryForCommand): Added.
     78        (WebKit::WebPageProxy::executeEditCommand):
     79        (WebKit::WebPageProxy::requestDOMPasteAccess):
     80        (WebKit::WebPageProxy::willPerformPasteCommand):
     81        (WebKit::isPasteCommandName): Deleted.
     82        * UIProcess/ios/WebPageProxyIOS.mm:
     83        (WebKit::WebPageProxy::willPerformPasteCommand):
     84        * UIProcess/mac/WebPageProxyMac.mm:
     85        (WebKit::WebPageProxy::willPerformPasteCommand)
     86        Create a mapping between paste command name and `DOMPasteAccessCategory`.
     87
    1882021-12-09  Said Abou-Hallawa  <said@apple.com>
    289
  • trunk/Source/WebKit/Scripts/webkit/messages.py

    r286705 r286825  
    759759        'WebCore::CompositeOperator': ['<WebCore/GraphicsTypes.h>'],
    760760        'WebCore::CreateNewGroupForHighlight': ['<WebCore/AppHighlight.h>'],
     761        'WebCore::DOMPasteAccessCategory': ['<WebCore/DOMPasteAccess.h>'],
    761762        'WebCore::DOMPasteAccessResponse': ['<WebCore/DOMPasteAccess.h>'],
    762763        'WebCore::DestinationColorSpace': ['<WebCore/ColorSpace.h>'],
  • trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp

    r286705 r286825  
    549549#endif
    550550
    551 void PageClientImpl::requestDOMPasteAccess(const IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
     551void PageClientImpl::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
    552552{
    553553    completionHandler(WebCore::DOMPasteAccessResponse::DeniedForGesture);
  • trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h

    r286705 r286825  
    161161    void isPlayingAudioDidChange() final { }
    162162
    163     void requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
     163    void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
    164164
    165165#if ENABLE(VIDEO) && USE(GSTREAMER)
  • trunk/Source/WebKit/UIProcess/API/mac/WKView.mm

    r286705 r286825  
    913913}
    914914
    915 - (void)_web_grantDOMPasteAccess
    916 {
    917     _data->_impl->handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::GrantedForGesture);
    918 }
    919 
    920915- (void)maybeInstallIconLoadingClient
    921916{
  • trunk/Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm

    r286705 r286825  
    12331233}
    12341234
    1235 - (void)_web_grantDOMPasteAccess
    1236 {
    1237     _impl->handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::GrantedForGesture);
    1238 }
    1239 
    12401235- (void)_takeFindStringFromSelectionInternal:(id)sender
    12411236{
  • trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp

    r286705 r286825  
    416416#endif // ENABLE(FULLSCREEN_API)
    417417
    418 void PageClientImpl::requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
     418void PageClientImpl::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
    419419{
    420420    completionHandler(WebCore::DOMPasteAccessResponse::DeniedForGesture);
  • trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h

    r286705 r286825  
    3737
    3838namespace WebCore {
     39enum class DOMPasteAccessCategory : uint8_t;
    3940enum class DOMPasteAccessResponse : uint8_t;
    4041}
     
    159160
    160161    IPC::Attachment hostFileDescriptor() final;
    161     void requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
     162    void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
    162163
    163164    WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override;
  • trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h

    r286705 r286825  
    136136#endif
    137137
    138 - (void)_web_grantDOMPasteAccess;
    139 
    140138@optional
    141139- (void)_web_didAddMediaControlsManager:(id)controlsManager;
     
    653651    void clearPromisedDragImage();
    654652
    655     void requestDOMPasteAccess(const WebCore::IntRect&, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&);
    656     void handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse);
     653    void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&);
     654    void handleDOMPasteRequestForCategoryWithResult(WebCore::DOMPasteAccessCategory, WebCore::DOMPasteAccessResponse);
    657655    NSMenu *domPasteMenu() const { return m_domPasteMenu.get(); }
     656    void hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse);
    658657
    659658#if HAVE(TRANSLATION_UI_SERVICES) && ENABLE(CONTEXT_MENUS)
  • trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm

    r286705 r286825  
    10081008
    10091009@interface WKDOMPasteMenuDelegate : NSObject<NSMenuDelegate>
    1010 - (instancetype)initWithWebViewImpl:(WebKit::WebViewImpl&)impl;
     1010- (instancetype)initWithWebViewImpl:(WebKit::WebViewImpl&)impl pasteAccessCategory:(WebCore::DOMPasteAccessCategory)category;
    10111011@end
    10121012
    10131013@implementation WKDOMPasteMenuDelegate {
    10141014    WeakPtr<WebKit::WebViewImpl> _impl;
    1015 }
    1016 
    1017 - (instancetype)initWithWebViewImpl:(WebKit::WebViewImpl&)impl
     1015    WebCore::DOMPasteAccessCategory _category;
     1016}
     1017
     1018- (instancetype)initWithWebViewImpl:(WebKit::WebViewImpl&)impl pasteAccessCategory:(WebCore::DOMPasteAccessCategory)category
    10181019{
    10191020    if (!(self = [super init]))
     
    10211022
    10221023    _impl = impl;
     1024    _category = category;
    10231025    return self;
    10241026}
     
    10281030    RunLoop::main().dispatch([impl = _impl] {
    10291031        if (impl)
    1030             impl->handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);
     1032            impl->hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);
    10311033    });
    10321034}
     
    10421044    confinementRect.move(0, -confinementRect.height());
    10431045    return confinementRect;
     1046}
     1047
     1048- (void)_web_grantDOMPasteAccess
     1049{
     1050    _impl->handleDOMPasteRequestForCategoryWithResult(_category, WebCore::DOMPasteAccessResponse::GrantedForGesture);
    10441051}
    10451052
     
    16041611    updateRemoteAccessibilityRegistration(false);
    16051612
    1606     handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);
     1613    hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);
    16071614}
    16081615
     
    45794586}
    45804587
    4581 void WebViewImpl::requestDOMPasteAccess(const WebCore::IntRect&, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completion)
     4588static NSPasteboardName pasteboardNameForAccessCategory(WebCore::DOMPasteAccessCategory pasteAccessCategory)
     4589{
     4590    switch (pasteAccessCategory) {
     4591    case WebCore::DOMPasteAccessCategory::General:
     4592        return NSPasteboardNameGeneral;
     4593    }
     4594}
     4595
     4596static NSPasteboard *pasteboardForAccessCategory(WebCore::DOMPasteAccessCategory pasteAccessCategory)
     4597{
     4598    switch (pasteAccessCategory) {
     4599    case WebCore::DOMPasteAccessCategory::General:
     4600        return NSPasteboard.generalPasteboard;
     4601    }
     4602}
     4603
     4604void WebViewImpl::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory pasteAccessCategory, const WebCore::IntRect&, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completion)
    45824605{
    45834606    ASSERT(!m_domPasteRequestHandler);
    4584     handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);
    4585 
    4586     NSData *data = [NSPasteboard.generalPasteboard dataForType:@(WebCore::PasteboardCustomData::cocoaType())];
     4607    hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);
     4608
     4609    NSData *data = [pasteboardForAccessCategory(pasteAccessCategory) dataForType:@(WebCore::PasteboardCustomData::cocoaType())];
    45874610    auto buffer = WebCore::SharedBuffer::create(data);
    45884611    if (WebCore::PasteboardCustomData::fromSharedBuffer(buffer.get()).origin() == originIdentifier) {
    4589         m_page->grantAccessToCurrentPasteboardData(NSPasteboardNameGeneral);
     4612        m_page->grantAccessToCurrentPasteboardData(pasteboardNameForAccessCategory(pasteAccessCategory));
    45904613        completion(WebCore::DOMPasteAccessResponse::GrantedForGesture);
    45914614        return;
    45924615    }
    45934616
    4594     m_domPasteMenuDelegate = adoptNS([[WKDOMPasteMenuDelegate alloc] initWithWebViewImpl:*this]);
     4617    m_domPasteMenuDelegate = adoptNS([[WKDOMPasteMenuDelegate alloc] initWithWebViewImpl:*this pasteAccessCategory:pasteAccessCategory]);
    45954618    m_domPasteRequestHandler = WTFMove(completion);
    45964619    m_domPasteMenu = adoptNS([[NSMenu alloc] initWithTitle:WebCore::contextMenuItemTagPaste()]);
     
    45984621    [m_domPasteMenu setDelegate:m_domPasteMenuDelegate.get()];
    45994622    [m_domPasteMenu setAllowsContextMenuPlugIns:NO];
    4600     [m_domPasteMenu insertItemWithTitle:WebCore::contextMenuItemTagPaste() action:@selector(_web_grantDOMPasteAccess) keyEquivalent:emptyString() atIndex:0];
     4623
     4624    auto pasteMenuItem = RetainPtr([m_domPasteMenu insertItemWithTitle:WebCore::contextMenuItemTagPaste() action:@selector(_web_grantDOMPasteAccess) keyEquivalent:emptyString() atIndex:0]);
     4625    [pasteMenuItem setTarget:m_domPasteMenuDelegate.get()];
     4626
    46014627    [NSMenu popUpContextMenu:m_domPasteMenu.get() withEvent:m_lastMouseDownEvent.get() forView:m_view.getAutoreleased()];
    46024628}
    46034629
    4604 void WebViewImpl::handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse response)
     4630void WebViewImpl::handleDOMPasteRequestForCategoryWithResult(WebCore::DOMPasteAccessCategory pasteAccessCategory, WebCore::DOMPasteAccessResponse response)
    46054631{
    46064632    if (response == WebCore::DOMPasteAccessResponse::GrantedForCommand || response == WebCore::DOMPasteAccessResponse::GrantedForGesture)
    4607         m_page->grantAccessToCurrentPasteboardData(NSPasteboardNameGeneral);
    4608 
     4633        m_page->grantAccessToCurrentPasteboardData(pasteboardNameForAccessCategory(pasteAccessCategory));
     4634
     4635    hideDOMPasteMenuWithResult(response);
     4636}
     4637
     4638void WebViewImpl::hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse response)
     4639{
    46094640    if (auto handler = std::exchange(m_domPasteRequestHandler, { }))
    46104641        handler(response);
  • trunk/Source/WebKit/UIProcess/PageClient.h

    r286705 r286825  
    111111enum class TextIndicatorLifetime : uint8_t;
    112112enum class TextIndicatorDismissalAnimation : uint8_t;
     113enum class DOMPasteAccessCategory : uint8_t;
    113114enum class DOMPasteAccessResponse : uint8_t;
    114115enum class ScrollIsAnimated : uint8_t;
     
    600601#endif
    601602
    602     virtual void requestDOMPasteAccess(const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) = 0;
     603    virtual void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) = 0;
    603604
    604605#if ENABLE(ATTACHMENT_ELEMENT)
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r286815 r286825  
    25112511}
    25122512
    2513 static bool isPasteCommandName(const String& commandName)
    2514 {
    2515     static NeverDestroyed<HashSet<String, ASCIICaseInsensitiveHash>> pasteCommandNames = HashSet<String, ASCIICaseInsensitiveHash> {
    2516         "Paste",
    2517         "PasteAndMatchStyle",
    2518         "PasteAsQuotation",
    2519         "PasteAsPlainText"
     2513static std::optional<DOMPasteAccessCategory> pasteAccessCategoryForCommand(const String& commandName)
     2514{
     2515    static NeverDestroyed<HashMap<String, DOMPasteAccessCategory, ASCIICaseInsensitiveHash>> pasteCommandNames = HashMap<String, DOMPasteAccessCategory, ASCIICaseInsensitiveHash> {
     2516        { "Paste", DOMPasteAccessCategory::General },
     2517        { "PasteAndMatchStyle", DOMPasteAccessCategory::General },
     2518        { "PasteAsQuotation", DOMPasteAccessCategory::General },
     2519        { "PasteAsPlainText", DOMPasteAccessCategory::General },
    25202520    };
    2521     return pasteCommandNames->contains(commandName);
     2521
     2522    auto it = pasteCommandNames->find(commandName);
     2523    if (it != pasteCommandNames->end())
     2524        return it->value;
     2525
     2526    return std::nullopt;
    25222527}
    25232528
     
    25292534    }
    25302535
    2531     if (isPasteCommandName(commandName))
    2532         willPerformPasteCommand();
     2536    if (auto pasteAccessCategory = pasteAccessCategoryForCommand(commandName))
     2537        willPerformPasteCommand(*pasteAccessCategory);
    25332538
    25342539    sendWithAsyncReply(Messages::WebPage::ExecuteEditCommandWithCallback(commandName, argument), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::executeEditCommand"_s)] () mutable {
     
    25442549        return;
    25452550
    2546     if (isPasteCommandName(commandName))
    2547         willPerformPasteCommand();
     2551    if (auto pasteAccessCategory = pasteAccessCategoryForCommand(commandName))
     2552        willPerformPasteCommand(*pasteAccessCategory);
    25482553
    25492554    if (commandName == ignoreSpellingCommandName)
     
    66176622#endif
    66186623
    6619 void WebPageProxy::requestDOMPasteAccess(const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
    6620 {
    6621     m_pageClient->requestDOMPasteAccess(elementRect, originIdentifier, WTFMove(completionHandler));
     6624void WebPageProxy::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory pasteAccessCategory, const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
     6625{
     6626    m_pageClient->requestDOMPasteAccess(pasteAccessCategory, elementRect, originIdentifier, WTFMove(completionHandler));
    66226627}
    66236628
     
    1082310828#if !PLATFORM(COCOA)
    1082410829
    10825 void WebPageProxy::willPerformPasteCommand()
     10830void WebPageProxy::willPerformPasteCommand(DOMPasteAccessCategory)
    1082610831{
    1082710832}
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r286751 r286825  
    268268enum class CookieConsentDecisionResult : uint8_t;
    269269enum class CreateNewGroupForHighlight : bool;
     270enum class DOMPasteAccessCategory : uint8_t;
    270271enum class DOMPasteAccessResponse : uint8_t;
    271272enum class EventMakesGamepadsVisible : bool;
     
    22622263#endif
    22632264
    2264     void requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&);
    2265     void willPerformPasteCommand();
     2265    void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&);
     2266    void willPerformPasteCommand(WebCore::DOMPasteAccessCategory);
    22662267
    22672268    // Back/Forward list management
  • trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in

    r286705 r286825  
    233233#endif
    234234
    235     RequestDOMPasteAccess(WebCore::IntRect elementRect, String originIdentifier) -> (enum:uint8_t WebCore::DOMPasteAccessResponse response) Synchronous
     235    RequestDOMPasteAccess(enum:uint8_t WebCore::DOMPasteAccessCategory pasteAccessCategory, WebCore::IntRect elementRect, String originIdentifier) -> (enum:uint8_t WebCore::DOMPasteAccessResponse response) Synchronous
    236236
    237237    # Find messages
  • trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h

    r286705 r286825  
    3939
    4040namespace WebCore {
     41enum class DOMPasteAccessCategory : uint8_t;
    4142enum class DOMPasteAccessResponse : uint8_t;
    4243struct PromisedAttachmentInfo;
     
    267268#endif
    268269
    269     void requestDOMPasteAccess(const WebCore::IntRect& elementRect, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
     270    void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect& elementRect, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
    270271
    271272#if ENABLE(DRAG_SUPPORT)
  • trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm

    r286705 r286825  
    952952#endif
    953953
    954 void PageClientImpl::requestDOMPasteAccess(const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
    955 {
    956     [m_contentView _requestDOMPasteAccessWithElementRect:elementRect originIdentifier:originIdentifier completionHandler:WTFMove(completionHandler)];
     954void PageClientImpl::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory pasteAccessCategory, const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
     955{
     956    [m_contentView _requestDOMPasteAccessForCategory:pasteAccessCategory elementRect:elementRect originIdentifier:originIdentifier completionHandler:WTFMove(completionHandler)];
    957957}
    958958
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r286823 r286825  
    9191struct ShareDataWithParsedURL;
    9292struct TextRecognitionResult;
     93enum class DOMPasteAccessCategory : uint8_t;
    9394enum class DOMPasteAccessResponse : uint8_t;
    9495enum class MouseEventPolicy : uint8_t;
     
    460461    NSInteger _suppressNonEditableSingleTapTextInteractionCount;
    461462    CompletionHandler<void(WebCore::DOMPasteAccessResponse)> _domPasteRequestHandler;
     463    std::optional<WebCore::DOMPasteAccessCategory> _domPasteRequestCategory;
    462464    BlockPtr<void(UIWKAutocorrectionContext *)> _pendingAutocorrectionContextHandler;
    463465    CompletionHandler<void()> _pendingRunModalJavaScriptDialogCallback;
     
    679681- (void)updateFocusedElementFocusedWithDataListDropdown:(BOOL)value;
    680682
    681 - (void)_requestDOMPasteAccessWithElementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler;
     683- (void)_requestDOMPasteAccessForCategory:(WebCore::DOMPasteAccessCategory)pasteAccessCategory elementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler;
    682684
    683685- (void)doAfterPositionInformationUpdate:(void (^)(WebKit::InteractionInformationAtPosition))action forRequest:(WebKit::InteractionInformationRequest)request;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r286823 r286825  
    41654165}
    41664166
     4167static UIPasteboardName pasteboardNameForAccessCategory(WebCore::DOMPasteAccessCategory pasteAccessCategory)
     4168{
     4169    switch (pasteAccessCategory) {
     4170    case WebCore::DOMPasteAccessCategory::General:
     4171        return UIPasteboardNameGeneral;
     4172    }
     4173}
     4174
     4175static UIPasteboard *pasteboardForAccessCategory(WebCore::DOMPasteAccessCategory pasteAccessCategory)
     4176{
     4177    switch (pasteAccessCategory) {
     4178    case WebCore::DOMPasteAccessCategory::General:
     4179        return UIPasteboard.generalPasteboard;
     4180    }
     4181}
     4182
    41674183- (BOOL)_handleDOMPasteRequestWithResult:(WebCore::DOMPasteAccessResponse)response
    41684184{
    4169     if (response == WebCore::DOMPasteAccessResponse::GrantedForCommand || response == WebCore::DOMPasteAccessResponse::GrantedForGesture)
    4170         _page->grantAccessToCurrentPasteboardData(UIPasteboardNameGeneral);
     4185    if (auto pasteAccessCategory = std::exchange(_domPasteRequestCategory, std::nullopt)) {
     4186        if (response == WebCore::DOMPasteAccessResponse::GrantedForCommand || response == WebCore::DOMPasteAccessResponse::GrantedForGesture)
     4187            _page->grantAccessToCurrentPasteboardData(pasteboardNameForAccessCategory(*pasteAccessCategory));
     4188    }
    41714189
    41724190    if (auto pasteHandler = WTFMove(_domPasteRequestHandler)) {
     
    66366654}
    66376655
    6638 - (void)_requestDOMPasteAccessWithElementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler
     6656- (void)_requestDOMPasteAccessForCategory:(WebCore::DOMPasteAccessCategory)pasteAccessCategory elementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler
    66396657{
    66406658    if (auto existingCompletionHandler = std::exchange(_domPasteRequestHandler, WTFMove(completionHandler))) {
     
    66436661    }
    66446662
    6645     if (allPasteboardItemOriginsMatchOrigin(UIPasteboard.generalPasteboard, originIdentifier)) {
     6663    _domPasteRequestCategory = pasteAccessCategory;
     6664
     6665    if (allPasteboardItemOriginsMatchOrigin(pasteboardForAccessCategory(pasteAccessCategory), originIdentifier)) {
    66466666        [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::GrantedForCommand];
    66476667        return;
  • trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm

    r286705 r286825  
    15451545#endif
    15461546
    1547 void WebPageProxy::willPerformPasteCommand()
    1548 {
    1549     grantAccessToCurrentPasteboardData(UIPasteboardNameGeneral);
     1547void WebPageProxy::willPerformPasteCommand(DOMPasteAccessCategory pasteAccessCategory)
     1548{
     1549    switch (pasteAccessCategory) {
     1550    case DOMPasteAccessCategory::General:
     1551        grantAccessToCurrentPasteboardData(UIPasteboardNameGeneral);
     1552        return;
     1553    }
    15501554}
    15511555
  • trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h

    r286705 r286825  
    226226    void didRemoveNavigationGestureSnapshot() override;
    227227
    228     void requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
     228    void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
    229229
    230230    void makeViewBlank(bool) final;
  • trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm

    r286705 r286825  
    10011001}
    10021002
    1003 void PageClientImpl::requestDOMPasteAccess(const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completion)
    1004 {
    1005     m_impl->requestDOMPasteAccess(elementRect, originIdentifier, WTFMove(completion));
     1003void PageClientImpl::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory pasteAccessCategory, const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completion)
     1004{
     1005    m_impl->requestDOMPasteAccess(pasteAccessCategory, elementRect, originIdentifier, WTFMove(completion));
    10061006}
    10071007
  • trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm

    r286815 r286825  
    652652#endif
    653653
    654 void WebPageProxy::willPerformPasteCommand()
    655 {
    656     grantAccessToCurrentPasteboardData(NSPasteboardNameGeneral);
     654void WebPageProxy::willPerformPasteCommand(DOMPasteAccessCategory pasteAccessCategory)
     655{
     656    switch (pasteAccessCategory) {
     657    case DOMPasteAccessCategory::General:
     658        grantAccessToCurrentPasteboardData(NSPasteboardNameGeneral);
     659        return;
     660    }
    657661}
    658662
  • trunk/Source/WebKit/UIProcess/playstation/PageClientImpl.cpp

    r286705 r286825  
    318318}
    319319
    320 void PageClientImpl::requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
     320void PageClientImpl::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
    321321{
    322322    completionHandler(WebCore::DOMPasteAccessResponse::DeniedForGesture);
  • trunk/Source/WebKit/UIProcess/playstation/PageClientImpl.h

    r286705 r286825  
    150150    WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override;
    151151
    152     void requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) override;
     152    void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) override;
    153153
    154154    PlayStationWebView& m_view;
  • trunk/Source/WebKit/UIProcess/win/PageClientImpl.cpp

    r286705 r286825  
    374374}
    375375
    376 void PageClientImpl::requestDOMPasteAccess(const IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
     376void PageClientImpl::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
    377377{
    378378    completionHandler(WebCore::DOMPasteAccessResponse::DeniedForGesture);
  • trunk/Source/WebKit/UIProcess/win/PageClientImpl.h

    r286705 r286825  
    3636
    3737namespace WebCore {
     38enum class DOMPasteAccessCategory : uint8_t;
    3839enum class DOMPasteAccessResponse : uint8_t;
    3940}
     
    149150    WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override { return WebCore::UserInterfaceLayoutDirection::LTR; }
    150151
    151     void requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
     152    void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
    152153
    153154    // Members of PageClientImpl class
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp

    r286705 r286825  
    333333}
    334334
    335 WebCore::DOMPasteAccessResponse WebEditorClient::requestDOMPasteAccess(const String& originIdentifier)
    336 {
    337     return m_page->requestDOMPasteAccess(originIdentifier);
     335WebCore::DOMPasteAccessResponse WebEditorClient::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory pasteAccessCategory, const String& originIdentifier)
     336{
     337    return m_page->requestDOMPasteAccess(pasteAccessCategory, originIdentifier);
    338338}
    339339
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h

    r286705 r286825  
    3030
    3131namespace WebCore {
     32enum class DOMPasteAccessCategory : uint8_t;
    3233enum class DOMPasteAccessResponse : uint8_t;
    3334}
     
    9495    void clearUndoRedoOperations() final;
    9596
    96     WebCore::DOMPasteAccessResponse requestDOMPasteAccess(const String& originIdentifier) final;
     97    WebCore::DOMPasteAccessResponse requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const String& originIdentifier) final;
    9798
    9899    bool canCopyCut(WebCore::Frame*, bool defaultValue) const final;
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r286815 r286825  
    72087208}
    72097209
    7210 WebCore::DOMPasteAccessResponse WebPage::requestDOMPasteAccess(const String& originIdentifier)
     7210WebCore::DOMPasteAccessResponse WebPage::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory pasteAccessCategory, const String& originIdentifier)
    72117211{
    72127212    auto response = WebCore::DOMPasteAccessResponse::DeniedForGesture;
     
    72187218    send(Messages::WebPageProxy::HandleAutocorrectionContext(autocorrectionContext()));
    72197219#endif
    7220     sendSyncWithDelayedReply(Messages::WebPageProxy::RequestDOMPasteAccess(rectForElementAtInteractionLocation(), originIdentifier), Messages::WebPageProxy::RequestDOMPasteAccess::Reply(response));
     7220    sendSyncWithDelayedReply(Messages::WebPageProxy::RequestDOMPasteAccess(pasteAccessCategory, rectForElementAtInteractionLocation(), originIdentifier), Messages::WebPageProxy::RequestDOMPasteAccess::Reply(response));
    72217221    return response;
    72227222}
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r286812 r286825  
    225225enum class COEPDisposition : bool;
    226226enum class CreateNewGroupForHighlight : bool;
     227enum class DOMPasteAccessCategory : uint8_t;
    227228enum class DOMPasteAccessResponse : uint8_t;
    228229enum class DragApplicationFlags : uint8_t;
     
    13411342    }
    13421343
    1343     WebCore::DOMPasteAccessResponse requestDOMPasteAccess(const String& originIdentifier);
     1344    WebCore::DOMPasteAccessResponse requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const String& originIdentifier);
    13441345    WebCore::IntRect rectForElementAtInteractionLocation() const;
    13451346
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r286772 r286825  
     12021-12-09  Devin Rousso  <drousso@apple.com>
     2
     3        Add a `DOMPasteAccessCategory` to control which pasteboard the WebProcess is granted access to when pasting
     4        https://bugs.webkit.org/show_bug.cgi?id=233939
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        Implementing `-pasteFont:` <https://webkit.org/b/191379> requires that we read from the font
     9        pasteboard instead of the general pasteboard. In order to allow web content to trigger this
     10        (e.g. `document.execCommand("PasteFont"))`) we must have a way for the WebProcess to signal
     11        that it wishes to read from the font pasteboard instead of the general pasteboard. As such,
     12        create and pass along a `DOMPasteAccessCategory` to `requestDOMPasteAccess`.
     13
     14        No change in behavior.
     15
     16        * WebCoreSupport/WebEditorClient.h:
     17        (WebEditorClient::requestDOMPasteAccess):
     18
    1192021-12-09  Myles C. Maxfield  <mmaxfield@apple.com> and Don Olmstead  <don.olmstead@sony.com>
    220
  • trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h

    r286705 r286825  
    8484
    8585    void setInsertionPasteboard(const String&) final;
    86     WebCore::DOMPasteAccessResponse requestDOMPasteAccess(const String&) final { return WebCore::DOMPasteAccessResponse::DeniedForGesture; }
     86    WebCore::DOMPasteAccessResponse requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const String&) final { return WebCore::DOMPasteAccessResponse::DeniedForGesture; }
    8787
    8888#if USE(APPKIT)
  • trunk/Source/WebKitLegacy/win/ChangeLog

    r286772 r286825  
     12021-12-09  Devin Rousso  <drousso@apple.com>
     2
     3        Add a `DOMPasteAccessCategory` to control which pasteboard the WebProcess is granted access to when pasting
     4        https://bugs.webkit.org/show_bug.cgi?id=233939
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        Implementing `-pasteFont:` <https://webkit.org/b/191379> requires that we read from the font
     9        pasteboard instead of the general pasteboard. In order to allow web content to trigger this
     10        (e.g. `document.execCommand("PasteFont"))`) we must have a way for the WebProcess to signal
     11        that it wishes to read from the font pasteboard instead of the general pasteboard. As such,
     12        create and pass along a `DOMPasteAccessCategory` to `requestDOMPasteAccess`.
     13
     14        No change in behavior.
     15
     16        * WebCoreSupport/WebEditorClient.h:
     17        (WebEditorClient::requestDOMPasteAccess):
     18
    1192021-12-09  Myles C. Maxfield  <mmaxfield@apple.com> and Don Olmstead  <don.olmstead@sony.com>
    220
  • trunk/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h

    r286705 r286825  
    118118    bool performTwoStepDrop(WebCore::DocumentFragment&, const WebCore::SimpleRange&, bool) final { return false; }
    119119
    120     WebCore::DOMPasteAccessResponse requestDOMPasteAccess(const String&) final { return WebCore::DOMPasteAccessResponse::DeniedForGesture; }
     120    WebCore::DOMPasteAccessResponse requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const String&) final { return WebCore::DOMPasteAccessResponse::DeniedForGesture; }
    121121
    122122    WebCore::TextCheckerClient* textChecker() final { return this; }
Note: See TracChangeset for help on using the changeset viewer.