REGRESSION(r255957): Element with scroll-behavior:smooth isn't draggable after r255957
https://bugs.webkit.org/show_bug.cgi?id=208566
Reviewed by Simon Fraser and Frédéric Wang.
Source/WebCore:
To perform smooth scroll, RenderLayer::scrollRectToVisible checks the value of scroll-behavior.
It starts an animated scrolling if scroll-behavior is smooth.
On the other hand, the drag action would start an autoscroll if the element is scrollable.
The autoscroll uses m_autoscrollTimer which is a repeating timer, when the timer fired it calls
scrollRectToVisible with different positions.
So if performing autoscroll on scroll-bahavior: smooth element, there are two nested animations.
When timer fired, scrollRectToVisible is called, because of scroll-behavior:smooth, it starts
animated scrolling not instant scrolling. Then there's the next timer fired, the previous
animated scrolling would be canceled. Eventually, the element becomes un-draggable.
To fix this, while performing autoscroll, scrollRectToVisible shouldn't trigger animated scrolling
no matter what the value of scroll-behavior is.
Test: fast/events/drag-smooth-scroll-element.html
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):
(WebCore::RenderLayer::autoscroll):
* rendering/RenderLayer.h:
LayoutTests:
The test uses eventSender to generate drag action.
* fast/events/drag-smooth-scroll-element-expected.txt: Added.
* fast/events/drag-smooth-scroll-element.html: Added.
* platform/ios/TestExpectations: IOS doesn't support mouse events, so skip the test.
Canonical link: https://commits.webkit.org/221939@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258382 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-03-13 05:30:54 +00:00
|
|
|
PASS: Test drag scroll-behavior:smooth element
|