Web Automation: Automation.getBrowsingContext returns window origin that differs...
authorbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 May 2018 21:26:51 +0000 (21:26 +0000)
committerbburg@apple.com <bburg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 May 2018 21:26:51 +0000 (21:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=185571
<rdar://problem/40180785>

Reviewed by Timothy Hatcher.

This code path was refactored to use completion handlers. It seems that the window.screenX/Y
code path converts back to user coordinates but the WebDriver code path does not. Make them
consistent since that is how it is spec'd and tested.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::getWindowFrameWithCallback):
Convert the window frame to user coordinate space so it's the same as window.screenY.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231769 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebPageProxy.cpp

index 37351f5..19561f7 100644 (file)
@@ -1,3 +1,19 @@
+2018-05-11  Brian Burg  <bburg@apple.com>
+
+        Web Automation: Automation.getBrowsingContext returns window origin that differs from window.screenX/Y
+        https://bugs.webkit.org/show_bug.cgi?id=185571
+        <rdar://problem/40180785>
+
+        Reviewed by Timothy Hatcher.
+
+        This code path was refactored to use completion handlers. It seems that the window.screenX/Y
+        code path converts back to user coordinates but the WebDriver code path does not. Make them
+        consistent since that is how it is spec'd and tested.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::getWindowFrameWithCallback):
+        Convert the window frame to user coordinate space so it's the same as window.screenY.
+
 2018-05-14  Brian Burg  <bburg@apple.com>
 
         WebDriver: W3C test case actions/key.py::test_lone_keyup_sends_no_events is failing
index a67ba08..ee25951 100644 (file)
@@ -4437,7 +4437,9 @@ void WebPageProxy::getWindowFrame(Ref<Messages::WebPageProxy::GetWindowFrame::De
 
 void WebPageProxy::getWindowFrameWithCallback(Function<void(FloatRect)>&& completionHandler)
 {
-    m_uiClient->windowFrame(*this, WTFMove(completionHandler));
+    m_uiClient->windowFrame(*this, [this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)] (FloatRect frame) {
+        completionHandler(m_pageClient.convertToUserSpace(frame));
+    });
 }
 
 void WebPageProxy::screenToRootView(const IntPoint& screenPoint, Ref<Messages::WebPageProxy::ScreenToRootView::DelayedReply>&& reply)