Changeset 286632 in webkit
- Timestamp:
- Dec 7, 2021, 4:55:11 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 40 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/dom/DOMPasteAccess.h (modified) (2 diffs)
-
WebCore/loader/EmptyClients.cpp (modified) (1 diff)
-
WebCore/page/EditorClient.h (modified) (2 diffs)
-
WebCore/page/Frame.cpp (modified) (2 diffs)
-
WebCore/page/Frame.h (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/Scripts/webkit/messages.py (modified) (1 diff)
-
WebKit/UIProcess/API/gtk/PageClientImpl.cpp (modified) (1 diff)
-
WebKit/UIProcess/API/gtk/PageClientImpl.h (modified) (1 diff)
-
WebKit/UIProcess/API/mac/WKView.mm (modified) (1 diff)
-
WebKit/UIProcess/API/mac/WKWebViewMac.mm (modified) (1 diff)
-
WebKit/UIProcess/API/wpe/PageClientImpl.cpp (modified) (1 diff)
-
WebKit/UIProcess/API/wpe/PageClientImpl.h (modified) (2 diffs)
-
WebKit/UIProcess/Cocoa/WebViewImpl.h (modified) (2 diffs)
-
WebKit/UIProcess/Cocoa/WebViewImpl.mm (modified) (7 diffs)
-
WebKit/UIProcess/PageClient.h (modified) (2 diffs)
-
WebKit/UIProcess/WebPageProxy.cpp (modified) (5 diffs)
-
WebKit/UIProcess/WebPageProxy.h (modified) (2 diffs)
-
WebKit/UIProcess/WebPageProxy.messages.in (modified) (1 diff)
-
WebKit/UIProcess/ios/PageClientImplIOS.h (modified) (2 diffs)
-
WebKit/UIProcess/ios/PageClientImplIOS.mm (modified) (1 diff)
-
WebKit/UIProcess/ios/WKContentViewInteraction.h (modified) (2 diffs)
-
WebKit/UIProcess/ios/WKContentViewInteraction.mm (modified) (11 diffs)
-
WebKit/UIProcess/ios/WebPageProxyIOS.mm (modified) (1 diff)
-
WebKit/UIProcess/mac/PageClientImplMac.h (modified) (1 diff)
-
WebKit/UIProcess/mac/PageClientImplMac.mm (modified) (1 diff)
-
WebKit/UIProcess/mac/WebPageProxyMac.mm (modified) (1 diff)
-
WebKit/UIProcess/playstation/PageClientImpl.cpp (modified) (1 diff)
-
WebKit/UIProcess/playstation/PageClientImpl.h (modified) (1 diff)
-
WebKit/UIProcess/win/PageClientImpl.cpp (modified) (1 diff)
-
WebKit/UIProcess/win/PageClientImpl.h (modified) (2 diffs)
-
WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp (modified) (1 diff)
-
WebKit/WebProcess/WebCoreSupport/WebEditorClient.h (modified) (2 diffs)
-
WebKit/WebProcess/WebPage/WebPage.cpp (modified) (2 diffs)
-
WebKit/WebProcess/WebPage/WebPage.h (modified) (2 diffs)
-
WebKitLegacy/mac/ChangeLog (modified) (1 diff)
-
WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h (modified) (1 diff)
-
WebKitLegacy/win/ChangeLog (modified) (1 diff)
-
WebKitLegacy/win/WebCoreSupport/WebEditorClient.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r286630 r286632 1 2021-12-07 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 1 27 2021-12-07 Devin Rousso <drousso@apple.com> 2 28 -
trunk/Source/WebCore/dom/DOMPasteAccess.h
r242317 r286632 30 30 namespace WebCore { 31 31 32 enum class DOMPasteAccessCategory : uint8_t { 33 General, 34 }; 35 32 36 enum class DOMPasteAccessPolicy : uint8_t { 33 37 NotRequestedYet, … … 46 50 namespace WTF { 47 51 52 template<> struct EnumTraits<WebCore::DOMPasteAccessCategory> { 53 using values = EnumValues< 54 WebCore::DOMPasteAccessCategory, 55 WebCore::DOMPasteAccessCategory::General 56 >; 57 }; 58 48 59 template<> struct EnumTraits<WebCore::DOMPasteAccessResponse> { 49 60 using values = EnumValues< -
trunk/Source/WebCore/loader/EmptyClients.cpp
r286455 r286632 286 286 void clearUndoRedoOperations() final { } 287 287 288 DOMPasteAccessResponse requestDOMPasteAccess( const String&) final { return DOMPasteAccessResponse::DeniedForGesture; }288 DOMPasteAccessResponse requestDOMPasteAccess(DOMPasteAccessCategory, const String&) final { return DOMPasteAccessResponse::DeniedForGesture; } 289 289 290 290 bool canCopyCut(Frame*, bool defaultValue) const final { return defaultValue; } -
trunk/Source/WebCore/page/EditorClient.h
r280019 r286632 37 37 namespace WebCore { 38 38 39 enum class DOMPasteAccessCategory : uint8_t; 39 40 enum class DOMPasteAccessResponse : uint8_t; 40 41 … … 102 103 virtual void handleAcceptedCandidateWithSoftSpaces(TextCheckingResult) { } 103 104 104 virtual DOMPasteAccessResponse requestDOMPasteAccess( const String& originIdentifier) = 0;105 virtual DOMPasteAccessResponse requestDOMPasteAccess(DOMPasteAccessCategory, const String& originIdentifier) = 0; 105 106 106 107 // 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
r285357 r286632 562 562 #endif // PLATFORM(IOS_FAMILY) 563 563 564 bool Frame::requestDOMPasteAccess( )564 bool Frame::requestDOMPasteAccess(DOMPasteAccessCategory pasteAccessCategory) 565 565 { 566 566 if (m_settings->javaScriptCanAccessClipboard() && m_settings->domPasteAllowed()) … … 590 590 return false; 591 591 592 auto response = client->requestDOMPasteAccess( m_doc->originIdentifierForPasteboard());592 auto response = client->requestDOMPasteAccess(pasteAccessCategory, m_doc->originIdentifierForPasteboard()); 593 593 gestureToken->didRequestDOMPasteAccess(response); 594 594 switch (response) { -
trunk/Source/WebCore/page/Frame.h
r285357 r286632 177 177 void setHasHadUserInteraction() { m_hasHadUserInteraction = true; } 178 178 179 bool requestDOMPasteAccess( );179 bool requestDOMPasteAccess(DOMPasteAccessCategory = DOMPasteAccessCategory::General); 180 180 181 181 String debugDescription() const; -
trunk/Source/WebKit/ChangeLog
r286631 r286632 1 2021-12-07 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 (-[WKContentView cleanUpInteraction]): 43 (-[WKContentView resignFirstResponderForWebView]): 44 (-[WKContentView _webTouchEventsRecognized:]): 45 (-[WKContentView _willHideMenu:]): 46 (-[WKContentView pasteForWebView:]): 47 (pasteboardNameForAccessCategory): Added. 48 (pasteboardForAccessCategory): Added. 49 (-[WKContentView _hidePasteMenuWithResult:]): Added. 50 (-[WKContentView _handleDOMPasteRequestForCategory:result:]): Added. 51 (-[WKContentView _willPerformAction:sender:]): 52 (-[WKContentView _didPerformAction:sender:]): 53 (-[WKContentView handleKeyWebEvent:withCompletionHandler:]): 54 (-[WKContentView _requestDOMPasteAccessForCategory:elementRect:originIdentifier:completionHandler:]): Added. 55 (-[WKContentView _handleDOMPasteRequestWithResult:]): Deleted. 56 (-[WKContentView _requestDOMPasteAccessWithElementRect:originIdentifier:completionHandler:]): Deleted. 57 * UIProcess/PageClient.h: 58 * UIProcess/API/gtk/PageClientImpl.h: 59 * UIProcess/API/gtk/PageClientImpl.cpp: 60 (WebKit::PageClientImpl::requestDOMPasteAccess): 61 * UIProcess/API/wpe/PageClientImpl.h: 62 * UIProcess/API/wpe/PageClientImpl.cpp: 63 (WebKit::PageClientImpl::requestDOMPasteAccess): 64 * UIProcess/ios/PageClientImplIOS.h: 65 * UIProcess/ios/PageClientImplIOS.mm: 66 (WebKit::PageClientImpl::requestDOMPasteAccess): 67 * UIProcess/mac/PageClientImplMac.h: 68 * UIProcess/mac/PageClientImplMac.mm: 69 (WebKit::PageClientImpl::requestDOMPasteAccess): 70 * UIProcess/playstation/PageClientImpl.h: 71 * UIProcess/playstation/PageClientImpl.cpp: 72 (WebKit::PageClientImpl::requestDOMPasteAccess): 73 * UIProcess/win/PageClientImpl.h: 74 * UIProcess/win/PageClientImpl.cpp: 75 (WebKit::PageClientImpl::requestDOMPasteAccess): 76 * WebProcess/WebCoreSupport/WebEditorClient.h: 77 * WebProcess/WebCoreSupport/WebEditorClient.cpp: 78 (WebKit::WebEditorClient::requestDOMPasteAccess): 79 * WebProcess/WebPage/WebPage.h: 80 * WebProcess/WebPage/WebPage.cpp: 81 (WebKit::WebPage::requestDOMPasteAccess): 82 Pass along the `DOMPasteAccessCategory`. 83 84 * UIProcess/WebPageProxy.messages.in: 85 * UIProcess/WebPageProxy.h: 86 * UIProcess/WebPageProxy.cpp: 87 (WebKit::pasteAccessCategoryForCommand): Added. 88 (WebKit::WebPageProxy::executeEditCommand): 89 (WebKit::WebPageProxy::requestDOMPasteAccess): 90 (WebKit::WebPageProxy::willPerformPasteCommand): 91 (WebKit::isPasteCommandName): Deleted. 92 * UIProcess/ios/WebPageProxyIOS.mm: 93 (WebKit::WebPageProxy::willPerformPasteCommand): 94 * UIProcess/mac/WebPageProxyMac.mm: 95 (WebKit::WebPageProxy::willPerformPasteCommand) 96 Create a mapping between paste command name and `DOMPasteAccessCategory`. 97 1 98 2021-12-07 Simon Fraser <simon.fraser@apple.com> 2 99 -
trunk/Source/WebKit/Scripts/webkit/messages.py
r286538 r286632 759 759 'WebCore::CompositeOperator': ['<WebCore/GraphicsTypes.h>'], 760 760 'WebCore::CreateNewGroupForHighlight': ['<WebCore/AppHighlight.h>'], 761 'WebCore::DOMPasteAccessCategory': ['<WebCore/DOMPasteAccess.h>'], 761 762 'WebCore::DOMPasteAccessResponse': ['<WebCore/DOMPasteAccess.h>'], 762 763 'WebCore::DestinationColorSpace': ['<WebCore/ColorSpace.h>'], -
trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp
r283911 r286632 549 549 #endif 550 550 551 void PageClientImpl::requestDOMPasteAccess( const IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)551 void PageClientImpl::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler) 552 552 { 553 553 completionHandler(WebCore::DOMPasteAccessResponse::DeniedForGesture); -
trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h
r283911 r286632 161 161 void isPlayingAudioDidChange() final { } 162 162 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; 164 164 165 165 #if ENABLE(VIDEO) && USE(GSTREAMER) -
trunk/Source/WebKit/UIProcess/API/mac/WKView.mm
r284453 r286632 913 913 } 914 914 915 - (void)_web_grantDOMPasteAccess916 {917 _data->_impl->handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::GrantedForGesture);918 }919 920 915 - (void)maybeInstallIconLoadingClient 921 916 { -
trunk/Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm
r284453 r286632 1233 1233 } 1234 1234 1235 - (void)_web_grantDOMPasteAccess1236 {1237 _impl->handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::GrantedForGesture);1238 }1239 1240 1235 - (void)_takeFindStringFromSelectionInternal:(id)sender 1241 1236 { -
trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp
r283911 r286632 416 416 #endif // ENABLE(FULLSCREEN_API) 417 417 418 void PageClientImpl::requestDOMPasteAccess( const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)418 void PageClientImpl::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler) 419 419 { 420 420 completionHandler(WebCore::DOMPasteAccessResponse::DeniedForGesture); -
trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h
r283911 r286632 37 37 38 38 namespace WebCore { 39 enum class DOMPasteAccessCategory : uint8_t; 39 40 enum class DOMPasteAccessResponse : uint8_t; 40 41 } … … 159 160 160 161 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; 162 163 163 164 WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override; -
trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h
r285973 r286632 136 136 #endif 137 137 138 - (void)_web_grantDOMPasteAccess;139 140 138 @optional 141 139 - (void)_web_didAddMediaControlsManager:(id)controlsManager; … … 653 651 void clearPromisedDragImage(); 654 652 655 void requestDOMPasteAccess( const WebCore::IntRect&, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&);656 void handleDOMPasteRequest WithResult(WebCore::DOMPasteAccessResponse);653 void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&); 654 void handleDOMPasteRequestForCategoryWithResult(WebCore::DOMPasteAccessCategory, WebCore::DOMPasteAccessResponse); 657 655 NSMenu *domPasteMenu() const { return m_domPasteMenu.get(); } 656 void hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse); 658 657 659 658 #if HAVE(TRANSLATION_UI_SERVICES) && ENABLE(CONTEXT_MENUS) -
trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
r285973 r286632 1008 1008 1009 1009 @interface WKDOMPasteMenuDelegate : NSObject<NSMenuDelegate> 1010 - (instancetype)initWithWebViewImpl:(WebKit::WebViewImpl&)impl ;1010 - (instancetype)initWithWebViewImpl:(WebKit::WebViewImpl&)impl pasteAccessCategory:(WebCore::DOMPasteAccessCategory)category; 1011 1011 @end 1012 1012 1013 1013 @implementation WKDOMPasteMenuDelegate { 1014 1014 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 1018 1019 { 1019 1020 if (!(self = [super init])) … … 1021 1022 1022 1023 _impl = impl; 1024 _category = category; 1023 1025 return self; 1024 1026 } … … 1028 1030 RunLoop::main().dispatch([impl = _impl] { 1029 1031 if (impl) 1030 impl->h andleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);1032 impl->hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture); 1031 1033 }); 1032 1034 } … … 1042 1044 confinementRect.move(0, -confinementRect.height()); 1043 1045 return confinementRect; 1046 } 1047 1048 - (void)_web_grantDOMPasteAccess 1049 { 1050 _impl->handleDOMPasteRequestForCategoryWithResult(_category, WebCore::DOMPasteAccessResponse::GrantedForGesture); 1044 1051 } 1045 1052 … … 1604 1611 updateRemoteAccessibilityRegistration(false); 1605 1612 1606 h andleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);1613 hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture); 1607 1614 } 1608 1615 … … 4579 4586 } 4580 4587 4581 void WebViewImpl::requestDOMPasteAccess(const WebCore::IntRect&, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completion) 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) 4582 4605 { 4583 4606 ASSERT(!m_domPasteRequestHandler); 4584 h andleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);4585 4586 NSData *data = [ NSPasteboard.generalPasteboarddataForType:@(WebCore::PasteboardCustomData::cocoaType())];4607 hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture); 4608 4609 NSData *data = [pasteboardForAccessCategory(pasteAccessCategory) dataForType:@(WebCore::PasteboardCustomData::cocoaType())]; 4587 4610 auto buffer = WebCore::SharedBuffer::create(data); 4588 4611 if (WebCore::PasteboardCustomData::fromSharedBuffer(buffer.get()).origin() == originIdentifier) { 4589 m_page->grantAccessToCurrentPasteboardData( NSPasteboardNameGeneral);4612 m_page->grantAccessToCurrentPasteboardData(pasteboardNameForAccessCategory(pasteAccessCategory)); 4590 4613 completion(WebCore::DOMPasteAccessResponse::GrantedForGesture); 4591 4614 return; 4592 4615 } 4593 4616 4594 m_domPasteMenuDelegate = adoptNS([[WKDOMPasteMenuDelegate alloc] initWithWebViewImpl:*this ]);4617 m_domPasteMenuDelegate = adoptNS([[WKDOMPasteMenuDelegate alloc] initWithWebViewImpl:*this pasteAccessCategory:pasteAccessCategory]); 4595 4618 m_domPasteRequestHandler = WTFMove(completion); 4596 4619 m_domPasteMenu = adoptNS([[NSMenu alloc] initWithTitle:WebCore::contextMenuItemTagPaste()]); … … 4598 4621 [m_domPasteMenu setDelegate:m_domPasteMenuDelegate.get()]; 4599 4622 [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 4601 4627 [NSMenu popUpContextMenu:m_domPasteMenu.get() withEvent:m_lastMouseDownEvent.get() forView:m_view.getAutoreleased()]; 4602 4628 } 4603 4629 4604 void WebViewImpl::handleDOMPasteRequest WithResult(WebCore::DOMPasteAccessResponse response)4630 void WebViewImpl::handleDOMPasteRequestForCategoryWithResult(WebCore::DOMPasteAccessCategory pasteAccessCategory, WebCore::DOMPasteAccessResponse response) 4605 4631 { 4606 4632 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 4638 void WebViewImpl::hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse response) 4639 { 4609 4640 if (auto handler = std::exchange(m_domPasteRequestHandler, { })) 4610 4641 handler(response); -
trunk/Source/WebKit/UIProcess/PageClient.h
r285973 r286632 111 111 enum class TextIndicatorLifetime : uint8_t; 112 112 enum class TextIndicatorDismissalAnimation : uint8_t; 113 enum class DOMPasteAccessCategory : uint8_t; 113 114 enum class DOMPasteAccessResponse : uint8_t; 114 115 enum class ScrollIsAnimated : uint8_t; … … 600 601 #endif 601 602 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; 603 604 604 605 #if ENABLE(ATTACHMENT_ELEMENT) -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r286631 r286632 2511 2511 } 2512 2512 2513 static bool isPasteCommandName(const String& commandName)2514 { 2515 static NeverDestroyed<Hash Set<String, ASCIICaseInsensitiveHash>> pasteCommandNames = HashSet<String, ASCIICaseInsensitiveHash> {2516 "Paste",2517 "PasteAndMatchStyle",2518 "PasteAsQuotation",2519 "PasteAsPlainText"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 }, 2520 2520 }; 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; 2522 2527 } 2523 2528 … … 2529 2534 } 2530 2535 2531 if ( isPasteCommandName(commandName))2532 willPerformPasteCommand( );2536 if (auto pasteAccessCategory = pasteAccessCategoryForCommand(commandName)) 2537 willPerformPasteCommand(*pasteAccessCategory); 2533 2538 2534 2539 sendWithAsyncReply(Messages::WebPage::ExecuteEditCommandWithCallback(commandName, argument), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::executeEditCommand"_s)] () mutable { … … 2544 2549 return; 2545 2550 2546 if ( isPasteCommandName(commandName))2547 willPerformPasteCommand( );2551 if (auto pasteAccessCategory = pasteAccessCategoryForCommand(commandName)) 2552 willPerformPasteCommand(*pasteAccessCategory); 2548 2553 2549 2554 if (commandName == ignoreSpellingCommandName) … … 6602 6607 #endif 6603 6608 6604 void WebPageProxy::requestDOMPasteAccess( const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)6605 { 6606 m_pageClient->requestDOMPasteAccess( elementRect, originIdentifier, WTFMove(completionHandler));6609 void WebPageProxy::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory pasteAccessCategory, const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler) 6610 { 6611 m_pageClient->requestDOMPasteAccess(pasteAccessCategory, elementRect, originIdentifier, WTFMove(completionHandler)); 6607 6612 } 6608 6613 … … 10805 10810 #if !PLATFORM(COCOA) 10806 10811 10807 void WebPageProxy::willPerformPasteCommand( )10812 void WebPageProxy::willPerformPasteCommand(DOMPasteAccessCategory) 10808 10813 { 10809 10814 } -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r286602 r286632 267 267 enum class AutoplayEvent : uint8_t; 268 268 enum class CreateNewGroupForHighlight : bool; 269 enum class DOMPasteAccessCategory : uint8_t; 269 270 enum class DOMPasteAccessResponse : uint8_t; 270 271 enum class EventMakesGamepadsVisible : bool; … … 2256 2257 #endif 2257 2258 2258 void requestDOMPasteAccess( const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&);2259 void willPerformPasteCommand( );2259 void requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&); 2260 void willPerformPasteCommand(WebCore::DOMPasteAccessCategory); 2260 2261 2261 2262 // Back/Forward list management -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r286317 r286632 233 233 #endif 234 234 235 RequestDOMPasteAccess( WebCore::IntRect elementRect, String originIdentifier) -> (enum:uint8_t WebCore::DOMPasteAccessResponse response) Synchronous235 RequestDOMPasteAccess(enum:uint8_t WebCore::DOMPasteAccessCategory pasteAccessCategory, WebCore::IntRect elementRect, String originIdentifier) -> (enum:uint8_t WebCore::DOMPasteAccessResponse response) Synchronous 236 236 237 237 # Find messages -
trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h
r285973 r286632 39 39 40 40 namespace WebCore { 41 enum class DOMPasteAccessCategory : uint8_t; 41 42 enum class DOMPasteAccessResponse : uint8_t; 42 43 struct PromisedAttachmentInfo; … … 267 268 #endif 268 269 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; 270 271 271 272 #if ENABLE(DRAG_SUPPORT) -
trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
r285976 r286632 952 952 #endif 953 953 954 void PageClientImpl::requestDOMPasteAccess( const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)955 { 956 [m_contentView _requestDOMPasteAccess WithElementRect:elementRect originIdentifier:originIdentifier completionHandler:WTFMove(completionHandler)];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)]; 957 957 } 958 958 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
r285973 r286632 91 91 struct ShareDataWithParsedURL; 92 92 struct TextRecognitionResult; 93 enum class DOMPasteAccessCategory : uint8_t; 93 94 enum class DOMPasteAccessResponse : uint8_t; 94 95 enum class MouseEventPolicy : uint8_t; … … 672 673 - (void)updateFocusedElementFocusedWithDataListDropdown:(BOOL)value; 673 674 674 - (void)_requestDOMPasteAccess WithElementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler;675 - (void)_requestDOMPasteAccessForCategory:(WebCore::DOMPasteAccessCategory)pasteAccessCategory elementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler; 675 676 676 677 - (void)doAfterPositionInformationUpdate:(void (^)(WebKit::InteractionInformationAtPosition))action forRequest:(WebKit::InteractionInformationRequest)request; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r286260 r286632 1249 1249 1250 1250 [self _resetPanningPreventionFlags]; 1251 [self _h andleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];1251 [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture]; 1252 1252 [self _cancelPendingKeyEventHandler]; 1253 1253 … … 1638 1638 1639 1639 if (superDidResign) { 1640 [self _h andleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];1640 [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture]; 1641 1641 _page->activityStateDidChange(WebCore::ActivityState::IsFocused, WebKit::WebPageProxy::ActivityStateChangeDispatchMode::Immediate); 1642 1642 … … 1706 1706 _lastInteractionLocation = lastTouchEvent->locationInDocumentCoordinates; 1707 1707 if (lastTouchEvent->type == UIWebTouchEventTouchBegin) { 1708 [self _h andleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];1708 [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture]; 1709 1709 _layerTreeTransactionIdAtLastInteractionStart = downcast<WebKit::RemoteLayerTreeDrawingAreaProxy>(*_page->drawingArea()).lastCommittedLayerTreeTransactionID(); 1710 1710 … … 3970 3970 - (void)_willHideMenu:(NSNotification *)notification 3971 3971 { 3972 [self _h andleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];3972 [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture]; 3973 3973 } 3974 3974 … … 3998 3998 - (void)pasteForWebView:(id)sender 3999 3999 { 4000 if (sender == UIMenuController.sharedMenuController && [self _h andleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::GrantedForGesture])4000 if (sender == UIMenuController.sharedMenuController && [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::GrantedForGesture]) 4001 4001 return; 4002 4002 … … 4144 4144 } 4145 4145 4146 - (BOOL)_handleDOMPasteRequestWithResult:(WebCore::DOMPasteAccessResponse)response 4147 { 4148 if (response == WebCore::DOMPasteAccessResponse::GrantedForCommand || response == WebCore::DOMPasteAccessResponse::GrantedForGesture) 4149 _page->grantAccessToCurrentPasteboardData(UIPasteboardNameGeneral); 4150 4146 static UIPasteboardName pasteboardNameForAccessCategory(WebCore::DOMPasteAccessCategory pasteAccessCategory) 4147 { 4148 switch (pasteAccessCategory) { 4149 case WebCore::DOMPasteAccessCategory::General: 4150 return UIPasteboardNameGeneral; 4151 } 4152 } 4153 4154 static UIPasteboard *pasteboardForAccessCategory(WebCore::DOMPasteAccessCategory pasteAccessCategory) 4155 { 4156 switch (pasteAccessCategory) { 4157 case WebCore::DOMPasteAccessCategory::General: 4158 return UIPasteboard.generalPasteboard; 4159 } 4160 } 4161 4162 - (BOOL)_hidePasteMenuWithResult:(WebCore::DOMPasteAccessResponse)response 4163 { 4151 4164 if (auto pasteHandler = WTFMove(_domPasteRequestHandler)) { 4152 4165 [UIMenuController.sharedMenuController hideMenuFromView:self]; … … 4157 4170 } 4158 4171 4172 - (BOOL)_handleDOMPasteRequestForCategory:(WebCore::DOMPasteAccessCategory)pasteAccessCategory result:(WebCore::DOMPasteAccessResponse)response 4173 { 4174 if (response == WebCore::DOMPasteAccessResponse::GrantedForCommand || response == WebCore::DOMPasteAccessResponse::GrantedForGesture) 4175 _page->grantAccessToCurrentPasteboardData(pasteboardNameForAccessCategory(pasteAccessCategory)); 4176 4177 return [self _hidePasteMenuWithResult:response]; 4178 } 4179 4159 4180 - (void)_willPerformAction:(SEL)action sender:(id)sender 4160 4181 { 4161 4182 if (action != @selector(paste:)) 4162 [self _h andleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];4183 [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture]; 4163 4184 } 4164 4185 … … 4166 4187 { 4167 4188 if (action == @selector(paste:)) 4168 [self _h andleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];4189 [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture]; 4169 4190 } 4170 4191 … … 5821 5842 } 5822 5843 5823 [self _h andleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];5844 [self _hidePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture]; 5824 5845 5825 5846 using HandledByInputMethod = WebKit::NativeWebKeyboardEvent::HandledByInputMethod; … … 6610 6631 } 6611 6632 6612 - (void)_requestDOMPasteAccess WithElementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler6633 - (void)_requestDOMPasteAccessForCategory:(WebCore::DOMPasteAccessCategory)pasteAccessCategory elementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler 6613 6634 { 6614 6635 if (auto existingCompletionHandler = std::exchange(_domPasteRequestHandler, WTFMove(completionHandler))) { … … 6617 6638 } 6618 6639 6619 if (allPasteboardItemOriginsMatchOrigin( UIPasteboard.generalPasteboard, originIdentifier)) {6620 [self _handleDOMPasteRequest WithResult:WebCore::DOMPasteAccessResponse::GrantedForCommand];6640 if (allPasteboardItemOriginsMatchOrigin(pasteboardForAccessCategory(pasteAccessCategory), originIdentifier)) { 6641 [self _handleDOMPasteRequestForCategory:pasteAccessCategory result:WebCore::DOMPasteAccessResponse::GrantedForCommand]; 6621 6642 return; 6622 6643 } -
trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
r286408 r286632 1545 1545 #endif 1546 1546 1547 void WebPageProxy::willPerformPasteCommand() 1548 { 1549 grantAccessToCurrentPasteboardData(UIPasteboardNameGeneral); 1547 void WebPageProxy::willPerformPasteCommand(DOMPasteAccessCategory pasteAccessCategory) 1548 { 1549 switch (pasteAccessCategory) { 1550 case DOMPasteAccessCategory::General: 1551 grantAccessToCurrentPasteboardData(UIPasteboardNameGeneral); 1552 return; 1553 } 1550 1554 } 1551 1555 -
trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h
r285973 r286632 226 226 void didRemoveNavigationGestureSnapshot() override; 227 227 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; 229 229 230 230 void makeViewBlank(bool) final; -
trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm
r285973 r286632 1001 1001 } 1002 1002 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));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)); 1006 1006 } 1007 1007 -
trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
r286408 r286632 652 652 #endif 653 653 654 void WebPageProxy::willPerformPasteCommand() 655 { 656 grantAccessToCurrentPasteboardData(NSPasteboardNameGeneral); 654 void WebPageProxy::willPerformPasteCommand(DOMPasteAccessCategory pasteAccessCategory) 655 { 656 switch (pasteAccessCategory) { 657 case DOMPasteAccessCategory::General: 658 grantAccessToCurrentPasteboardData(NSPasteboardNameGeneral); 659 return; 660 } 657 661 } 658 662 -
trunk/Source/WebKit/UIProcess/playstation/PageClientImpl.cpp
r283911 r286632 318 318 } 319 319 320 void PageClientImpl::requestDOMPasteAccess( const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)320 void PageClientImpl::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler) 321 321 { 322 322 completionHandler(WebCore::DOMPasteAccessResponse::DeniedForGesture); -
trunk/Source/WebKit/UIProcess/playstation/PageClientImpl.h
r283911 r286632 150 150 WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override; 151 151 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; 153 153 154 154 PlayStationWebView& m_view; -
trunk/Source/WebKit/UIProcess/win/PageClientImpl.cpp
r285099 r286632 374 374 } 375 375 376 void PageClientImpl::requestDOMPasteAccess( const IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)376 void PageClientImpl::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler) 377 377 { 378 378 completionHandler(WebCore::DOMPasteAccessResponse::DeniedForGesture); -
trunk/Source/WebKit/UIProcess/win/PageClientImpl.h
r283911 r286632 36 36 37 37 namespace WebCore { 38 enum class DOMPasteAccessCategory : uint8_t; 38 39 enum class DOMPasteAccessResponse : uint8_t; 39 40 } … … 149 150 WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override { return WebCore::UserInterfaceLayoutDirection::LTR; } 150 151 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; 152 153 153 154 // Members of PageClientImpl class -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp
r281290 r286632 333 333 } 334 334 335 WebCore::DOMPasteAccessResponse WebEditorClient::requestDOMPasteAccess( const String& originIdentifier)336 { 337 return m_page->requestDOMPasteAccess( originIdentifier);335 WebCore::DOMPasteAccessResponse WebEditorClient::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory pasteAccessCategory, const String& originIdentifier) 336 { 337 return m_page->requestDOMPasteAccess(pasteAccessCategory, originIdentifier); 338 338 } 339 339 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h
r280019 r286632 30 30 31 31 namespace WebCore { 32 enum class DOMPasteAccessCategory : uint8_t; 32 33 enum class DOMPasteAccessResponse : uint8_t; 33 34 } … … 94 95 void clearUndoRedoOperations() final; 95 96 96 WebCore::DOMPasteAccessResponse requestDOMPasteAccess( const String& originIdentifier) final;97 WebCore::DOMPasteAccessResponse requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const String& originIdentifier) final; 97 98 98 99 bool canCopyCut(WebCore::Frame*, bool defaultValue) const final; -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r286505 r286632 7198 7198 } 7199 7199 7200 WebCore::DOMPasteAccessResponse WebPage::requestDOMPasteAccess( const String& originIdentifier)7200 WebCore::DOMPasteAccessResponse WebPage::requestDOMPasteAccess(WebCore::DOMPasteAccessCategory pasteAccessCategory, const String& originIdentifier) 7201 7201 { 7202 7202 auto response = WebCore::DOMPasteAccessResponse::DeniedForGesture; … … 7208 7208 send(Messages::WebPageProxy::HandleAutocorrectionContext(autocorrectionContext())); 7209 7209 #endif 7210 sendSyncWithDelayedReply(Messages::WebPageProxy::RequestDOMPasteAccess( rectForElementAtInteractionLocation(), originIdentifier), Messages::WebPageProxy::RequestDOMPasteAccess::Reply(response));7210 sendSyncWithDelayedReply(Messages::WebPageProxy::RequestDOMPasteAccess(pasteAccessCategory, rectForElementAtInteractionLocation(), originIdentifier), Messages::WebPageProxy::RequestDOMPasteAccess::Reply(response)); 7211 7211 return response; 7212 7212 } -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r286505 r286632 225 225 enum class COEPDisposition : bool; 226 226 enum class CreateNewGroupForHighlight : bool; 227 enum class DOMPasteAccessCategory : uint8_t; 227 228 enum class DOMPasteAccessResponse : uint8_t; 228 229 enum class DragApplicationFlags : uint8_t; … … 1340 1341 } 1341 1342 1342 WebCore::DOMPasteAccessResponse requestDOMPasteAccess( const String& originIdentifier);1343 WebCore::DOMPasteAccessResponse requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const String& originIdentifier); 1343 1344 WebCore::IntRect rectForElementAtInteractionLocation() const; 1344 1345 -
trunk/Source/WebKitLegacy/mac/ChangeLog
r286625 r286632 1 2021-12-07 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 1 19 2021-12-07 Cameron McCormack <heycam@apple.com> 2 20 -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h
r278253 r286632 84 84 85 85 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; } 87 87 88 88 #if USE(APPKIT) -
trunk/Source/WebKitLegacy/win/ChangeLog
r286625 r286632 1 2021-12-07 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 1 19 2021-12-07 Cameron McCormack <heycam@apple.com> 2 20 -
trunk/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h
r278253 r286632 118 118 bool performTwoStepDrop(WebCore::DocumentFragment&, const WebCore::SimpleRange&, bool) final { return false; } 119 119 120 WebCore::DOMPasteAccessResponse requestDOMPasteAccess( const String&) final { return WebCore::DOMPasteAccessResponse::DeniedForGesture; }120 WebCore::DOMPasteAccessResponse requestDOMPasteAccess(WebCore::DOMPasteAccessCategory, const String&) final { return WebCore::DOMPasteAccessResponse::DeniedForGesture; } 121 121 122 122 WebCore::TextCheckerClient* textChecker() final { return this; }
Note:
See TracChangeset
for help on using the changeset viewer.