Changeset 286705 in webkit
- Timestamp:
- Dec 8, 2021, 12:34:03 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
r286676 r286705 1 2021-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 1 14 2021-12-08 Philippe Normand <pnormand@igalia.com> 2 15 -
trunk/Source/WebCore/dom/DOMPasteAccess.h
r286632 r286705 30 30 namespace WebCore { 31 31 32 enum class DOMPasteAccessCategory : uint8_t {33 General,34 };35 36 32 enum class DOMPasteAccessPolicy : uint8_t { 37 33 NotRequestedYet, … … 50 46 namespace WTF { 51 47 52 template<> struct EnumTraits<WebCore::DOMPasteAccessCategory> {53 using values = EnumValues<54 WebCore::DOMPasteAccessCategory,55 WebCore::DOMPasteAccessCategory::General56 >;57 };58 59 48 template<> struct EnumTraits<WebCore::DOMPasteAccessResponse> { 60 49 using values = EnumValues< -
trunk/Source/WebCore/loader/EmptyClients.cpp
r286640 r286705 287 287 void clearUndoRedoOperations() final { } 288 288 289 DOMPasteAccessResponse requestDOMPasteAccess( DOMPasteAccessCategory,const String&) final { return DOMPasteAccessResponse::DeniedForGesture; }289 DOMPasteAccessResponse requestDOMPasteAccess(const String&) final { return DOMPasteAccessResponse::DeniedForGesture; } 290 290 291 291 bool canCopyCut(Frame*, bool defaultValue) const final { return defaultValue; } -
trunk/Source/WebCore/page/EditorClient.h
r286632 r286705 37 37 namespace WebCore { 38 38 39 enum class DOMPasteAccessCategory : uint8_t;40 39 enum class DOMPasteAccessResponse : uint8_t; 41 40 … … 103 102 virtual void handleAcceptedCandidateWithSoftSpaces(TextCheckingResult) { } 104 103 105 virtual DOMPasteAccessResponse requestDOMPasteAccess( DOMPasteAccessCategory,const String& originIdentifier) = 0;104 virtual DOMPasteAccessResponse requestDOMPasteAccess(const String& originIdentifier) = 0; 106 105 107 106 // 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 562 562 #endif // PLATFORM(IOS_FAMILY) 563 563 564 bool Frame::requestDOMPasteAccess( DOMPasteAccessCategory pasteAccessCategory)564 bool Frame::requestDOMPasteAccess() 565 565 { 566 566 if (m_settings->javaScriptCanAccessClipboard() && m_settings->domPasteAllowed()) … … 590 590 return false; 591 591 592 auto response = client->requestDOMPasteAccess( pasteAccessCategory,m_doc->originIdentifierForPasteboard());592 auto response = client->requestDOMPasteAccess(m_doc->originIdentifierForPasteboard()); 593 593 gestureToken->didRequestDOMPasteAccess(response); 594 594 switch (response) { -
trunk/Source/WebCore/page/Frame.h
r286632 r286705 177 177 void setHasHadUserInteraction() { m_hasHadUserInteraction = true; } 178 178 179 bool requestDOMPasteAccess( DOMPasteAccessCategory = DOMPasteAccessCategory::General);179 bool requestDOMPasteAccess(); 180 180 181 181 String debugDescription() const; -
trunk/Source/WebKit/ChangeLog
r286673 r286705 1 2021-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 1 14 2021-12-08 Per Arne Vollan <pvollan@apple.com> 2 15 -
trunk/Source/WebKit/Scripts/webkit/messages.py
r286632 r286705 759 759 'WebCore::CompositeOperator': ['<WebCore/GraphicsTypes.h>'], 760 760 'WebCore::CreateNewGroupForHighlight': ['<WebCore/AppHighlight.h>'], 761 'WebCore::DOMPasteAccessCategory': ['<WebCore/DOMPasteAccess.h>'],762 761 'WebCore::DOMPasteAccessResponse': ['<WebCore/DOMPasteAccess.h>'], 763 762 'WebCore::DestinationColorSpace': ['<WebCore/ColorSpace.h>'], -
trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp
r286632 r286705 549 549 #endif 550 550 551 void PageClientImpl::requestDOMPasteAccess( WebCore::DOMPasteAccessCategory,const IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)551 void PageClientImpl::requestDOMPasteAccess(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
r286632 r286705 161 161 void isPlayingAudioDidChange() final { } 162 162 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; 164 164 165 165 #if ENABLE(VIDEO) && USE(GSTREAMER) -
trunk/Source/WebKit/UIProcess/API/mac/WKView.mm
r286632 r286705 913 913 } 914 914 915 - (void)_web_grantDOMPasteAccess 916 { 917 _data->_impl->handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::GrantedForGesture); 918 } 919 915 920 - (void)maybeInstallIconLoadingClient 916 921 { -
trunk/Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm
r286632 r286705 1233 1233 } 1234 1234 1235 - (void)_web_grantDOMPasteAccess 1236 { 1237 _impl->handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::GrantedForGesture); 1238 } 1239 1235 1240 - (void)_takeFindStringFromSelectionInternal:(id)sender 1236 1241 { -
trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp
r286632 r286705 416 416 #endif // ENABLE(FULLSCREEN_API) 417 417 418 void PageClientImpl::requestDOMPasteAccess( WebCore::DOMPasteAccessCategory,const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)418 void PageClientImpl::requestDOMPasteAccess(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
r286632 r286705 37 37 38 38 namespace WebCore { 39 enum class DOMPasteAccessCategory : uint8_t;40 39 enum class DOMPasteAccessResponse : uint8_t; 41 40 } … … 160 159 161 160 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; 163 162 164 163 WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override; -
trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h
r286632 r286705 136 136 #endif 137 137 138 - (void)_web_grantDOMPasteAccess; 139 138 140 @optional 139 141 - (void)_web_didAddMediaControlsManager:(id)controlsManager; … … 651 653 void clearPromisedDragImage(); 652 654 653 void requestDOMPasteAccess( WebCore::DOMPasteAccessCategory,const WebCore::IntRect&, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&);654 void handleDOMPasteRequest ForCategoryWithResult(WebCore::DOMPasteAccessCategory,WebCore::DOMPasteAccessResponse);655 void requestDOMPasteAccess(const WebCore::IntRect&, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&); 656 void handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse); 655 657 NSMenu *domPasteMenu() const { return m_domPasteMenu.get(); } 656 void hideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse);657 658 658 659 #if HAVE(TRANSLATION_UI_SERVICES) && ENABLE(CONTEXT_MENUS) -
trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
r286632 r286705 1008 1008 1009 1009 @interface WKDOMPasteMenuDelegate : NSObject<NSMenuDelegate> 1010 - (instancetype)initWithWebViewImpl:(WebKit::WebViewImpl&)impl pasteAccessCategory:(WebCore::DOMPasteAccessCategory)category;1010 - (instancetype)initWithWebViewImpl:(WebKit::WebViewImpl&)impl; 1011 1011 @end 1012 1012 1013 1013 @implementation WKDOMPasteMenuDelegate { 1014 1014 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 1019 1018 { 1020 1019 if (!(self = [super init])) … … 1022 1021 1023 1022 _impl = impl; 1024 _category = category;1025 1023 return self; 1026 1024 } … … 1030 1028 RunLoop::main().dispatch([impl = _impl] { 1031 1029 if (impl) 1032 impl->h ideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);1030 impl->handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture); 1033 1031 }); 1034 1032 } … … 1044 1042 confinementRect.move(0, -confinementRect.height()); 1045 1043 return confinementRect; 1046 }1047 1048 - (void)_web_grantDOMPasteAccess1049 {1050 _impl->handleDOMPasteRequestForCategoryWithResult(_category, WebCore::DOMPasteAccessResponse::GrantedForGesture);1051 1044 } 1052 1045 … … 1611 1604 updateRemoteAccessibilityRegistration(false); 1612 1605 1613 h ideDOMPasteMenuWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture);1606 handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse::DeniedForGesture); 1614 1607 } 1615 1608 … … 4586 4579 } 4587 4580 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) 4581 void WebViewImpl::requestDOMPasteAccess(const WebCore::IntRect&, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completion) 4605 4582 { 4606 4583 ASSERT(!m_domPasteRequestHandler); 4607 h ideDOMPasteMenuWithResult(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())]; 4610 4587 auto buffer = WebCore::SharedBuffer::create(data); 4611 4588 if (WebCore::PasteboardCustomData::fromSharedBuffer(buffer.get()).origin() == originIdentifier) { 4612 m_page->grantAccessToCurrentPasteboardData( pasteboardNameForAccessCategory(pasteAccessCategory));4589 m_page->grantAccessToCurrentPasteboardData(NSPasteboardNameGeneral); 4613 4590 completion(WebCore::DOMPasteAccessResponse::GrantedForGesture); 4614 4591 return; 4615 4592 } 4616 4593 4617 m_domPasteMenuDelegate = adoptNS([[WKDOMPasteMenuDelegate alloc] initWithWebViewImpl:*this pasteAccessCategory:pasteAccessCategory]);4594 m_domPasteMenuDelegate = adoptNS([[WKDOMPasteMenuDelegate alloc] initWithWebViewImpl:*this]); 4618 4595 m_domPasteRequestHandler = WTFMove(completion); 4619 4596 m_domPasteMenu = adoptNS([[NSMenu alloc] initWithTitle:WebCore::contextMenuItemTagPaste()]); … … 4621 4598 [m_domPasteMenu setDelegate:m_domPasteMenuDelegate.get()]; 4622 4599 [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]; 4627 4601 [NSMenu popUpContextMenu:m_domPasteMenu.get() withEvent:m_lastMouseDownEvent.get() forView:m_view.getAutoreleased()]; 4628 4602 } 4629 4603 4630 void WebViewImpl::handleDOMPasteRequest ForCategoryWithResult(WebCore::DOMPasteAccessCategory pasteAccessCategory,WebCore::DOMPasteAccessResponse response)4604 void WebViewImpl::handleDOMPasteRequestWithResult(WebCore::DOMPasteAccessResponse response) 4631 4605 { 4632 4606 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 4640 4609 if (auto handler = std::exchange(m_domPasteRequestHandler, { })) 4641 4610 handler(response); -
trunk/Source/WebKit/UIProcess/PageClient.h
r286632 r286705 111 111 enum class TextIndicatorLifetime : uint8_t; 112 112 enum class TextIndicatorDismissalAnimation : uint8_t; 113 enum class DOMPasteAccessCategory : uint8_t;114 113 enum class DOMPasteAccessResponse : uint8_t; 115 114 enum class ScrollIsAnimated : uint8_t; … … 601 600 #endif 602 601 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; 604 603 605 604 #if ENABLE(ATTACHMENT_ELEMENT) -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r286661 r286705 2511 2511 } 2512 2512 2513 static std::optional<DOMPasteAccessCategory> pasteAccessCategoryForCommand(const String& commandName)2514 { 2515 static NeverDestroyed<Hash Map<String, DOMPasteAccessCategory, ASCIICaseInsensitiveHash>> pasteCommandNames = HashMap<String, DOMPasteAccessCategory, ASCIICaseInsensitiveHash> {2516 { "Paste", DOMPasteAccessCategory::General },2517 { "PasteAndMatchStyle", DOMPasteAccessCategory::General },2518 { "PasteAsQuotation", DOMPasteAccessCategory::General },2519 { "PasteAsPlainText", DOMPasteAccessCategory::General },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" 2520 2520 }; 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); 2527 2522 } 2528 2523 … … 2534 2529 } 2535 2530 2536 if ( auto pasteAccessCategory = pasteAccessCategoryForCommand(commandName))2537 willPerformPasteCommand( *pasteAccessCategory);2531 if (isPasteCommandName(commandName)) 2532 willPerformPasteCommand(); 2538 2533 2539 2534 sendWithAsyncReply(Messages::WebPage::ExecuteEditCommandWithCallback(commandName, argument), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::executeEditCommand"_s)] () mutable { … … 2549 2544 return; 2550 2545 2551 if ( auto pasteAccessCategory = pasteAccessCategoryForCommand(commandName))2552 willPerformPasteCommand( *pasteAccessCategory);2546 if (isPasteCommandName(commandName)) 2547 willPerformPasteCommand(); 2553 2548 2554 2549 if (commandName == ignoreSpellingCommandName) … … 6617 6612 #endif 6618 6613 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));6614 void WebPageProxy::requestDOMPasteAccess(const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler) 6615 { 6616 m_pageClient->requestDOMPasteAccess(elementRect, originIdentifier, WTFMove(completionHandler)); 6622 6617 } 6623 6618 … … 10820 10815 #if !PLATFORM(COCOA) 10821 10816 10822 void WebPageProxy::willPerformPasteCommand( DOMPasteAccessCategory)10817 void WebPageProxy::willPerformPasteCommand() 10823 10818 { 10824 10819 } -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r286641 r286705 268 268 enum class CookieConsentDecisionResult : uint8_t; 269 269 enum class CreateNewGroupForHighlight : bool; 270 enum class DOMPasteAccessCategory : uint8_t;271 270 enum class DOMPasteAccessResponse : uint8_t; 272 271 enum class EventMakesGamepadsVisible : bool; … … 2262 2261 #endif 2263 2262 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(); 2266 2265 2267 2266 // Back/Forward list management -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r286640 r286705 233 233 #endif 234 234 235 RequestDOMPasteAccess( enum:uint8_t WebCore::DOMPasteAccessCategory pasteAccessCategory,WebCore::IntRect elementRect, String originIdentifier) -> (enum:uint8_t WebCore::DOMPasteAccessResponse response) Synchronous235 RequestDOMPasteAccess(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
r286632 r286705 39 39 40 40 namespace WebCore { 41 enum class DOMPasteAccessCategory : uint8_t;42 41 enum class DOMPasteAccessResponse : uint8_t; 43 42 struct PromisedAttachmentInfo; … … 268 267 #endif 269 268 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; 271 270 272 271 #if ENABLE(DRAG_SUPPORT) -
trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
r286632 r286705 952 952 #endif 953 953 954 void PageClientImpl::requestDOMPasteAccess( WebCore::DOMPasteAccessCategory pasteAccessCategory,const WebCore::IntRect& elementRect, const String& originIdentifier, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)955 { 956 [m_contentView _requestDOMPasteAccess ForCategory:pasteAccessCategory elementRect:elementRect originIdentifier:originIdentifier completionHandler:WTFMove(completionHandler)];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)]; 957 957 } 958 958 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
r286641 r286705 91 91 struct ShareDataWithParsedURL; 92 92 struct TextRecognitionResult; 93 enum class DOMPasteAccessCategory : uint8_t;94 93 enum class DOMPasteAccessResponse : uint8_t; 95 94 enum class MouseEventPolicy : uint8_t; … … 677 676 - (void)updateFocusedElementFocusedWithDataListDropdown:(BOOL)value; 678 677 679 - (void)_requestDOMPasteAccess ForCategory:(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; 680 679 681 680 - (void)doAfterPositionInformationUpdate:(void (^)(WebKit::InteractionInformationAtPosition))action forRequest:(WebKit::InteractionInformationRequest)request; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r286660 r286705 1270 1270 1271 1271 [self _resetPanningPreventionFlags]; 1272 [self _h idePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];1272 [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture]; 1273 1273 [self _cancelPendingKeyEventHandler]; 1274 1274 … … 1659 1659 1660 1660 if (superDidResign) { 1661 [self _h idePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];1661 [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture]; 1662 1662 _page->activityStateDidChange(WebCore::ActivityState::IsFocused, WebKit::WebPageProxy::ActivityStateChangeDispatchMode::Immediate); 1663 1663 … … 1727 1727 _lastInteractionLocation = lastTouchEvent->locationInDocumentCoordinates; 1728 1728 if (lastTouchEvent->type == UIWebTouchEventTouchBegin) { 1729 [self _h idePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];1729 [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture]; 1730 1730 _layerTreeTransactionIdAtLastInteractionStart = downcast<WebKit::RemoteLayerTreeDrawingAreaProxy>(*_page->drawingArea()).lastCommittedLayerTreeTransactionID(); 1731 1731 … … 3991 3991 - (void)_willHideMenu:(NSNotification *)notification 3992 3992 { 3993 [self _h idePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];3993 [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture]; 3994 3994 } 3995 3995 … … 4019 4019 - (void)pasteForWebView:(id)sender 4020 4020 { 4021 if (sender == UIMenuController.sharedMenuController && [self _h idePasteMenuWithResult:WebCore::DOMPasteAccessResponse::GrantedForGesture])4021 if (sender == UIMenuController.sharedMenuController && [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::GrantedForGesture]) 4022 4022 return; 4023 4023 … … 4165 4165 } 4166 4166 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 4185 4172 if (auto pasteHandler = WTFMove(_domPasteRequestHandler)) { 4186 4173 [UIMenuController.sharedMenuController hideMenuFromView:self]; … … 4191 4178 } 4192 4179 4193 - (BOOL)_handleDOMPasteRequestForCategory:(WebCore::DOMPasteAccessCategory)pasteAccessCategory result:(WebCore::DOMPasteAccessResponse)response4194 {4195 if (response == WebCore::DOMPasteAccessResponse::GrantedForCommand || response == WebCore::DOMPasteAccessResponse::GrantedForGesture)4196 _page->grantAccessToCurrentPasteboardData(pasteboardNameForAccessCategory(pasteAccessCategory));4197 4198 return [self _hidePasteMenuWithResult:response];4199 }4200 4201 4180 - (void)_willPerformAction:(SEL)action sender:(id)sender 4202 4181 { 4203 4182 if (action != @selector(paste:)) 4204 [self _h idePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];4183 [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture]; 4205 4184 } 4206 4185 … … 4208 4187 { 4209 4188 if (action == @selector(paste:)) 4210 [self _h idePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];4189 [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture]; 4211 4190 } 4212 4191 … … 5868 5847 } 5869 5848 5870 [self _h idePasteMenuWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture];5849 [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::DeniedForGesture]; 5871 5850 5872 5851 using HandledByInputMethod = WebKit::NativeWebKeyboardEvent::HandledByInputMethod; … … 6657 6636 } 6658 6637 6659 - (void)_requestDOMPasteAccess ForCategory:(WebCore::DOMPasteAccessCategory)pasteAccessCategory elementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler6638 - (void)_requestDOMPasteAccessWithElementRect:(const WebCore::IntRect&)elementRect originIdentifier:(const String&)originIdentifier completionHandler:(CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&&)completionHandler 6660 6639 { 6661 6640 if (auto existingCompletionHandler = std::exchange(_domPasteRequestHandler, WTFMove(completionHandler))) { … … 6664 6643 } 6665 6644 6666 if (allPasteboardItemOriginsMatchOrigin( pasteboardForAccessCategory(pasteAccessCategory), originIdentifier)) {6667 [self _handleDOMPasteRequest ForCategory:pasteAccessCategory result:WebCore::DOMPasteAccessResponse::GrantedForCommand];6645 if (allPasteboardItemOriginsMatchOrigin(UIPasteboard.generalPasteboard, originIdentifier)) { 6646 [self _handleDOMPasteRequestWithResult:WebCore::DOMPasteAccessResponse::GrantedForCommand]; 6668 6647 return; 6669 6648 } -
trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
r286632 r286705 1545 1545 #endif 1546 1546 1547 void WebPageProxy::willPerformPasteCommand(DOMPasteAccessCategory pasteAccessCategory) 1548 { 1549 switch (pasteAccessCategory) { 1550 case DOMPasteAccessCategory::General: 1551 grantAccessToCurrentPasteboardData(UIPasteboardNameGeneral); 1552 return; 1553 } 1547 void WebPageProxy::willPerformPasteCommand() 1548 { 1549 grantAccessToCurrentPasteboardData(UIPasteboardNameGeneral); 1554 1550 } 1555 1551 -
trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h
r286632 r286705 226 226 void didRemoveNavigationGestureSnapshot() override; 227 227 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; 229 229 230 230 void makeViewBlank(bool) final; -
trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm
r286632 r286705 1001 1001 } 1002 1002 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));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)); 1006 1006 } 1007 1007 -
trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
r286632 r286705 652 652 #endif 653 653 654 void WebPageProxy::willPerformPasteCommand(DOMPasteAccessCategory pasteAccessCategory) 655 { 656 switch (pasteAccessCategory) { 657 case DOMPasteAccessCategory::General: 658 grantAccessToCurrentPasteboardData(NSPasteboardNameGeneral); 659 return; 660 } 654 void WebPageProxy::willPerformPasteCommand() 655 { 656 grantAccessToCurrentPasteboardData(NSPasteboardNameGeneral); 661 657 } 662 658 -
trunk/Source/WebKit/UIProcess/playstation/PageClientImpl.cpp
r286632 r286705 318 318 } 319 319 320 void PageClientImpl::requestDOMPasteAccess( WebCore::DOMPasteAccessCategory,const WebCore::IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)320 void PageClientImpl::requestDOMPasteAccess(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
r286632 r286705 150 150 WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override; 151 151 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; 153 153 154 154 PlayStationWebView& m_view; -
trunk/Source/WebKit/UIProcess/win/PageClientImpl.cpp
r286632 r286705 374 374 } 375 375 376 void PageClientImpl::requestDOMPasteAccess( WebCore::DOMPasteAccessCategory,const IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler)376 void PageClientImpl::requestDOMPasteAccess(const IntRect&, const String&, CompletionHandler<void(WebCore::DOMPasteAccessResponse)>&& completionHandler) 377 377 { 378 378 completionHandler(WebCore::DOMPasteAccessResponse::DeniedForGesture); -
trunk/Source/WebKit/UIProcess/win/PageClientImpl.h
r286632 r286705 36 36 37 37 namespace WebCore { 38 enum class DOMPasteAccessCategory : uint8_t;39 38 enum class DOMPasteAccessResponse : uint8_t; 40 39 } … … 150 149 WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override { return WebCore::UserInterfaceLayoutDirection::LTR; } 151 150 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; 153 152 154 153 // Members of PageClientImpl class -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp
r286632 r286705 333 333 } 334 334 335 WebCore::DOMPasteAccessResponse WebEditorClient::requestDOMPasteAccess( WebCore::DOMPasteAccessCategory pasteAccessCategory,const String& originIdentifier)336 { 337 return m_page->requestDOMPasteAccess( pasteAccessCategory,originIdentifier);335 WebCore::DOMPasteAccessResponse WebEditorClient::requestDOMPasteAccess(const String& originIdentifier) 336 { 337 return m_page->requestDOMPasteAccess(originIdentifier); 338 338 } 339 339 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.h
r286632 r286705 30 30 31 31 namespace WebCore { 32 enum class DOMPasteAccessCategory : uint8_t;33 32 enum class DOMPasteAccessResponse : uint8_t; 34 33 } … … 95 94 void clearUndoRedoOperations() final; 96 95 97 WebCore::DOMPasteAccessResponse requestDOMPasteAccess( WebCore::DOMPasteAccessCategory,const String& originIdentifier) final;96 WebCore::DOMPasteAccessResponse requestDOMPasteAccess(const String& originIdentifier) final; 98 97 99 98 bool canCopyCut(WebCore::Frame*, bool defaultValue) const final; -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r286641 r286705 7208 7208 } 7209 7209 7210 WebCore::DOMPasteAccessResponse WebPage::requestDOMPasteAccess( WebCore::DOMPasteAccessCategory pasteAccessCategory,const String& originIdentifier)7210 WebCore::DOMPasteAccessResponse WebPage::requestDOMPasteAccess(const String& originIdentifier) 7211 7211 { 7212 7212 auto response = WebCore::DOMPasteAccessResponse::DeniedForGesture; … … 7218 7218 send(Messages::WebPageProxy::HandleAutocorrectionContext(autocorrectionContext())); 7219 7219 #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)); 7221 7221 return response; 7222 7222 } -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r286641 r286705 225 225 enum class COEPDisposition : bool; 226 226 enum class CreateNewGroupForHighlight : bool; 227 enum class DOMPasteAccessCategory : uint8_t;228 227 enum class DOMPasteAccessResponse : uint8_t; 229 228 enum class DragApplicationFlags : uint8_t; … … 1341 1340 } 1342 1341 1343 WebCore::DOMPasteAccessResponse requestDOMPasteAccess( WebCore::DOMPasteAccessCategory,const String& originIdentifier);1342 WebCore::DOMPasteAccessResponse requestDOMPasteAccess(const String& originIdentifier); 1344 1343 WebCore::IntRect rectForElementAtInteractionLocation() const; 1345 1344 -
trunk/Source/WebKitLegacy/mac/ChangeLog
r286640 r286705 1 2021-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 1 14 2021-12-07 Wenson Hsieh <wenson_hsieh@apple.com> 2 15 -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h
r286632 r286705 84 84 85 85 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; } 87 87 88 88 #if USE(APPKIT) -
trunk/Source/WebKitLegacy/win/ChangeLog
r286640 r286705 1 2021-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 1 14 2021-12-07 Wenson Hsieh <wenson_hsieh@apple.com> 2 15 -
trunk/Source/WebKitLegacy/win/WebCoreSupport/WebEditorClient.h
r286632 r286705 118 118 bool performTwoStepDrop(WebCore::DocumentFragment&, const WebCore::SimpleRange&, bool) final { return false; } 119 119 120 WebCore::DOMPasteAccessResponse requestDOMPasteAccess( WebCore::DOMPasteAccessCategory,const String&) final { return WebCore::DOMPasteAccessResponse::DeniedForGesture; }120 WebCore::DOMPasteAccessResponse requestDOMPasteAccess(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.