Diff
Modified: trunk/Source/WebKit/ChangeLog (243325 => 243326)
--- trunk/Source/WebKit/ChangeLog 2019-03-21 21:03:43 UTC (rev 243325)
+++ trunk/Source/WebKit/ChangeLog 2019-03-21 21:04:40 UTC (rev 243326)
@@ -1,5 +1,31 @@
2019-03-21 Alex Christensen <[email protected]>
+ Stop using LegacySync messages in WebPage
+ https://bugs.webkit.org/show_bug.cgi?id=196057
+
+ Reviewed by Chris Dumez.
+
+ * WebProcess/WebPage/WebPage.h:
+ (WebKit::WebPage::markLayersVolatile):
+ * WebProcess/WebPage/WebPage.messages.in:
+ * WebProcess/WebPage/gtk/WebPageGtk.cpp:
+ (WebKit::WebPage::getCenterForZoomGesture):
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::readSelectionFromPasteboard):
+ (WebKit::WebPage::getStringSelectionForPasteboard):
+ (WebKit::WebPage::getDataSelectionForPasteboard):
+ (WebKit::WebPage::shouldDelayWindowOrderingEvent):
+ (WebKit::WebPage::acceptsFirstMouse):
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::replaceSelectionWithPasteboardData):
+ (WebKit::WebPage::readSelectionFromPasteboard):
+ (WebKit::WebPage::getStringSelectionForPasteboard):
+ (WebKit::WebPage::getDataSelectionForPasteboard):
+ (WebKit::WebPage::shouldDelayWindowOrderingEvent):
+ (WebKit::WebPage::acceptsFirstMouse):
+
+2019-03-21 Alex Christensen <[email protected]>
+
Stop using LegacySync messages in WebPasteboardProxy
https://bugs.webkit.org/show_bug.cgi?id=196060
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (243325 => 243326)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-03-21 21:03:43 UTC (rev 243325)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-03-21 21:04:40 UTC (rev 243326)
@@ -705,7 +705,7 @@
void freezeLayerTree(LayerTreeFreezeReason);
void unfreezeLayerTree(LayerTreeFreezeReason);
- void markLayersVolatile(WTF::Function<void (bool)>&& completionHandler = { });
+ void markLayersVolatile(Function<void(bool)>&& completionHandler = { });
void cancelMarkLayersVolatile();
NotificationPermissionRequestManager* notificationPermissionRequestManager();
@@ -754,7 +754,7 @@
#endif
#if PLATFORM (GTK) && HAVE(GTK_GESTURES)
- void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, WebCore::IntPoint& result);
+ void getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, CompletionHandler<void(WebCore::IntPoint&&)>&&);
#endif
void didApplyStyle();
@@ -782,11 +782,11 @@
void setCompositionAsync(const String& text, const Vector<WebCore::CompositionUnderline>& underlines, const EditingRange& selectionRange, const EditingRange& replacementRange);
void confirmCompositionAsync();
- void readSelectionFromPasteboard(const WTF::String& pasteboardName, bool& result);
- void getStringSelectionForPasteboard(WTF::String& stringValue);
- void getDataSelectionForPasteboard(const WTF::String pasteboardType, SharedMemory::Handle& handle, uint64_t& size);
- void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool& result);
- void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, bool& result);
+ void readSelectionFromPasteboard(const String& pasteboardName, CompletionHandler<void(bool&&)>&&);
+ void getStringSelectionForPasteboard(CompletionHandler<void(String&&)>&&);
+ void getDataSelectionForPasteboard(const String pasteboardType, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&&);
+ void shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, CompletionHandler<void(bool)>&&);
+ void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, CompletionHandler<void(bool)>&&);
bool performNonEditingBehaviorForSelector(const String&, WebCore::KeyboardEvent*);
#endif
@@ -1122,7 +1122,7 @@
void shouldAllowDeviceOrientationAndMotionAccess(uint64_t frameID, WebCore::SecurityOriginData&&, CompletionHandler<void(bool)>&&);
#endif
- void showShareSheet(WebCore::ShareDataWithParsedURL&, WTF::CompletionHandler<void(bool)>&& callback);
+ void showShareSheet(WebCore::ShareDataWithParsedURL&, CompletionHandler<void(bool)>&& callback);
void didCompleteShareSheet(bool wasCompleted, ShareSheetCallbackID contextId);
#if ENABLE(ATTACHMENT_ELEMENT)
@@ -1813,7 +1813,7 @@
#endif
WebCore::Timer m_layerVolatilityTimer;
- Vector<WTF::Function<void (bool)>> m_markLayersAsVolatileCompletionHandlers;
+ Vector<Function<void(bool)>> m_markLayersAsVolatileCompletionHandlers;
bool m_isSuspendedUnderLock { false };
HashSet<String, ASCIICaseInsensitiveHash> m_mimeTypesWithCustomContentProviders;
@@ -1868,8 +1868,8 @@
HashMap<String, RefPtr<WebURLSchemeHandlerProxy>> m_schemeToURLSchemeHandlerProxyMap;
HashMap<uint64_t, WebURLSchemeHandlerProxy*> m_identifierToURLSchemeHandlerProxyMap;
- HashMap<uint64_t, WTF::Function<void(bool granted)>> m_storageAccessResponseCallbackMap;
- HashMap<ShareSheetCallbackID, WTF::Function<void(bool completed)>> m_shareSheetResponseCallbackMap;
+ HashMap<uint64_t, Function<void(bool granted)>> m_storageAccessResponseCallbackMap;
+ HashMap<ShareSheetCallbackID, Function<void(bool completed)>> m_shareSheetResponseCallbackMap;
#if ENABLE(APPLICATION_MANIFEST)
HashMap<uint64_t, uint64_t> m_applicationManifestFetchCallbackMap;
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (243325 => 243326)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2019-03-21 21:03:43 UTC (rev 243325)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2019-03-21 21:04:40 UTC (rev 243326)
@@ -407,7 +407,7 @@
#endif
#if PLATFORM (GTK) && HAVE(GTK_GESTURES)
- GetCenterForZoomGesture(WebCore::IntPoint centerInViewCoordinates) -> (WebCore::IntPoint center) LegacySync
+ GetCenterForZoomGesture(WebCore::IntPoint centerInViewCoordinates) -> (WebCore::IntPoint center) Delayed
#endif
#if PLATFORM(COCOA)
@@ -417,16 +417,16 @@
WindowAndViewFramesChanged(WebCore::FloatRect windowFrameInScreenCoordinates, WebCore::FloatRect windowFrameInUnflippedScreenCoordinates, WebCore::FloatRect viewFrameInWindowCoordinates, WebCore::FloatPoint accessibilityViewCoordinates)
SetMainFrameIsScrollable(bool isScrollable)
RegisterUIProcessAccessibilityTokens(IPC::DataReference elemenToken, IPC::DataReference windowToken)
- GetStringSelectionForPasteboard() -> (String stringValue) LegacySync
- GetDataSelectionForPasteboard(String pasteboardType) -> (WebKit::SharedMemory::Handle handle, uint64_t size) LegacySync
- ReadSelectionFromPasteboard(String pasteboardName) -> (bool result) LegacySync
+ GetStringSelectionForPasteboard() -> (String stringValue) Delayed
+ GetDataSelectionForPasteboard(String pasteboardType) -> (WebKit::SharedMemory::Handle handle, uint64_t size) Delayed
+ ReadSelectionFromPasteboard(String pasteboardName) -> (bool result) Delayed
#if ENABLE(SERVICE_CONTROLS)
ReplaceSelectionWithPasteboardData(Vector<String> types, IPC::DataReference data)
#endif
- ShouldDelayWindowOrderingEvent(WebKit::WebMouseEvent event) -> (bool result) LegacySync
- AcceptsFirstMouse(int eventNumber, WebKit::WebMouseEvent event) -> (bool result) LegacySync
+ ShouldDelayWindowOrderingEvent(WebKit::WebMouseEvent event) -> (bool result) Delayed
+ AcceptsFirstMouse(int eventNumber, WebKit::WebMouseEvent event) -> (bool result) Delayed
SetTextAsync(String text)
InsertTextAsync(String text, struct WebKit::EditingRange replacementRange, bool registerUndoGroup, uint32_t editingRangeIsRelativeTo, bool suppressSelectionUpdate)
Modified: trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp (243325 => 243326)
--- trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp 2019-03-21 21:03:43 UTC (rev 243325)
+++ trunk/Source/WebKit/WebProcess/WebPage/gtk/WebPageGtk.cpp 2019-03-21 21:04:40 UTC (rev 243326)
@@ -176,11 +176,12 @@
}
#if HAVE(GTK_GESTURES)
-void WebPage::getCenterForZoomGesture(const IntPoint& centerInViewCoordinates, IntPoint& result)
+void WebPage::getCenterForZoomGesture(const IntPoint& centerInViewCoordinates, CompletionHandler<void(WebCore::IntPoint&&)>&& completionHandler)
{
- result = mainFrameView()->rootViewToContents(centerInViewCoordinates);
+ IntPoint result = mainFrameView()->rootViewToContents(centerInViewCoordinates);
double scale = m_page->pageScaleFactor();
result.scale(1 / scale, 1 / scale);
+ completionHandler(WTFMove(result));
}
#endif
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (243325 => 243326)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-03-21 21:03:43 UTC (rev 243325)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-03-21 21:04:40 UTC (rev 243326)
@@ -479,19 +479,22 @@
[m_mockAccessibilityElement setRemoteTokenData:elementTokenData];
}
-void WebPage::readSelectionFromPasteboard(const String&, bool&)
+void WebPage::readSelectionFromPasteboard(const String&, CompletionHandler<void(bool&&)>&& completionHandler)
{
notImplemented();
+ completionHandler(false);
}
-void WebPage::getStringSelectionForPasteboard(String&)
+void WebPage::getStringSelectionForPasteboard(CompletionHandler<void(String&&)>&& completionHandler)
{
notImplemented();
+ completionHandler({ });
}
-void WebPage::getDataSelectionForPasteboard(const String, SharedMemory::Handle&, uint64_t&)
+void WebPage::getDataSelectionForPasteboard(const String, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&& completionHandler)
{
notImplemented();
+ completionHandler({ }, 0);
}
WKAccessibilityWebPageObject* WebPage::accessibilityRemoteObject()
@@ -506,14 +509,16 @@
return false;
}
-void WebPage::shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, bool&)
+void WebPage::shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent&, CompletionHandler<void(bool)>&& completionHandler)
{
notImplemented();
+ completionHandler(false);
}
-void WebPage::acceptsFirstMouse(int, const WebKit::WebMouseEvent&, bool&)
+void WebPage::acceptsFirstMouse(int, const WebKit::WebMouseEvent&, CompletionHandler<void(bool)>&& completionHandler)
{
notImplemented();
+ completionHandler(false);
}
void WebPage::computePagesForPrintingPDFDocument(uint64_t, const PrintInfo&, Vector<IntRect>&)
Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm (243325 => 243326)
--- trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm 2019-03-21 21:03:43 UTC (rev 243325)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm 2019-03-21 21:04:40 UTC (rev 243326)
@@ -504,8 +504,7 @@
for (auto& type : types)
WebPasteboardOverrides::sharedPasteboardOverrides().addOverride(replaceSelectionPasteboardName(), type, data.vector());
- bool result;
- readSelectionFromPasteboard(replaceSelectionPasteboardName(), result);
+ readSelectionFromPasteboard(replaceSelectionPasteboardName(), [](bool) { });
for (auto& type : types)
WebPasteboardOverrides::sharedPasteboardOverrides().removeOverride(replaceSelectionPasteboardName(), type);
@@ -529,50 +528,46 @@
[accessibilityRemoteObject() setRemoteParent:remoteElement.get()];
}
-void WebPage::readSelectionFromPasteboard(const String& pasteboardName, bool& result)
+void WebPage::readSelectionFromPasteboard(const String& pasteboardName, CompletionHandler<void(bool&&)>&& completionHandler)
{
- Frame& frame = m_page->focusController().focusedOrMainFrame();
- if (frame.selection().isNone()) {
- result = false;
- return;
- }
+ auto& frame = m_page->focusController().focusedOrMainFrame();
+ if (frame.selection().isNone())
+ return completionHandler(false);
frame.editor().readSelectionFromPasteboard(pasteboardName);
- result = true;
+ completionHandler(true);
}
-void WebPage::getStringSelectionForPasteboard(String& stringValue)
+void WebPage::getStringSelectionForPasteboard(CompletionHandler<void(String&&)>&& completionHandler)
{
Frame& frame = m_page->focusController().focusedOrMainFrame();
- if (PluginView* pluginView = focusedPluginViewForFrame(frame)) {
+ if (auto* pluginView = focusedPluginViewForFrame(frame)) {
String selection = pluginView->getSelectionString();
- if (!selection.isNull()) {
- stringValue = selection;
- return;
- }
+ if (!selection.isNull())
+ return completionHandler(WTFMove(selection));
}
if (frame.selection().isNone())
- return;
+ return completionHandler({ });
- stringValue = frame.editor().stringSelectionForPasteboard();
+ completionHandler(frame.editor().stringSelectionForPasteboard());
}
-void WebPage::getDataSelectionForPasteboard(const String pasteboardType, SharedMemory::Handle& handle, uint64_t& size)
+void WebPage::getDataSelectionForPasteboard(const String pasteboardType, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&& completionHandler)
{
- Frame& frame = m_page->focusController().focusedOrMainFrame();
+ auto& frame = m_page->focusController().focusedOrMainFrame();
if (frame.selection().isNone())
- return;
+ return completionHandler({ }, 0);
RefPtr<SharedBuffer> buffer = frame.editor().dataSelectionForPasteboard(pasteboardType);
- if (!buffer) {
- size = 0;
- return;
- }
- size = buffer->size();
+ if (!buffer)
+ return completionHandler({ }, 0);
+ uint64_t size = buffer->size();
RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::allocate(size);
memcpy(sharedMemoryBuffer->data(), buffer->data(), size);
+ SharedMemory::Handle handle;
sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly);
+ completionHandler(WTFMove(handle), size);
}
WKAccessibilityWebPageObject* WebPage::accessibilityRemoteObject()
@@ -589,33 +584,32 @@
return request.url().protocolIs("applewebdata");
}
-void WebPage::shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent& event, bool& result)
+void WebPage::shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent& event, CompletionHandler<void(bool)>&& completionHandler)
{
- Frame& frame = m_page->focusController().focusedOrMainFrame();
+ auto& frame = m_page->focusController().focusedOrMainFrame();
+ bool result = false;
#if ENABLE(DRAG_SUPPORT)
HitTestResult hitResult = frame.eventHandler().hitTestResultAtPoint(frame.view()->windowToContents(event.position()), HitTestRequest::ReadOnly | HitTestRequest::Active);
if (hitResult.isSelected())
result = frame.eventHandler().eventMayStartDrag(platform(event));
- else
#endif
- result = false;
+ completionHandler(result);
}
-void WebPage::acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent& event, bool& result)
+void WebPage::acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent& event, CompletionHandler<void(bool)>&& completionHandler)
{
- result = false;
-
if (WebProcess::singleton().parentProcessConnection()->inSendSync()) {
// In case we're already inside a sendSync message, it's possible that the page is in a
// transitionary state, so any hit-testing could cause crashes so we just return early in that case.
- return;
+ return completionHandler(false);
}
- Frame& frame = m_page->focusController().focusedOrMainFrame();
+ auto& frame = m_page->focusController().focusedOrMainFrame();
HitTestResult hitResult = frame.eventHandler().hitTestResultAtPoint(frame.view()->windowToContents(event.position()), HitTestRequest::ReadOnly | HitTestRequest::Active);
frame.eventHandler().setActivationEventNumber(eventNumber);
+ bool result = false;
#if ENABLE(DRAG_SUPPORT)
if (hitResult.isSelected())
result = frame.eventHandler().eventMayStartDrag(platform(event));
@@ -622,6 +616,7 @@
else
#endif
result = !!hitResult.scrollbar();
+ completionHandler(result);
}
void WebPage::setTopOverhangImage(WebImage* image)