| Summary: | element.rect doesn't yield correct co-ordinates on iOS | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Luke Hill <lukehill_uk> | ||||
| Component: | WebDriver | Assignee: | Nikita Vasilyev <nvasilyev> | ||||
| Status: | NEW --- | ||||||
| Severity: | Normal | CC: | bburg, darin, simon.fraser, smoley, webkit-bug-importer, zalan | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | Other | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
|
Description
Luke Hill
2020-11-13 01:31:03 PST
NB: During some parts of the testing. It's even possible to get the y ordinate to be negative in iOS. So something is definitely going wrong here!! Hello Luke, thanks for writing. It's not quite clear to me how you are scrolling. Could you please attach a test case so that there is no ambiguity? In general, iOS coordinates are computed and returned in visual viewport space, but the Get Element Rect command explicitly wants to add the scrollY to this coordinate system. In this case the scrollY of ~1000 is missing, so this indeed looks like a driver bug. From reading the code, it looks like we need to change WebAutomationSessionProxy::computeElementLayout() for the CoordinateSystem::Page case, so that it shifts the element bounds by window.scrollX and window.scrollY. Spec language is here: https://w3c.github.io/webdriver/#dfn-calculate-the-absolute-position I do use a JS "hack" to scroll. Which perhaps isn't computing well with the iOS Driver. But it works (i.e. it does scroll). For ref I do a window.scrollTo(10000,0) call. I "know" for iOS I could maybe do something different, but we don't care how the user scrolls - As for that webpage, we want to test it "stickies" the OISC Warning. To me this was the "best" way to test the sticky behaviour. I.e. the rect should be moved from its starting position. So my test grabs the starting y value, scrolls down, asserts it has changed. But for iOS it goes all weird. It works fine on Mojave 12 Safari so it suggests it's not globally broken with the safaridriver. So I'm not sure. Created attachment 426962 [details]
[WIP] Patch v1.0
Comment on attachment 426962 [details] [WIP] Patch v1.0 View in context: https://bugs.webkit.org/attachment.cgi?id=426962&action=review > Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp:662 > + // XXX XXX? Comment on attachment 426962 [details] [WIP] Patch v1.0 View in context: https://bugs.webkit.org/attachment.cgi?id=426962&action=review > Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp:668 > + scrollOffset.scale(2); // convertRectFromFrameClientToRootView subtracts scrollX/Y and we need to add it back and then again so it's positive This is very weird. |