Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: LayoutTests/rubberbanding/scroll-bounce-fix.html

Issue 282743002: Fix page jumping back to initial position after an overflow-bounce scroll. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove whitespace from TestExpectations that was causing a rebase failure. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/rubberbanding/momentum-reset.html ('k') | Source/platform/mac/ScrollAnimatorMac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/rubberbanding/scroll-bounce-fix.html
diff --git a/LayoutTests/rubberbanding/scroll-bounce-fix.html b/LayoutTests/rubberbanding/scroll-bounce-fix.html
new file mode 100644
index 0000000000000000000000000000000000000000..1c5e9a024d003ad8b134b05a08ef87ade394d99e
--- /dev/null
+++ b/LayoutTests/rubberbanding/scroll-bounce-fix.html
@@ -0,0 +1,89 @@
+<!DOCTYPE html>
+<html>
+<head><title>Tests that a momentum scroll (i.e. a fling) doesn't jump vertically</title></head>
+<body>
+<div id="box" style="height:800px; background: red; border:2px solid black; width:100%"></div>
+<div id="info">This test requires DRT.</div>
+<script>
+ if (window.internals) {
+ document.getElementById('info').style.visibility = 'hidden';
+ internals.settings.setMockScrollbarsEnabled(false);
+
+ // These trackpad scroll events first go up, then left, then down & left. All events except the last 2 were obtained by recording real gesture data. The goal is to get rubber-banding to occur while maintaining high velocity in the X and Y directions.
+ var trackpadScrollEvents = [
+ ["scrollBegin"],
+ ["scroll", -1, 4],
+ ["scroll", -5, 14],
+ ["scroll", -5, 23],
+ ["scroll", -12, 57],
+ ["scroll", -11, 68],
+ ["scroll", -9, 85],
+ ["scroll", -3, 77],
+ ["scroll", -1, 109],
+ ["scroll", 4, 105],
+ ["scroll", 22, 106],
+ ["scroll", 47, 60],
+ ["scroll", 102, 32],
+ ["scroll", 210, -1],
+ ["scroll", 281, -23],
+ ["scroll", 453, -103],
+ ["scroll", 600, -223],
+ ["scroll", 800, -303],
+ ["scrollEnd"],
+ ["momentumBegin", 555, -120],
+ ["momentumEnd"]
+ ];
+
+ function queueTimeout(index)
+ {
+ setTimeout(function() { runTimeout(index); }, 5);
+ }
+
+ // Replays the event at position |index|.
+ function runTimeout(index)
+ {
+ var name = trackpadScrollEvents[index][0];
+ if (name == "scrollBegin") {
+ eventSender.trackpadScrollBegin();
+ } else if (name == "scroll") {
+ var deltaX = trackpadScrollEvents[index][1];
+ var deltaY = trackpadScrollEvents[index][2];
+ eventSender.trackpadScroll(deltaX, deltaY, false, true);
+ } else if (name == "scrollEnd") {
+ eventSender.trackpadScrollEnd();
+ } else if (name == "momentumBegin") {
+ var deltaX = trackpadScrollEvents[index][1];
+ var deltaY = trackpadScrollEvents[index][2];
+ eventSender.mouseMomentumBegin2(deltaX, deltaY, false, true);
+ } else if (name == "momentumEnd") {
+ eventSender.mouseMomentumEnd();
+ }
+
+ // Queues another event, if one is available.
+ if (index + 1 < trackpadScrollEvents.length) {
+ queueTimeout(index + 1);
+ }
+ }
+
+ // Queue the first event for replay.
+ queueTimeout(0);
+
+ // The ScrollElasticityController receives callbacks every 16ms, and animates the release effect of the rubber-band. Wait for 2 seconds to give the animation time to settle.
+ testRunner.waitUntilDone();
+ setTimeout(function() {
+ document.getElementById('box').style.background = 'green';
+ // The left margin should have rebounded back to 0.
+ if (document.documentElement.scrollLeft != 0) {
+ document.getElementById('box').style.background = 'yellow';
+ }
+ // The content should be scrolled to the bottom.
+ var expectedScrollTop = document.documentElement.scrollHeight - document.documentElement.clientHeight;
+ if (document.documentElement.scrollTop != expectedScrollTop) {
+ document.getElementById('box').style.background = 'yellow';
+ }
+ testRunner.notifyDone();
+ }, 2000);
+ }
+</script>
+</body>
+</html>
« no previous file with comments | « LayoutTests/rubberbanding/momentum-reset.html ('k') | Source/platform/mac/ScrollAnimatorMac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698