Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should specify the order of scroll event with respect to other pending scroll event targets #66

rniwa opened this issue Nov 6, 2019 · 0 comments


Copy link

@rniwa rniwa commented Nov 6, 2019

This specification doesn't specify when resize event on visual viewport is dispatched before or after other pending scroll event targets. Because document itself is a pending scroll event target, even specifying the order relative to document's resize event itself is insufficient; there could be more pending scroll event targets such as other scrollable elements in the same document.

pull bot pushed a commit to sunwenli/webkit that referenced this issue Nov 7, 2019

Reviewed by Simon Fraser.


Dispatch scroll events on each pending scroll event targets inside the update-the-rendering step
of the event loop as specified in the HTML5 and CSSOM View Module specifications:

The new behavior also matches that of Chrome and Firefox.

Like resize event, the current visual viewport specification does not specify when scroll event
is dispatched on visualViewport interface: WICG/visual-viewport#66
For now, we always dispatch upon it after dispatching on all pending scroll event targets.

Tests: fast/events/scroll-multiple-elements-in-rendering-update.html

* dom/Document.cpp:
(WebCore::Document::addPendingScrollEventTarget): Added.
(WebCore::Document::setNeedsVisualViewportScrollEvent): Added.
(WebCore::Document::runScrollSteps): Added. This implements run the scroll steps in CSS OM View.
* dom/Document.h:
* dom/DocumentEventQueue.cpp:
(WebCore::DocumentEventQueue::enqueueOrDispatchScrollEvent): Deleted.
(WebCore::DocumentEventQueue::enqueueScrollEvent): Deleted.
* dom/DocumentEventQueue.h:
* page/EventHandler.cpp:
* page/Page.cpp:
(WebCore::Page::updateRendering): Invoke runScrollSteps on each document in the frame tree order.
* page/VisualViewport.cpp:
(WebCore::VisualViewport::enqueueScrollEvent): Deleted.
* page/VisualViewport.h:
* rendering/RenderLayer.cpp:
* rendering/RenderListBox.cpp:


Added tests to test the timing at which scroll events are fired across multiple elements and documents,
and with visualViewport, and updated the existing tests to work with the new timing.

* editing/selection/overflow-scroll-while-selecting-text.html:
* fast/events/scroll-multiple-elements-in-rendering-update-expected.txt: Added.
* fast/events/scroll-multiple-elements-in-rendering-update.html: Added.
* fast/events/scroll-subframe-in-rendering-update-expected.txt: Added.
* fast/events/scroll-subframe-in-rendering-update.html: Added.
* fast/scrolling/programmatic-scroll-to-negative-offset.html:
* fast/shadow-dom/trusted-event-scoped-flags.html:
* fast/visual-viewport/visual-viewport-scroll-after-resize-in-subframe-expected.txt: Added.
* fast/visual-viewport/visual-viewport-scroll-after-resize-in-subframe.html: Added.
* tiled-drawing/scrolling/fast-scroll-div-latched-mainframe.html:

git-svn-id: 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.