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

Changeset 286705 in webkit


Ignore:
Timestamp:
Dec 8, 2021, 12:34:03 PM (5 years ago)
Author:
Truitt Savell
Message:

Unreviewed, reverting r286632.

Broke 3 tests on iOS

Reverted changeset:

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

Location:
trunk/Source
Files:
40 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r286676 r286705  
     12021-12-08  Truitt Savell  <tsavell@apple.com>
     2
     3        Unreviewed, reverting r286632.
     4
     5        Broke 3 tests on iOS
     6
     7        Reverted changeset:
     8
     9        "Add a `DOMPasteAccessCategory` to control which pasteboard
     10        the WebProcess is granted access to when pasting"
     11        https://bugs.webkit.org/show_bug.cgi?id=233939
     12        https://commits.webkit.org/r286632
     13
    1142021-12-08  Philippe Normand  <pnormand@igalia.com>
    215
  • trunk/Source/WebCore/dom/DOMPasteAccess.h

    r286632 r286705  
    3030namespace WebCore {
    3131
    32 enum class DOMPasteAccessCategory : uint8_t {
    33     General,
    34 };
    35 
    3632enum class DOMPasteAccessPolicy : uint8_t {
    3733    NotRequestedYet,
     
    5046namespace WTF {
    5147
    52 template<> struct EnumTraits<WebCore::DOMPasteAccessCategory> {
    53     using values = EnumValues<
    54         WebCore::DOMPasteAccessCategory,
    55         WebCore::DOMPasteAccessCategory::General
    56     >;
    57 };
    58 
    5948template<> struct EnumTraits<WebCore::DOMPasteAccessResponse> {
    6049    using values = EnumValues<
  • trunk/Source/WebCore/loader/EmptyClients.cpp

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

    r286632 r286705  
    3737namespace WebCore {
    3838
    39 enum class DOMPasteAccessCategory : uint8_t;
    4039enum class DOMPasteAccessResponse : uint8_t;
    4140
     
    103102    virtual void handleAcceptedCandidateWithSoftSpaces(TextCheckingResult) { }
    104103
    105     virtual DOMPasteAccessResponse requestDOMPasteAccess(DOMPasteAccessCategory, const String& originIdentifier) = 0;
     104    virtual DOMPasteAccessResponse requestDOMPasteAccess(const String& originIdentifier) = 0;
    106105
    107106    // 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

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

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

    r286673 r286705  
     12021-12-08  Truitt Savell  <tsavell@apple.com>
     2
     3        Unreviewed, reverting r286632.
     4
     5        Broke 3 tests on iOS
     6
     7        Reverted changeset:
     8
     9        "Add a `DOMPasteAccessCategory` to control which pasteboard
     10        the WebProcess is granted access to when pasting"
     11        https://bugs.webkit.org/show_bug.cgi?id=233939
     12        https://commits.webkit.org/r286632
     13
    1142021-12-08  Per Arne Vollan  <pvollan@apple.com>
    215
  • trunk/Source/WebKit/Scripts/webkit/messages.py

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

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

    r286632 r286705  
    161161    void isPlayingAudioDidChange() final { }
    162162
    163     void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
     163    void requestDOMPasteAccess(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

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

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

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

    r286632 r286705  
    3737
    3838namespace WebCore {
    39 enum class DOMPasteAccessCategory : uint8_t;
    4039enum class DOMPasteAccessResponse : uint8_t;
    4140}
     
    160159
    161160    IPC::Attachment hostFileDescriptor() final;
    162     void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
     161    void requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
    163162
    164163    WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override;
  • trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h

    r286632 r286705  
    136136#endif
    137137
     138- (void)_web_grantDOMPasteAccess;
     139
    138140@optional
    139141- (void)_web_didAddMediaControlsManager:(id)controlsManager;
     
    651653    void clearPromisedDragImage();
    652654
    653     void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&);
    654     void handleDOMPasteRequestForCategoryWithResult(WebCore::DOMPasteAccessCategory, WebCore::DOMPasteAccessResponse);
     655    void requestDOMPasteAccess(const WebCore::IntRect&, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&);
     656    void handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse);
    655657    NSMenu *domPasteMenu() const { return m_domPasteMenu.get(); }
    656     void hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse);
    657658
    658659#if HAVE(TRANSLATION_UI_SERVICES) && ENABLE(CONTEXT_MENUS)
  • trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm

    r286632 r286705  
    10081008
    10091009@interface WKDOMPasteMenuDelegate : NSObject<NSMenuDelegate>
    1010 - (instancetype)initWithWebViewImpl:(WebKit::WebViewImpl&)impl pasteAccessCategory:(WebCore::DOMPasteAccessCategory)category;
     1010- (instancetype)initWithWebViewImpl:(WebKit::WebViewImpl&)impl;
    10111011@end
    10121012
    10131013@implementation WKDOMPasteMenuDelegate {
    10141014    WeakPtr<WebKit::WebViewImpl> _impl;
    1015     WebCore::DOMPasteAccessCategory _category;
    1016 }
    1017 
    1018 - (instancetype)initWithWebViewImpl:(WebKit::WebViewImpl&)impl pasteAccessCategory:(WebCore::DOMPasteAccessCategory)category
     1015}
     1016
     1017- (instancetype)initWithWebViewImpl:(WebKit::WebViewImpl&)impl
    10191018{
    10201019    if (!(self = [super init]))
     
    10221021
    10231022    _impl = impl;
    1024     _category = category;
    10251023    return self;
    10261024}
     
    10301028    RunLoop::main().dispatch([impl = _impl] {
    10311029        if (impl)
    1032             impl->hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);
     1030            impl->handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);
    10331031    });
    10341032}
     
    10441042    confinementRect.move(0, -confinementRect.height());
    10451043    return confinementRect;
    1046 }
    1047 
    1048 - (void)_web_grantDOMPasteAccess
    1049 {
    1050     _impl->handleDOMPasteRequestForCategoryWithResult(_category, WebCore::DOMPasteAccessResponse::GrantedForGesture);
    10511044}
    10521045
     
    16111604    updateRemoteAccessibilityRegistration(false);
    16121605
    1613     hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);
     1606    handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);
    16141607}
    16151608
     
    45864579}
    45874580
    4588 static NSPasteboardName pasteboardNameForAccessCategory(WebCore::DOMPasteAccessCategory pasteAccessCategory)
    4589 {
    4590     switch (pasteAccessCategory) {
    4591     case WebCore::DOMPasteAccessCategory::General:
    4592         return NSPasteboardNameGeneral;
    4593     }
    4594 }
    4595 
    4596 static NSPasteboard *pasteboardForAccessCategory(WebCore::DOMPasteAccessCategory pasteAccessCategory)
    4597 {
    4598     switch (pasteAccessCategory) {
    4599     case WebCore::DOMPasteAccessCategory::General:
    4600         return NSPasteboard.generalPasteboard;
    4601     }
    4602 }
    4603 
    4604 void WebViewImpl::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory pasteAccessCategory, const WebCore::IntRect&, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completion)
     4581void WebViewImpl::requestDOMPasteAccess(const WebCore::IntRect&, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completion)
    46054582{
    46064583    ASSERT(!m_domPasteRequestHandler);
    4607     hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);
    4608 
    4609     NSData *data = [pasteboardForAccessCategory(pasteAccessCategory) dataForType:@(WebCore::PasteboardCustomData::cocoaType())];
     4584    handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);
     4585
     4586    NSData *data = [NSPasteboard.generalPasteboard dataForType:@(WebCore::PasteboardCustomData::cocoaType())];
    46104587    auto buffer = WebCore::SharedBuffer::create(data);
    46114588    if (WebCore::PasteboardCustomData::fromSharedBuffer(buffer.get()).origin() == originIdentifier) {
    4612         m_page->grantAccessToCurrentPasteboardData(pasteboardNameForAccessCategory(pasteAccessCategory));
     4589        m_page->grantAccessToCurrentPasteboardData(NSPasteboardNameGeneral);
    46134590        completion(WebCore::DOMPasteAccessResponse::GrantedForGesture);
    46144591        return;
    46154592    }
    46164593
    4617     m_domPasteMenuDelegate = adoptNS([[WKDOMPasteMenuDelegate alloc] initWithWebViewImpl:*this pasteAccessCategory:pasteAccessCategory]);
     4594    m_domPasteMenuDelegate = adoptNS([[WKDOMPasteMenuDelegate alloc] initWithWebViewImpl:*this]);
    46184595    m_domPasteRequestHandler = WTFMove(completion);
    46194596    m_domPasteMenu = adoptNS([[NSMenu alloc] initWithTitle:WebCore::contextMenuItemTagPaste()]);
     
    46214598    [m_domPasteMenu setDelegate:m_domPasteMenuDelegate.get()];
    46224599    [m_domPasteMenu setAllowsContextMenuPlugIns:NO];
    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 
     4600    [m_domPasteMenu insertItemWithTitle:WebCore::contextMenuItemTagPaste() action:@selector(_web_grantDOMPasteAccess) keyEquivalent:emptyString() atIndex:0];
    46274601    [NSMenu popUpContextMenu:m_domPasteMenu.get() withEvent:m_lastMouseDownEvent.get() forView:m_view.getAutoreleased()];
    46284602}
    46294603
    4630 void WebViewImpl::handleDOMPasteRequestForCategoryWithResult(WebCore::DOMPasteAccessCategory pasteAccessCategory, WebCore::DOMPasteAccessResponse response)
     4604void WebViewImpl::handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse response)
    46314605{
    46324606    if (response == WebCore::DOMPasteAccessResponse::GrantedForCommand || response == WebCore::DOMPasteAccessResponse::GrantedForGesture)
    4633         m_page->grantAccessToCurrentPasteboardData(pasteboardNameForAccessCategory(pasteAccessCategory));
    4634 
    4635     hideDOMPasteMenuWithResult(response);
    4636 }
    4637 
    4638 void WebViewImpl::hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse response)
    4639 {
     4607        m_page->grantAccessToCurrentPasteboardData(NSPasteboardNameGeneral);
     4608
    46404609    if (auto handler = std::exchange(m_domPasteRequestHandler, { }))
    46414610        handler(response);
  • trunk/Source/WebKit/UIProcess/PageClient.h

    r286632 r286705  
    111111enum class TextIndicatorLifetime : uint8_t;
    112112enum class TextIndicatorDismissalAnimation : uint8_t;
    113 enum class DOMPasteAccessCategory : uint8_t;
    114113enum class DOMPasteAccessResponse : uint8_t;
    115114enum class ScrollIsAnimated : uint8_t;
     
    601600#endif
    602601
    603     virtual void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) = 0;
     602    virtual void requestDOMPasteAccess(const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) = 0;
    604603
    605604#if ENABLE(ATTACHMENT_ELEMENT)
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r286661 r286705  
    25112511}
    25122512
    2513 static 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 },
     2513static bool isPasteCommandName(const String& commandName)
     2514{
     2515    static NeverDestroyed<HashSet<String, ASCIICaseInsensitiveHash>> pasteCommandNames = HashSet<String, ASCIICaseInsensitiveHash> {
     2516        "Paste",
     2517        "PasteAndMatchStyle",
     2518        "PasteAsQuotation",
     2519        "PasteAsPlainText"
    25202520    };
    2521 
    2522     auto it = pasteCommandNames->find(commandName);
    2523     if (it != pasteCommandNames->end())
    2524         return it->value;
    2525 
    2526     return std::nullopt;
     2521    return pasteCommandNames->contains(commandName);
    25272522}
    25282523
     
    25342529    }
    25352530
    2536     if (auto pasteAccessCategory = pasteAccessCategoryForCommand(commandName))
    2537         willPerformPasteCommand(*pasteAccessCategory);
     2531    if (isPasteCommandName(commandName))
     2532        willPerformPasteCommand();
    25382533
    25392534    sendWithAsyncReply(Messages::WebPage::ExecuteEditCommandWithCallback(commandName, argument), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::executeEditCommand"_s)] () mutable {
     
    25492544        return;
    25502545
    2551     if (auto pasteAccessCategory = pasteAccessCategoryForCommand(commandName))
    2552         willPerformPasteCommand(*pasteAccessCategory);
     2546    if (isPasteCommandName(commandName))
     2547        willPerformPasteCommand();
    25532548
    25542549    if (commandName == ignoreSpellingCommandName)
     
    66176612#endif
    66186613
    6619 void WebPageProxy::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory pasteAccessCategory, const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
    6620 {
    6621     m_pageClient->requestDOMPasteAccess(pasteAccessCategory, elementRect, originIdentifier, WTFMove(completionHandler));
     6614void WebPageProxy::requestDOMPasteAccess(const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)
     6615{
     6616    m_pageClient->requestDOMPasteAccess(elementRect, originIdentifier, WTFMove(completionHandler));
    66226617}
    66236618
     
    1082010815#if !PLATFORM(COCOA)
    1082110816
    10822 void WebPageProxy::willPerformPasteCommand(DOMPasteAccessCategory)
     10817void WebPageProxy::willPerformPasteCommand()
    1082310818{
    1082410819}
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r286641 r286705  
    268268enum class CookieConsentDecisionResult : uint8_t;
    269269enum class CreateNewGroupForHighlight : bool;
    270 enum class DOMPasteAccessCategory : uint8_t;
    271270enum class DOMPasteAccessResponse : uint8_t;
    272271enum class EventMakesGamepadsVisible : bool;
     
    22622261#endif
    22632262
    2264     void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&);
    2265     void willPerformPasteCommand(WebCore::DOMPasteAccessCategory);
     2263    void requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&);
     2264    void willPerformPasteCommand();
    22662265
    22672266    // Back/Forward list management
  • trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in

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

    r286632 r286705  
    3939
    4040namespace WebCore {
    41 enum class DOMPasteAccessCategory : uint8_t;
    4241enum class DOMPasteAccessResponse : uint8_t;
    4342struct PromisedAttachmentInfo;
     
    268267#endif
    269268
    270     void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect& elementRect, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
     269    void requestDOMPasteAccess(const WebCore::IntRect& elementRect, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
    271270
    272271#if ENABLE(DRAG_SUPPORT)
  • trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm

    r286632 r286705  
    952952#endif
    953953
    954 void 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)];
     954void 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)];
    957957}
    958958
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r286641 r286705  
    9191struct ShareDataWithParsedURL;
    9292struct TextRecognitionResult;
    93 enum class DOMPasteAccessCategory : uint8_t;
    9493enum class DOMPasteAccessResponse : uint8_t;
    9594enum class MouseEventPolicy : uint8_t;
     
    677676- (void)updateFocusedElementFocusedWithDataListDropdown:(BOOL)value;
    678677
    679 - (void)_requestDOMPasteAccessForCategory:(WebCore::DOMPasteAccessCategory)pasteAccessCategory elementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler;
     678- (void)_requestDOMPasteAccessWithElementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler;
    680679
    681680- (void)doAfterPositionInformationUpdate:(void (^)(WebKit::InteractionInformationAtPosition))action forRequest:(WebKit::InteractionInformationRequest)request;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r286660 r286705  
    12701270
    12711271    [self _resetPanningPreventionFlags];
    1272     [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
     1272    [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
    12731273    [self _cancelPendingKeyEventHandler];
    12741274
     
    16591659
    16601660    if (superDidResign) {
    1661         [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
     1661        [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
    16621662        _page->activityStateDidChange(WebCore::ActivityState::IsFocused, WebKit::WebPageProxy::ActivityStateChangeDispatchMode::Immediate);
    16631663
     
    17271727    _lastInteractionLocation = lastTouchEvent->locationInDocumentCoordinates;
    17281728    if (lastTouchEvent->type == UIWebTouchEventTouchBegin) {
    1729         [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
     1729        [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
    17301730        _layerTreeTransactionIdAtLastInteractionStart = downcast<WebKit::RemoteLayerTreeDrawingAreaProxy>(*_page->drawingArea()).lastCommittedLayerTreeTransactionID();
    17311731
     
    39913991- (void)_willHideMenu:(NSNotification *)notification
    39923992{
    3993     [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
     3993    [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
    39943994}
    39953995
     
    40194019- (void)pasteForWebView:(id)sender
    40204020{
    4021     if (sender == UIMenuController.sharedMenuController && [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::GrantedForGesture])
     4021    if (sender == UIMenuController.sharedMenuController && [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::GrantedForGesture])
    40224022        return;
    40234023
     
    41654165}
    41664166
    4167 static UIPasteboardName pasteboardNameForAccessCategory(WebCore::DOMPasteAccessCategory pasteAccessCategory)
    4168 {
    4169     switch (pasteAccessCategory) {
    4170     case WebCore::DOMPasteAccessCategory::General:
    4171         return UIPasteboardNameGeneral;
    4172     }
    4173 }
    4174 
    4175 static UIPasteboard *pasteboardForAccessCategory(WebCore::DOMPasteAccessCategory pasteAccessCategory)
    4176 {
    4177     switch (pasteAccessCategory) {
    4178     case WebCore::DOMPasteAccessCategory::General:
    4179         return UIPasteboard.generalPasteboard;
    4180     }
    4181 }
    4182 
    4183 - (BOOL)_hidePasteMenuWithResult:(WebCore::DOMPasteAccessResponse)response
    4184 {
     4167- (BOOL)_handleDOMPasteRequestWithResult:(WebCore::DOMPasteAccessResponse)response
     4168{
     4169    if (response == WebCore::DOMPasteAccessResponse::GrantedForCommand || response == WebCore::DOMPasteAccessResponse::GrantedForGesture)
     4170        _page->grantAccessToCurrentPasteboardData(UIPasteboardNameGeneral);
     4171
    41854172    if (auto pasteHandler = WTFMove(_domPasteRequestHandler)) {
    41864173        [UIMenuController.sharedMenuController hideMenuFromView:self];
     
    41914178}
    41924179
    4193 - (BOOL)_handleDOMPasteRequestForCategory:(WebCore::DOMPasteAccessCategory)pasteAccessCategory result:(WebCore::DOMPasteAccessResponse)response
    4194 {
    4195     if (response == WebCore::DOMPasteAccessResponse::GrantedForCommand || response == WebCore::DOMPasteAccessResponse::GrantedForGesture)
    4196         _page->grantAccessToCurrentPasteboardData(pasteboardNameForAccessCategory(pasteAccessCategory));
    4197 
    4198     return [self _hidePasteMenuWithResult:response];
    4199 }
    4200 
    42014180- (void)_willPerformAction:(SEL)action sender:(id)sender
    42024181{
    42034182    if (action != @selector(paste:))
    4204         [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
     4183        [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
    42054184}
    42064185
     
    42084187{
    42094188    if (action == @selector(paste:))
    4210         [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
     4189        [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
    42114190}
    42124191
     
    58685847    }
    58695848
    5870     [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
     5849    [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];
    58715850
    58725851    using HandledByInputMethod = WebKit::NativeWebKeyboardEvent::HandledByInputMethod;
     
    66576636}
    66586637
    6659 - (void)_requestDOMPasteAccessForCategory:(WebCore::DOMPasteAccessCategory)pasteAccessCategory elementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler
     6638- (void)_requestDOMPasteAccessWithElementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler
    66606639{
    66616640    if (auto existingCompletionHandler = std::exchange(_domPasteRequestHandler, WTFMove(completionHandler))) {
     
    66646643    }
    66656644
    6666     if (allPasteboardItemOriginsMatchOrigin(pasteboardForAccessCategory(pasteAccessCategory), originIdentifier)) {
    6667         [self _handleDOMPasteRequestForCategory:pasteAccessCategory result:WebCore::DOMPasteAccessResponse::GrantedForCommand];
     6645    if (allPasteboardItemOriginsMatchOrigin(UIPasteboard.generalPasteboard, originIdentifier)) {
     6646        [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::GrantedForCommand];
    66686647        return;
    66696648    }
  • trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm

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

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

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

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

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

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

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

    r286632 r286705  
    3636
    3737namespace WebCore {
    38 enum class DOMPasteAccessCategory : uint8_t;
    3938enum class DOMPasteAccessResponse : uint8_t;
    4039}
     
    150149    WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override { return WebCore::UserInterfaceLayoutDirection::LTR; }
    151150
    152     void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
     151    void requestDOMPasteAccess(const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&) final;
    153152
    154153    // Members of PageClientImpl class
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp

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

    r286632 r286705  
    3030
    3131namespace WebCore {
    32 enum class DOMPasteAccessCategory : uint8_t;
    3332enum class DOMPasteAccessResponse : uint8_t;
    3433}
     
    9594    void clearUndoRedoOperations() final;
    9695
    97     WebCore::DOMPasteAccessResponse requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const String& originIdentifier) final;
     96    WebCore::DOMPasteAccessResponse requestDOMPasteAccess(const String& originIdentifier) final;
    9897
    9998    bool canCopyCut(WebCore::Frame*, bool defaultValue) const final;
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

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

    r286641 r286705  
    225225enum class COEPDisposition : bool;
    226226enum class CreateNewGroupForHighlight : bool;
    227 enum class DOMPasteAccessCategory : uint8_t;
    228227enum class DOMPasteAccessResponse : uint8_t;
    229228enum class DragApplicationFlags : uint8_t;
     
    13411340    }
    13421341
    1343     WebCore::DOMPasteAccessResponse requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const String& originIdentifier);
     1342    WebCore::DOMPasteAccessResponse requestDOMPasteAccess(const String& originIdentifier);
    13441343    WebCore::IntRect rectForElementAtInteractionLocation() const;
    13451344
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r286640 r286705  
     12021-12-08  Truitt Savell  <tsavell@apple.com>
     2
     3        Unreviewed, reverting r286632.
     4
     5        Broke 3 tests on iOS
     6
     7        Reverted changeset:
     8
     9        "Add a `DOMPasteAccessCategory` to control which pasteboard
     10        the WebProcess is granted access to when pasting"
     11        https://bugs.webkit.org/show_bug.cgi?id=233939
     12        https://commits.webkit.org/r286632
     13
    1142021-12-07  Wenson Hsieh  <wenson_hsieh@apple.com>
    215
  • trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h

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

    r286640 r286705  
     12021-12-08  Truitt Savell  <tsavell@apple.com>
     2
     3        Unreviewed, reverting r286632.
     4
     5        Broke 3 tests on iOS
     6
     7        Reverted changeset:
     8
     9        "Add a `DOMPasteAccessCategory` to control which pasteboard
     10        the WebProcess is granted access to when pasting"
     11        https://bugs.webkit.org/show_bug.cgi?id=233939
     12        https://commits.webkit.org/r286632
     13
    1142021-12-07  Wenson Hsieh  <wenson_hsieh@apple.com>
    215
  • trunk/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h

    r286632 r286705  
    118118    bool performTwoStepDrop(WebCore::DocumentFragment&, const WebCore::SimpleRange&, bool) final { return false; }
    119119
    120     WebCore::DOMPasteAccessResponse requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const String&) final { return WebCore::DOMPasteAccessResponse::DeniedForGesture; }
     120    WebCore::DOMPasteAccessResponse requestDOMPasteAccess(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.