Commit de79ccca authored by skobes@chromium.org's avatar skobes@chromium.org

Reland: Respect the smooth scrolling setting in LayerScrollableArea.

This relands https://blink.lc/blink/commit/?id=5668429, which was reverted in
https://blink.lc/blink/commit/?id=a1303a8.

The Mac trackpad regression is addressed by
https://blink.lc/blink/commit/?id=021397d.

BUG=575,417782

Review URL: https://codereview.chromium.org/882813005

git-svn-id: svn://svn.chromium.org/blink/trunk@190675 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 369e2336
......@@ -1729,6 +1729,9 @@ crbug.com/441738 inspector/extensions/extensions-network.html [ Pass Failure ]
crbug.com/410949 http/tests/security/local-image-from-remote-whitelisted.html [ Pass Failure ]
crbug.com/364614 [ Mac ] fast/scroll-behavior/overflow-scroll-animates.html [ Skip ]
crbug.com/364614 [ Mac ] virtual/threaded/fast/scroll-behavior/overflow-scroll-animates.html [ Skip ]
crbug.com/439856 virtual/deferred/fast/images/pixelated-composited.html [ ImageOnlyFailure ]
crbug.com/442181 virtual/slimmingpaint/fast/images/pixelated-composited.html [ ImageOnlyFailure ]
......
Tests that a WebMouseWheelEvent with hasPreciseScrollingDeltas does not produce an animated scroll
Tests that overflow scrolls are animated, unless the wheel event has precise scrolling deltas.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS element.scrollTop is not 80
PASS scrollDuration < 500 is true
PASS element.scrollTop is 80
PASS successfullyParsed is true
......
......@@ -24,19 +24,58 @@
jsTestIsAsync = true;
element = document.getElementById("container");
function runTest() {
element.addEventListener("scroll", function() {
shouldBe("element.scrollTop", "80");
var testConfigs = [
{preciseDeltas: false, expectSmooth: true},
{preciseDeltas: true, expectSmooth: false},
];
var config;
var waitingForScroll = false;
var scrollStart, scrollDuration;
function nextConfig() {
config = testConfigs.shift();
if (!config)
finishJSTest();
});
element.addEventListener("scroll", onElementScroll);
eventSender.mouseMoveTo(100, 100);
eventSender.mouseScrollBy(0, -2, /* paged */ false,
/* has_precise_scrolling_deltas */ true);
config.preciseDeltas);
scrollStart = performance.now();
}
function reset() {
element.removeEventListener("scroll", onElementScroll);
element.scrollTop = 0;
waitingForScroll = false;
}
function onElementScroll() {
if (waitingForScroll) {
if (element.scrollTop == 80) {
scrollDuration = performance.now() - scrollStart;
shouldBeTrue("scrollDuration < 500");
reset();
nextConfig();
}
} else if (config.expectSmooth) {
shouldNotBe("element.scrollTop", "80");
waitingForScroll = true;
} else {
shouldBe("element.scrollTop", "80");
reset();
nextConfig();
}
}
function runTest() {
internals.settings.setScrollAnimatorEnabled(true);
nextConfig();
}
description("Tests that a WebMouseWheelEvent with hasPreciseScrollingDeltas " +
"does not produce an animated scroll");
description("Tests that overflow scrolls are animated, unless the wheel " +
"event has precise scrolling deltas.");
if (window.eventSender)
runTest();
......
......@@ -488,6 +488,13 @@ IntPoint LayerScrollableArea::lastKnownMousePosition() const
return box().frame() ? box().frame()->eventHandler().lastKnownMousePosition() : IntPoint();
}
bool LayerScrollableArea::scrollAnimatorEnabled() const
{
if (Settings* settings = box().frame()->settings())
return settings->scrollAnimatorEnabled();
return false;
}
bool LayerScrollableArea::shouldSuspendScrollAnimations() const
{
RenderView* view = box().view();
......
......@@ -107,6 +107,7 @@ public:
virtual IntSize contentsSize() const override;
virtual IntSize overhangAmount() const override;
virtual IntPoint lastKnownMousePosition() const override;
virtual bool scrollAnimatorEnabled() const override;
virtual bool shouldSuspendScrollAnimations() const override;
virtual bool scrollbarsCanBeActive() const override;
virtual IntRect scrollableAreaBoundingBox() const override;
......
......@@ -243,6 +243,7 @@ bool WebPagePopupImpl::initializePage()
m_page->settings().setDeviceSupportsTouch(m_webView->page()->settings().deviceSupportsTouch());
// FIXME: Should we support enabling a11y while a popup is shown?
m_page->settings().setAccessibilityEnabled(m_webView->page()->settings().accessibilityEnabled());
m_page->settings().setScrollAnimatorEnabled(m_webView->page()->settings().scrollAnimatorEnabled());
provideContextFeaturesTo(*m_page, adoptPtr(new PagePopupFeaturesClient()));
static FrameLoaderClient* emptyFrameLoaderClient = new EmptyFrameLoaderClient();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment