| Summary: | Automation.computeElementLayout should return iframe-relative element rects (when coordinate system is 'Page') | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | BJ Burg <bburg> | ||||
| Component: | WebDriver | Assignee: | BJ Burg <bburg> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | bburg, cgarcia, hi, lmoura, webkit-bug-importer | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Local Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
|
Description
BJ Burg
2020-06-12 10:44:29 PDT
I filed a spec bug to clarify here: https://github.com/w3c/webdriver/issues/1533 I think the correct fix is to alter the semantics of the 'Page' coordinate system to provide iframe-relative coordinates. The LayoutViewport coordinate system is designed to provide top-level browsing context client coordinates that would be usable for Element Click / Actions chains. (In reply to Brian Burg from comment #3) > I think the correct fix is to alter the semantics of the 'Page' coordinate > system to provide iframe-relative coordinates. The LayoutViewport coordinate > system is designed to provide top-level browsing context client coordinates > that would be usable for Element Click / Actions chains. Based on an audit of uses in webkitgtkdriver and safaridriver, this change should not regress any other endpoints. The obvious fix to use the equivalent of elem.getBoundingClientRect() seems to do the trick so far, running some more tests to check for fallout. Created attachment 401794 [details]
Patch
Comment on attachment 401794 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=401794&action=review r=me, nice fix :) > Source/WebKit/ChangeLog:14 > + Covered by existing WPT test suite. The semantics of this command are under review, as I always hated "WPT test" ... it's so redundant 😞 > Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp:689 > case CoordinateSystem::LayoutViewport: NIT: we should wrap this `case` in `{` and `}` so `elementBoundsInRootCoordinates` is local to just this `case` (i'd also be fine if you inlined it) > Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp:747 > + auto inViewCenterPointInRootCoordinates = convertPointFromFrameClientToRootView(frameView, elementInViewCenterPoint); Ditto (:689) Committed r262997: <https://trac.webkit.org/changeset/262997> Two selenium test cases from `position_and_size_tests.py` started failing after this change, but I think we may add them as failures while this spec ambiguity is sorted out.
The first one, testShouldScrollPageAndGetCoordinatesOfAnElementThatIsOutOfViewPort, uses `element.location` and `element.location_once_scrolled_into_view`, and seems to assume the former to reflect the non-normative behavior of returning the location on the page instead on the current browsing context. Similarly, the Java version of the tests finishes with:
assertThat(getLocationOnPage(By.id("box"))).isEqualTo(new Point(10, 5010));
The second one, testShouldGetCoordinatesOfAnElementWithFixedPosition, uses a fixed element originally at y=0, scrolls, and tries to see if its `elem.location` changed (it does not, with the current behavior, as the position in the viewport does not change).
I'll mark them as Fail, linking to this bug for reference.
|