Title: [262861] trunk/Source
Revision
262861
Author
bb...@apple.com
Date
2020-06-10 14:44:04 -0700 (Wed, 10 Jun 2020)

Log Message

WebDriver on non-iOS ports cannot perform ActionChain which has scrolling down to the element and click it
https://bugs.webkit.org/show_bug.cgi?id=208232
<rdar://problem/59859491>

Reviewed by Devin Rousso.

Source/WebCore:

* platform/ScrollView.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::rootViewToContents const):
Create a version of this function that works with FloatPoint.

Source/WebKit:

* UIProcess/Automation/mac/WebAutomationSessionMac.mm:
(WebKit::WebAutomationSession::platformSimulateMouseInteraction):
The provided coordinates are in LayoutViewport coordinate system, which does
not take topContentInset into account. Add back in the topContentInset
when translating to flipped window coordinates.

* WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::WebAutomationSessionProxy::computeElementLayout):
The calculations of element bounds and IVCP have an incorrect handling of
root coordinates as contents/absolute coordinates. Add the missing conversion.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (262860 => 262861)


--- trunk/Source/WebCore/ChangeLog	2020-06-10 21:26:41 UTC (rev 262860)
+++ trunk/Source/WebCore/ChangeLog	2020-06-10 21:44:04 UTC (rev 262861)
@@ -1,3 +1,16 @@
+2020-06-10  Brian Burg  <bb...@apple.com>
+
+        WebDriver on non-iOS ports cannot perform ActionChain which has scrolling down to the element and click it
+        https://bugs.webkit.org/show_bug.cgi?id=208232
+        <rdar://problem/59859491>
+
+        Reviewed by Devin Rousso.
+
+        * platform/ScrollView.h:
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::rootViewToContents const):
+        Create a version of this function that works with FloatPoint.
+
 2020-06-10  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, reverting r262718.

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (262860 => 262861)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2020-06-10 21:26:41 UTC (rev 262860)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2020-06-10 21:44:04 UTC (rev 262861)
@@ -944,6 +944,11 @@
     return contentsToView(rect);
 }
 
+FloatPoint ScrollView::rootViewToContents(const FloatPoint& rootViewPoint) const
+{
+    return viewToContents(convertFromRootView(rootViewPoint));
+}
+
 IntPoint ScrollView::rootViewToContents(const IntPoint& rootViewPoint) const
 {
     return viewToContents(convertFromRootView(rootViewPoint));

Modified: trunk/Source/WebCore/platform/ScrollView.h (262860 => 262861)


--- trunk/Source/WebCore/platform/ScrollView.h	2020-06-10 21:26:41 UTC (rev 262860)
+++ trunk/Source/WebCore/platform/ScrollView.h	2020-06-10 21:44:04 UTC (rev 262861)
@@ -279,6 +279,7 @@
     WEBCORE_EXPORT void setScrollbarsSuppressed(bool suppressed, bool repaintOnUnsuppress = false);
     bool scrollbarsSuppressed() const { return m_scrollbarsSuppressed; }
 
+    WEBCORE_EXPORT FloatPoint rootViewToContents(const FloatPoint&) const;
     WEBCORE_EXPORT IntPoint rootViewToContents(const IntPoint&) const;
     WEBCORE_EXPORT IntPoint contentsToRootView(const IntPoint&) const;
     WEBCORE_EXPORT FloatPoint contentsToRootView(const FloatPoint&) const;

Modified: trunk/Source/WebKit/ChangeLog (262860 => 262861)


--- trunk/Source/WebKit/ChangeLog	2020-06-10 21:26:41 UTC (rev 262860)
+++ trunk/Source/WebKit/ChangeLog	2020-06-10 21:44:04 UTC (rev 262861)
@@ -1,3 +1,22 @@
+2020-06-10  Brian Burg  <bb...@apple.com>
+
+        WebDriver on non-iOS ports cannot perform ActionChain which has scrolling down to the element and click it
+        https://bugs.webkit.org/show_bug.cgi?id=208232
+        <rdar://problem/59859491>
+
+        Reviewed by Devin Rousso.
+
+        * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
+        (WebKit::WebAutomationSession::platformSimulateMouseInteraction):
+        The provided coordinates are in LayoutViewport coordinate system, which does
+        not take topContentInset into account. Add back in the topContentInset
+        when translating to flipped window coordinates.
+
+        * WebProcess/Automation/WebAutomationSessionProxy.cpp:
+        (WebKit::WebAutomationSessionProxy::computeElementLayout):
+        The calculations of element bounds and IVCP have an incorrect handling of
+        root coordinates as contents/absolute coordinates. Add the missing conversion.
+
 2020-06-10  Brent Fulgham  <bfulg...@apple.com>
 
         [iOS] Update sandbox rules for correct sanitizer paths in current OS releases

Modified: trunk/Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm (262860 => 262861)


--- trunk/Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm	2020-06-10 21:26:41 UTC (rev 262860)
+++ trunk/Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm	2020-06-10 21:44:04 UTC (rev 262861)
@@ -140,7 +140,7 @@
 {
     IntRect windowRect;
 
-    IntPoint locationInView = WebCore::IntPoint(locationInViewport.x(), locationInViewport.y());
+    IntPoint locationInView = locationInViewport + IntPoint(0, page.topContentInset());
     page.rootViewToWindow(IntRect(locationInView, IntSize()), windowRect);
     IntPoint locationInWindow = windowRect.location();
 

Modified: trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp (262860 => 262861)


--- trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp	2020-06-10 21:26:41 UTC (rev 262860)
+++ trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp	2020-06-10 21:44:04 UTC (rev 262861)
@@ -688,7 +688,7 @@
         resultElementBounds = enclosingIntRect(mainView->absoluteToDocumentRect(mainView->rootViewToContents(elementBoundsInRootCoordinates)));
         break;
     case CoordinateSystem::LayoutViewport:
-        resultElementBounds = enclosingIntRect(mainView->absoluteToLayoutViewportRect(elementBoundsInRootCoordinates));
+        resultElementBounds = enclosingIntRect(mainView->absoluteToLayoutViewportRect(mainView->rootViewToContents(elementBoundsInRootCoordinates)));
         break;
     }
 
@@ -742,10 +742,10 @@
     auto inViewCenterPointInRootCoordinates = convertPointFromFrameClientToRootView(frameView, elementInViewCenterPoint);
     switch (coordinateSystem) {
     case CoordinateSystem::Page:
-        resultInViewCenterPoint = roundedIntPoint(mainView->absoluteToDocumentPoint(inViewCenterPointInRootCoordinates));
+        resultInViewCenterPoint = roundedIntPoint(mainView->absoluteToDocumentPoint(mainView->rootViewToContents(inViewCenterPointInRootCoordinates)));
         break;
     case CoordinateSystem::LayoutViewport:
-        resultInViewCenterPoint = roundedIntPoint(mainView->absoluteToLayoutViewportPoint(inViewCenterPointInRootCoordinates));
+        resultInViewCenterPoint = roundedIntPoint(mainView->absoluteToLayoutViewportPoint(mainView->rootViewToContents(inViewCenterPointInRootCoordinates)));
         break;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to