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 | |
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')
-rw-r--r-- | third_party/WebKit/LayoutTests/TestExpectations | 3 | ||||
-rw-r--r-- | third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-animates-expected.txt (renamed from third_party/WebKit/LayoutTests/fast/scroll-behavior/precise-delta-no-animate-expected.txt) | 4 | ||||
-rw-r--r-- | third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html | 85 | ||||
-rw-r--r-- | third_party/WebKit/LayoutTests/fast/scroll-behavior/precise-delta-no-animate.html | 46 | ||||
-rw-r--r-- | third_party/WebKit/Source/core/layout/LayerScrollableArea.cpp | 7 | ||||
-rw-r--r-- | third_party/WebKit/Source/core/layout/LayerScrollableArea.h | 1 | ||||
-rw-r--r-- | third_party/WebKit/Source/web/WebPagePopupImpl.cpp | 1 |
7 files changed, 100 insertions, 47 deletions
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 1e76e5d..deda0bf 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations @@ -1753,6 +1753,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 ] diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/precise-delta-no-animate-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-animates-expected.txt index f4f0693..7673f7b 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/precise-delta-no-animate-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-animates-expected.txt @@ -1,8 +1,10 @@ -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 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> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/precise-delta-no-animate.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/precise-delta-no-animate.html deleted file mode 100644 index 96303ca..0000000 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/precise-delta-no-animate.html +++ /dev/null @@ -1,46 +0,0 @@ -<!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"); - -function runTest() { - element.addEventListener("scroll", function() { - shouldBe("element.scrollTop", "80"); - finishJSTest(); - }); - - eventSender.mouseMoveTo(100, 100); - eventSender.mouseScrollBy(0, -2, /* paged */ false, - /* has_precise_scrolling_deltas */ true); -} - -description("Tests that a WebMouseWheelEvent with hasPreciseScrollingDeltas " + - "does not produce an animated scroll"); - -if (window.eventSender) - runTest(); -else - debug("FAIL: This test requires window.eventSender."); - -</script> diff --git a/third_party/WebKit/Source/core/layout/LayerScrollableArea.cpp b/third_party/WebKit/Source/core/layout/LayerScrollableArea.cpp index 3a967dc..f014120 100644 --- a/third_party/WebKit/Source/core/layout/LayerScrollableArea.cpp +++ b/third_party/WebKit/Source/core/layout/LayerScrollableArea.cpp @@ -485,6 +485,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(); diff --git a/third_party/WebKit/Source/core/layout/LayerScrollableArea.h b/third_party/WebKit/Source/core/layout/LayerScrollableArea.h index 9968f47..1a3ede7 100644 --- a/third_party/WebKit/Source/core/layout/LayerScrollableArea.h +++ b/third_party/WebKit/Source/core/layout/LayerScrollableArea.h @@ -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; diff --git a/third_party/WebKit/Source/web/WebPagePopupImpl.cpp b/third_party/WebKit/Source/web/WebPagePopupImpl.cpp index b01f75f..fae8fef 100644 --- a/third_party/WebKit/Source/web/WebPagePopupImpl.cpp +++ b/third_party/WebKit/Source/web/WebPagePopupImpl.cpp @@ -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(); |