Bug 195278

Summary: Add testing API to hit-test and scroll overflow scrollers
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: ScrollingAssignee: Simon Fraser (smfr) <simon.fraser>
Status: RESOLVED FIXED    
Severity: Normal CC: cmarcelo, commit-queue, ews-watchlist, fred.wang, jamesr, koivisto, luiz, simon.fraser, tonikitoo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
none
Patch none

Antti Koivisto
Reported 2019-03-04 08:11:03 PST
Existing tests use UI scripting, which is clumsy and slow.
Attachments
patch (18.49 KB, patch)
2019-03-04 08:44 PST, Antti Koivisto
no flags
Patch (10.80 KB, patch)
2019-03-11 10:55 PDT, Simon Fraser (smfr)
no flags
Antti Koivisto
Comment 1 2019-03-04 08:44:42 PST
Frédéric Wang (:fredw)
Comment 2 2019-03-05 06:09:04 PST
Comment on attachment 363516 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=363516&action=review This looks good to me and would definitely allow to write more reliable tests. The only thing I wonder is whether new code should be behind a compilation flag so that it is only enabled for developer builds? > Source/WebCore/testing/Internals.cpp:1713 > + auto& scrollingCoordinator = downcast<AsyncScrollingCoordinator>(*document->page()->scrollingCoordinator()); It seems that the Windows bots don't like this. No idea why... Maybe you need to protect some stuff with ENABLE(ASYNC_SCROLLING)?
Simon Fraser (smfr)
Comment 3 2019-03-05 09:30:10 PST
Comment on attachment 363516 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=363516&action=review > Source/WebCore/ChangeLog:8 > + It would be useful to be able to test delegated user scrolling without using clumsy and slow UI scripting. slow!? > Source/WebCore/ChangeLog:14 > + This mechanism currently supports subframes and overflow scrolling on iOS. Will it support main frame scrolling, and macOS too? > Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp:221 > +void ScrollingStateScrollingNode::setRequestedDelegatedScrollPositionForTesting(const FloatPoint& requestedDelegatedScrollPositionForTesting) > +{ > + m_requestedDelegatedScrollPositionForTesting = requestedDelegatedScrollPositionForTesting; > + setPropertyChanged(RequestedDelegatedScrollPositionForTesting); > +} I don't think doing this via a scrolling tree commit is the right approach. This will trigger a commit of any dirty state in the scrolling state tree, which may mask bugs. I think we want to simulate a user scroll more directly. On iOS, this should actually scroll the UIScrollVIew, which would trigger the wasScrolledByDelegatedScrolling() code path. On macOS, it would enter the code path that is called form handling wheel events. I think we also want this test mode to disable messaging back to the main thread/UI process. So I think we do need UIScriptController on iOS (and maybe macOS too), in conjunction with something that cuts of the dispatch in ThreadedScrollingTree::scrollingTreeNodeDidScroll() (macOS) and calling the scrolling coordinator in RemoteScrollingTree::scrollingTreeNodeDidScroll (iOS).
Antti Koivisto
Comment 4 2019-03-05 11:58:09 PST
> slow!? Yes, because swipe based scrolling needs long wait times stabilize. See the existing tests.
Antti Koivisto
Comment 5 2019-03-05 11:58:18 PST
*to stabilize
Antti Koivisto
Comment 6 2019-03-05 12:05:24 PST
> I think we want to simulate a user scroll more directly. On iOS, this should > actually scroll the UIScrollVIew, which would trigger the > wasScrolledByDelegatedScrolling() code path. On macOS, it would enter the > code path that is called form handling wheel events. This patch does scroll UIScrollView on iOS triggering wasScrolledByDelegatedScrolling. Mac support would be a separate patch. > I think we also want > this test mode to disable messaging back to the main thread/UI process. Separate API and a separate patch. > So I think we do need UIScriptController on iOS (and maybe macOS too), in > conjunction with something that cuts of the dispatch in > ThreadedScrollingTree::scrollingTreeNodeDidScroll() (macOS) and calling the > scrolling coordinator in RemoteScrollingTree::scrollingTreeNodeDidScroll > (iOS).
Simon Fraser (smfr)
Comment 7 2019-03-05 12:51:53 PST
(In reply to Antti Koivisto from comment #4) > > slow!? > > Yes, because swipe based scrolling needs long wait times stabilize. See the > existing tests. It could be an instantaneous "scroll to"
Simon Fraser (smfr)
Comment 8 2019-03-05 12:52:50 PST
UIScriptController already has immediateScrollToOffset(). It just needs a Frame or Document parameter, and some "don't sync" smarts.
Frédéric Wang (:fredw)
Comment 9 2019-03-05 13:00:12 PST
(In reply to Simon Fraser (smfr) from comment #8) > UIScriptController already has immediateScrollToOffset(). It just needs a > Frame or Document parameter, and some "don't sync" smarts. Interesting. Does it work for overflow scroll? Does it allow to test UI => Web process sync?
Antti Koivisto
Comment 10 2019-03-05 13:08:56 PST
(In reply to Simon Fraser (smfr) from comment #8) > UIScriptController already has immediateScrollToOffset(). It just needs a > Frame or Document parameter, and some "don't sync" smarts. Any UIScriptController based API should probably take a point instead of Frame or Document so it also covers hit testing (can Frames and Documents even be reasonably passed to UIScriptController?).
Simon Fraser (smfr)
Comment 11 2019-03-05 13:44:55 PST
I'd rather the hit testing be a separate entry point. It's much easier to write a test that says "scroll element E" rathe than figuring out coords for it.
Antti Koivisto
Comment 12 2019-03-05 14:36:51 PST
(In reply to Simon Fraser (smfr) from comment #11) > I'd rather the hit testing be a separate entry point. It's much easier to > write a test that says "scroll element E" rathe than figuring out coords for > it. Sure, thus this patch. It is unclear to me how to make DOM objects like Element available to UIScriptController. There are no existing examples. Since it is your baby I think you'll get the honours of implementing this.
Simon Fraser (smfr)
Comment 13 2019-03-11 10:55:42 PDT
WebKit Commit Bot
Comment 14 2019-03-11 21:59:42 PDT
Comment on attachment 364271 [details] Patch Clearing flags on attachment: 364271 Committed r242773: <https://trac.webkit.org/changeset/242773>
WebKit Commit Bot
Comment 15 2019-03-11 21:59:44 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 16 2019-03-11 22:00:26 PDT
Note You need to log in before you can comment on or make changes to this bug.