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

Open
rniwa opened this issue Nov 6, 2019 · 0 comments

Comments

@rniwa
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
https://bugs.webkit.org/show_bug.cgi?id=203839
<rdar://problem/56890922>

Reviewed by Simon Fraser.

Source/WebCore:

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:
https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering
https://drafts.csswg.org/cssom-view/#run-the-scroll-steps

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
       fast/events/scroll-subframe-in-rendering-update.html
       fast/visual-viewport/visual-viewport-scroll-after-resize-in-subframe.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:
(WebCore::EventHandler::sendScrollEvent):
* page/Page.cpp:
(WebCore::Page::updateRendering): Invoke runScrollSteps on each document in the frame tree order.
* page/VisualViewport.cpp:
(WebCore::VisualViewport::update):
(WebCore::VisualViewport::enqueueScrollEvent): Deleted.
* page/VisualViewport.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollTo):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::scrollTo):

LayoutTests:

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: http://svn.webkit.org/repository/webkit/trunk@252205 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.