Changeset 243326 in webkit
- Timestamp:
- Mar 21, 2019 2:04:40 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r243325 r243326 1 2019-03-21 Alex Christensen <achristensen@webkit.org> 2 3 Stop using LegacySync messages in WebPage 4 https://bugs.webkit.org/show_bug.cgi?id=196057 5 6 Reviewed by Chris Dumez. 7 8 * WebProcess/WebPage/WebPage.h: 9 (WebKit::WebPage::markLayersVolatile): 10 * WebProcess/WebPage/WebPage.messages.in: 11 * WebProcess/WebPage/gtk/WebPageGtk.cpp: 12 (WebKit::WebPage::getCenterForZoomGesture): 13 * WebProcess/WebPage/ios/WebPageIOS.mm: 14 (WebKit::WebPage::readSelectionFromPasteboard): 15 (WebKit::WebPage::getStringSelectionForPasteboard): 16 (WebKit::WebPage::getDataSelectionForPasteboard): 17 (WebKit::WebPage::shouldDelayWindowOrderingEvent): 18 (WebKit::WebPage::acceptsFirstMouse): 19 * WebProcess/WebPage/mac/WebPageMac.mm: 20 (WebKit::WebPage::replaceSelectionWithPasteboardData): 21 (WebKit::WebPage::readSelectionFromPasteboard): 22 (WebKit::WebPage::getStringSelectionForPasteboard): 23 (WebKit::WebPage::getDataSelectionForPasteboard): 24 (WebKit::WebPage::shouldDelayWindowOrderingEvent): 25 (WebKit::WebPage::acceptsFirstMouse): 26 1 27 2019-03-21 Alex Christensen <achristensen@webkit.org> 2 28 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r243195 r243326 706 706 void unfreezeLayerTree(LayerTreeFreezeReason); 707 707 708 void markLayersVolatile( WTF::Function<void(bool)>&& completionHandler = { });708 void markLayersVolatile(Function<void(bool)>&& completionHandler = { }); 709 709 void cancelMarkLayersVolatile(); 710 710 … … 755 755 756 756 #if PLATFORM (GTK) && HAVE(GTK_GESTURES) 757 void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, WebCore::IntPoint& result);757 void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, CompletionHandler<void(WebCore::IntPoint&&)>&&); 758 758 #endif 759 759 … … 783 783 void confirmCompositionAsync(); 784 784 785 void readSelectionFromPasteboard(const WTF::String& pasteboardName, bool& result);786 void getStringSelectionForPasteboard( WTF::String& stringValue);787 void getDataSelectionForPasteboard(const WTF::String pasteboardType, SharedMemory::Handle& handle, uint64_t& size);788 void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool& result);789 void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, bool& result);785 void readSelectionFromPasteboard(const String& pasteboardName, CompletionHandler<void(bool&&)>&&); 786 void getStringSelectionForPasteboard(CompletionHandler<void(String&&)>&&); 787 void getDataSelectionForPasteboard(const String pasteboardType, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&&); 788 void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, CompletionHandler<void(bool)>&&); 789 void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, CompletionHandler<void(bool)>&&); 790 790 bool performNonEditingBehaviorForSelector(const String&, WebCore::KeyboardEvent*); 791 791 #endif … … 1123 1123 #endif 1124 1124 1125 void showShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback);1125 void showShareSheet(WebCore::ShareDataWithParsedURL&, CompletionHandler<void(bool)>&& callback); 1126 1126 void didCompleteShareSheet(bool wasCompleted, ShareSheetCallbackID contextId); 1127 1127 … … 1814 1814 1815 1815 WebCore::Timer m_layerVolatilityTimer; 1816 Vector< WTF::Function<void(bool)>> m_markLayersAsVolatileCompletionHandlers;1816 Vector<Function<void(bool)>> m_markLayersAsVolatileCompletionHandlers; 1817 1817 bool m_isSuspendedUnderLock { false }; 1818 1818 … … 1869 1869 HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap; 1870 1870 1871 HashMap<uint64_t, WTF::Function<void(bool granted)>> m_storageAccessResponseCallbackMap;1872 HashMap<ShareSheetCallbackID, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap;1871 HashMap<uint64_t, Function<void(bool granted)>> m_storageAccessResponseCallbackMap; 1872 HashMap<ShareSheetCallbackID, Function<void(bool completed)>> m_shareSheetResponseCallbackMap; 1873 1873 1874 1874 #if ENABLE(APPLICATION_MANIFEST) -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
r243012 r243326 408 408 409 409 #if PLATFORM (GTK) && HAVE(GTK_GESTURES) 410 GetCenterForZoomGesture(WebCore::IntPoint centerInViewCoordinates) -> (WebCore::IntPoint center) LegacySync410 GetCenterForZoomGesture(WebCore::IntPoint centerInViewCoordinates) -> (WebCore::IntPoint center) Delayed 411 411 #endif 412 412 … … 418 418 SetMainFrameIsScrollable(bool isScrollable) 419 419 RegisterUIProcessAccessibilityTokens(IPC::DataReference elemenToken, IPC::DataReference windowToken) 420 GetStringSelectionForPasteboard() -> (String stringValue) LegacySync421 GetDataSelectionForPasteboard(String pasteboardType) -> (WebKit::SharedMemory::Handle handle, uint64_t size) LegacySync422 ReadSelectionFromPasteboard(String pasteboardName) -> (bool result) LegacySync420 GetStringSelectionForPasteboard() -> (String stringValue) Delayed 421 GetDataSelectionForPasteboard(String pasteboardType) -> (WebKit::SharedMemory::Handle handle, uint64_t size) Delayed 422 ReadSelectionFromPasteboard(String pasteboardName) -> (bool result) Delayed 423 423 424 424 #if ENABLE(SERVICE_CONTROLS) … … 426 426 #endif 427 427 428 ShouldDelayWindowOrderingEvent(WebKit::WebMouseEvent event) -> (bool result) LegacySync429 AcceptsFirstMouse(int eventNumber, WebKit::WebMouseEvent event) -> (bool result) LegacySync428 ShouldDelayWindowOrderingEvent(WebKit::WebMouseEvent event) -> (bool result) Delayed 429 AcceptsFirstMouse(int eventNumber, WebKit::WebMouseEvent event) -> (bool result) Delayed 430 430 431 431 SetTextAsync(String text) -
trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp
r241721 r243326 177 177 178 178 #if HAVE(GTK_GESTURES) 179 void WebPage::getCenterForZoomGesture(const IntPoint& centerInViewCoordinates, IntPoint& result)180 { 181 result = mainFrameView()->rootViewToContents(centerInViewCoordinates);179 void WebPage::getCenterForZoomGesture(const IntPoint& centerInViewCoordinates, CompletionHandler<void(WebCore::IntPoint&&)>&& completionHandler) 180 { 181 IntPoint result = mainFrameView()->rootViewToContents(centerInViewCoordinates); 182 182 double scale = m_page->pageScaleFactor(); 183 183 result.scale(1 / scale, 1 / scale); 184 completionHandler(WTFMove(result)); 184 185 } 185 186 #endif -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r243102 r243326 480 480 } 481 481 482 void WebPage::readSelectionFromPasteboard(const String&, bool&)482 void WebPage::readSelectionFromPasteboard(const String&, CompletionHandler<void(bool&&)>&& completionHandler) 483 483 { 484 484 notImplemented(); 485 } 486 487 void WebPage::getStringSelectionForPasteboard(String&) 485 completionHandler(false); 486 } 487 488 void WebPage::getStringSelectionForPasteboard(CompletionHandler<void(String&&)>&& completionHandler) 488 489 { 489 490 notImplemented(); 490 } 491 492 void WebPage::getDataSelectionForPasteboard(const String, SharedMemory::Handle&, uint64_t&) 491 completionHandler({ }); 492 } 493 494 void WebPage::getDataSelectionForPasteboard(const String, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&& completionHandler) 493 495 { 494 496 notImplemented(); 497 completionHandler({ }, 0); 495 498 } 496 499 … … 507 510 } 508 511 509 void WebPage::shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool&)512 void WebPage::shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, CompletionHandler<void(bool)>&& completionHandler) 510 513 { 511 514 notImplemented(); 512 } 513 514 void WebPage::acceptsFirstMouse(int, const WebKit::WebMouseEvent&, bool&) 515 completionHandler(false); 516 } 517 518 void WebPage::acceptsFirstMouse(int, const WebKit::WebMouseEvent&, CompletionHandler<void(bool)>&& completionHandler) 515 519 { 516 520 notImplemented(); 521 completionHandler(false); 517 522 } 518 523 -
trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
r242320 r243326 505 505 WebPasteboardOverrides::sharedPasteboardOverrides().addOverride(replaceSelectionPasteboardName(), type, data.vector()); 506 506 507 bool result; 508 readSelectionFromPasteboard(replaceSelectionPasteboardName(), result); 507 readSelectionFromPasteboard(replaceSelectionPasteboardName(), [](bool) { }); 509 508 510 509 for (auto& type : types) … … 530 529 } 531 530 532 void WebPage::readSelectionFromPasteboard(const String& pasteboardName, bool& result) 531 void WebPage::readSelectionFromPasteboard(const String& pasteboardName, CompletionHandler<void(bool&&)>&& completionHandler) 532 { 533 auto& frame = m_page->focusController().focusedOrMainFrame(); 534 if (frame.selection().isNone()) 535 return completionHandler(false); 536 frame.editor().readSelectionFromPasteboard(pasteboardName); 537 completionHandler(true); 538 } 539 540 void WebPage::getStringSelectionForPasteboard(CompletionHandler<void(String&&)>&& completionHandler) 533 541 { 534 542 Frame& frame = m_page->focusController().focusedOrMainFrame(); 535 if (frame.selection().isNone()) { 536 result = false; 537 return; 538 } 539 frame.editor().readSelectionFromPasteboard(pasteboardName); 540 result = true; 541 } 542 543 void WebPage::getStringSelectionForPasteboard(String& stringValue) 544 { 545 Frame& frame = m_page->focusController().focusedOrMainFrame(); 546 547 if (PluginView* pluginView = focusedPluginViewForFrame(frame)) { 543 544 if (auto* pluginView = focusedPluginViewForFrame(frame)) { 548 545 String selection = pluginView->getSelectionString(); 549 if (!selection.isNull()) { 550 stringValue = selection; 551 return; 552 } 546 if (!selection.isNull()) 547 return completionHandler(WTFMove(selection)); 553 548 } 554 549 555 550 if (frame.selection().isNone()) 556 return ;557 558 stringValue = frame.editor().stringSelectionForPasteboard();559 } 560 561 void WebPage::getDataSelectionForPasteboard(const String pasteboardType, SharedMemory::Handle& handle, uint64_t& size)562 { 563 Frame& frame = m_page->focusController().focusedOrMainFrame();551 return completionHandler({ }); 552 553 completionHandler(frame.editor().stringSelectionForPasteboard()); 554 } 555 556 void WebPage::getDataSelectionForPasteboard(const String pasteboardType, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&& completionHandler) 557 { 558 auto& frame = m_page->focusController().focusedOrMainFrame(); 564 559 if (frame.selection().isNone()) 565 return ;560 return completionHandler({ }, 0); 566 561 567 562 RefPtr<SharedBuffer> buffer = frame.editor().dataSelectionForPasteboard(pasteboardType); 568 if (!buffer) { 569 size = 0; 570 return; 571 } 572 size = buffer->size(); 563 if (!buffer) 564 return completionHandler({ }, 0); 565 uint64_t size = buffer->size(); 573 566 RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::allocate(size); 574 567 memcpy(sharedMemoryBuffer->data(), buffer->data(), size); 568 SharedMemory::Handle handle; 575 569 sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly); 570 completionHandler(WTFMove(handle), size); 576 571 } 577 572 … … 590 585 } 591 586 592 void WebPage::shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent& event, bool& result) 593 { 594 Frame& frame = m_page->focusController().focusedOrMainFrame(); 595 587 void WebPage::shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent& event, CompletionHandler<void(bool)>&& completionHandler) 588 { 589 auto& frame = m_page->focusController().focusedOrMainFrame(); 590 591 bool result = false; 596 592 #if ENABLE(DRAG_SUPPORT) 597 593 HitTestResult hitResult = frame.eventHandler().hitTestResultAtPoint(frame.view()->windowToContents(event.position()), HitTestRequest::ReadOnly | HitTestRequest::Active); 598 594 if (hitResult.isSelected()) 599 595 result = frame.eventHandler().eventMayStartDrag(platform(event)); 600 else601 596 #endif 602 result = false; 603 } 604 605 void WebPage::acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent& event, bool& result) 606 { 607 result = false; 608 597 completionHandler(result); 598 } 599 600 void WebPage::acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent& event, CompletionHandler<void(bool)>&& completionHandler) 601 { 609 602 if (WebProcess::singleton().parentProcessConnection()->inSendSync()) { 610 603 // In case we're already inside a sendSync message, it's possible that the page is in a 611 604 // transitionary state, so any hit-testing could cause crashes so we just return early in that case. 612 return ;613 } 614 615 Frame& frame = m_page->focusController().focusedOrMainFrame();605 return completionHandler(false); 606 } 607 608 auto& frame = m_page->focusController().focusedOrMainFrame(); 616 609 617 610 HitTestResult hitResult = frame.eventHandler().hitTestResultAtPoint(frame.view()->windowToContents(event.position()), HitTestRequest::ReadOnly | HitTestRequest::Active); 618 611 frame.eventHandler().setActivationEventNumber(eventNumber); 612 bool result = false; 619 613 #if ENABLE(DRAG_SUPPORT) 620 614 if (hitResult.isSelected()) … … 623 617 #endif 624 618 result = !!hitResult.scrollbar(); 619 completionHandler(result); 625 620 } 626 621
Note: See TracChangeset
for help on using the changeset viewer.