RESOLVED FIXED 208352
Page::editableElementsInRect() should find nested editable elements and return found elements in paint order
https://bugs.webkit.org/show_bug.cgi?id=208352
Summary Page::editableElementsInRect() should find nested editable elements and retur...
Daniel Bates
Reported 2020-02-27 16:21:50 PST
Page::editableElementsInRect() cannot find nested editable elements and the order of the returned elements are in DOM order, not paint order. The former means that a client can never get a hold of those elements. The latter means that a client cannot tell which element is closest to a person's face.
Attachments
Patch (7.68 KB, patch)
2020-02-27 16:32 PST, Daniel Bates
no flags
Patch (10.33 KB, patch)
2020-02-29 15:44 PST, Daniel Bates
no flags
Patch + iOS guess (12.88 KB, patch)
2020-02-29 16:05 PST, Daniel Bates
no flags
Patch (12.82 KB, patch)
2020-03-01 16:23 PST, Daniel Bates
no flags
Patch (13.08 KB, patch)
2020-03-01 16:25 PST, Daniel Bates
no flags
To land (13.09 KB, patch)
2020-03-02 10:49 PST, Daniel Bates
no flags
To land - removed unused Deque header (13.32 KB, patch)
2020-03-02 11:03 PST, Daniel Bates
no flags
Radar WebKit Bug Importer
Comment 1 2020-02-27 16:22:03 PST
Daniel Bates
Comment 2 2020-02-27 16:32:23 PST
Daniel Bates
Comment 3 2020-02-29 15:44:08 PST
Created attachment 392075 [details] Patch Update test results for Mac.
Daniel Bates
Comment 4 2020-02-29 15:45:40 PST
Comment on attachment 392075 [details] Patch Patch does not address the iOS test failure and more likely the updated results will cause more iOS test failures. I am very suspicious of "[webView scrollView].contentOffset = ..." in the test code. I would have expected window.scrollTo() to also work on iOS. In fact, as I'm typing this now and thinking about how iOS is currently failing I think setting .contentOffset will never produce good results because the engine is never told about the scroll position change so it cannot update its visible content rect and hit testing will fail. The kind of failure seen on the bots in the earlier patch: the test is hit testing at the top of the document (scrolled offscreen). As to why the test passes before my change. I can answer that: the original code was ASYMMETRIC! Walking the DOM will find things **outside the visible viewport** whereas hit testing will NOT, by default.
Daniel Bates
Comment 5 2020-02-29 15:51:37 PST
Just to be clear, the asymmetry with the current code that the visible content rect in the UI process does NOT match the visible content rect in the web process. In the UI process, the visible content rect reflects the set contentOffset, but the web process never is told about this offset.
Daniel Bates
Comment 6 2020-02-29 15:55:21 PST
^^^ both of those comments about iOS are guesses....I'll find out soon...
Daniel Bates
Comment 7 2020-02-29 16:05:33 PST
Created attachment 392078 [details] Patch + iOS guess
Daniel Bates
Comment 8 2020-03-01 14:54:38 PST
Comment on attachment 392078 [details] Patch + iOS guess View in context: https://bugs.webkit.org/attachment.cgi?id=392078&action=review > Tools/TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm:147 > + [webView _scheduleVisibleContentRectUpdate]; schedule is not enough.... need to wait...-_doAfterNextVisibleContentRectUpdate
Daniel Bates
Comment 9 2020-03-01 16:23:16 PST
Daniel Bates
Comment 10 2020-03-01 16:25:25 PST
Daniel Bates
Comment 11 2020-03-01 16:31:57 PST
Comment on attachment 392107 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=392107&action=review > Tools/ChangeLog:13 > + to a y position of 50000. Otherwise, it's impossible to do because the page height is < 5000px. 5000 not 50000!
Wenson Hsieh
Comment 12 2020-03-02 09:41:30 PST
Comment on attachment 392107 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=392107&action=review > Source/WebCore/page/Page.cpp:930 > + auto* frameView = mainFrame().view(); auto frameView = makeRefPtr(mainFrame().view()); We generally ref local variables like this in new code (especially in this case, since the hit-testing code below will trigger layout). > Source/WebCore/page/Page.cpp:934 > + auto* document = mainFrame().document(); Ditto.
Daniel Bates
Comment 13 2020-03-02 10:23:44 PST
Comment on attachment 392107 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=392107&action=review Thanks for the review! >> Source/WebCore/page/Page.cpp:930 >> + auto* frameView = mainFrame().view(); > > auto frameView = makeRefPtr(mainFrame().view()); > > We generally ref local variables like this in new code (especially in this case, since the hit-testing code below will trigger layout). OK >> Source/WebCore/page/Page.cpp:934 >> + auto* document = mainFrame().document(); > > Ditto. OK
Daniel Bates
Comment 14 2020-03-02 10:49:37 PST
Daniel Bates
Comment 15 2020-03-02 11:03:56 PST
Created attachment 392155 [details] To land - removed unused Deque header
Daniel Bates
Comment 16 2020-03-02 11:54:47 PST
Comment on attachment 392155 [details] To land - removed unused Deque header Clearing flags on attachment: 392155 Committed r257722: <https://trac.webkit.org/changeset/257722>
Daniel Bates
Comment 17 2020-03-02 11:54:49 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.