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

Unified Diff: third_party/WebKit/LayoutTests/fast/events/middleClickAutoscroll-latching.html

Issue 2484563003: Determine the layoutobject of middleClickAutoscroll by the scroll direction. (Closed)
Patch Set: Better tests. Created 4 years, 1 month 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 | « no previous file | third_party/WebKit/LayoutTests/fast/events/resources/middleClickAutoscroll-iframe.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/events/middleClickAutoscroll-latching.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/middleClickAutoscroll-latching.html b/third_party/WebKit/LayoutTests/fast/events/middleClickAutoscroll-latching.html
new file mode 100644
index 0000000000000000000000000000000000000000..fe7ad71ab791f3a5e1598a7aa911262645b6ab89
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/middleClickAutoscroll-latching.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<div id = "div" style="overflow: auto; width: 1400px">
+<table style="height:2000px; width: 1800px">
+ <tbody>
+ <tr style="height: 2000px">
+ <td id="td" style="width: 600px; height: 2000px"></td>
+ <td id="iframe" style="width: 1200px; height: 2000px">
+ <iframe style="width: 1000px; height: 2000px" src="resources/middleClickAutoscroll-iframe.html"></iframe>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+<script>
+var testBubble = async_test("Tests that middleClickAutoscroll finds the correct ancestor layoutobject when starting in an unscrollable direction.")
+testBubble.step(function() {
+ if (!window.eventSender)
+ return;
+ var div = document.getElementById("div");
+ var td = document.getElementById("td");
+ // Start a downward middle-click-autoscroll in the left td element.
+ var startx = td.getBoundingClientRect().left + 100;
+ var starty = td.getBoundingClientRect().top + 100;
+ var endx = startx;
+ var endy = starty + 100;
+ var scrolledY = false;
+ eventSender.mouseMoveTo(startx, starty);
+ eventSender.mouseDown(1);
+ eventSender.mouseMoveTo(endx, endy);
+
+ window.onscroll = function() {
+ if (!scrolledY) {
+ assert_not_equals(window.scrollY, 0);
+ scrolledY = true;
+ // Change the direction of the middle-click-autoscroll to rightward.
+ endx = startx + 100;
+ endy = starty;
+ eventSender.mouseMoveTo(endx, endy);
+ } else {
+ if (window.scrollX != 0) {
+ assert_equals(div.scrollLeft, 0);
+ eventSender.mouseUp(1);
+ testBubble.done();
+ testIFrame();
+ }
+ }
+ };
+});
+
+function testIFrame() {
+var testIFrame = async_test("Tests that middleClickAutoscroll finds the correct ancestor layoutobject when starting in an iframe, and the latching is correctly implemented.")
+testIFrame.step(function() {
+ if (!window.eventSender)
+ return;
+ var iframe = document.getElementById("iframe");
+ var div = document.getElementById("div");
+ // Start a rightward middle-click-autoscroll in the iframe inside the right
+ // td element.
+ var startx = Math.max(iframe.getBoundingClientRect().left, 10);
+ var starty = Math.max(iframe.getBoundingClientRect().top, 500);
+ var endx = startx + 100;
+ var endy = starty;
+ var pageScrollTop = window.scrollY;
+ eventSender.mouseMoveTo(startx, starty);
+ eventSender.mouseDown(1);
+ eventSender.mouseMoveTo(endx, endy);
+
+ div.onscroll = function() {
+ assert_not_equals(div.scrollLeft, 0);
+ eventSender.mouseUp(1);
+ testIFrame.done();
+ };
+});
+}
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/resources/middleClickAutoscroll-iframe.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698