diff options
author | skobes@chromium.org <skobes@chromium.org> | 2015-02-11 22:22:23 +0000 |
---|---|---|
committer | skobes@chromium.org <skobes@chromium.org> | 2015-02-11 22:22:23 +0000 |
commit | 41cf98d0c8f2b018a3142b98188215cf5c338c44 (patch) | |
tree | 359f6aeed3e44e36a543cd7cf3ca20a5415d0f44 /third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html | |
parent | 8dc97e950b9113a4474f1e47fbebbbc8dad90a9b (diff) | |
download | chromium_src-41cf98d0c8f2b018a3142b98188215cf5c338c44.zip chromium_src-41cf98d0c8f2b018a3142b98188215cf5c338c44.tar.gz chromium_src-41cf98d0c8f2b018a3142b98188215cf5c338c44.tar.bz2 |
Respect the smooth scrolling setting in LayerScrollableArea.
This was previously done in http://crrev.com/214953004 but reverted due to
http://crbug.com/383946. With http://crrev.com/831393003 it should be safe to
re-land. (This is also needed for http://crbug.com/417782 because everything
will go through the LayerScrollableArea path.)
BUG=575,417782
Review URL: https://codereview.chromium.org/882813005
git-svn-id: svn://svn.chromium.org/blink/trunk@190002 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html')
-rw-r--r-- | third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html new file mode 100644 index 0000000..a88a2b7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html @@ -0,0 +1,85 @@ +<!DOCTYPE html> +<style> + +#container { + width: 200px; + height: 200px; + overflow: scroll; +} + +#content { + width: 7500px; + height: 7500px; + background-color: blue; +} + +</style> +<script src="../../resources/js-test.js"></script> +<div id="container"> + <div id="content"></div> +</div> +<div id="console"></div> +<script> + +jsTestIsAsync = true; +element = document.getElementById("container"); + +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, + 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 overflow scrolls are animated, unless the wheel " + + "event has precise scrolling deltas."); + +if (window.eventSender) + runTest(); +else + debug("FAIL: This test requires window.eventSender."); + +</script> |