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

Side by Side Diff: LayoutTests/editing/input/resources/reveal-utilities.js

Issue 26472003: Fix improper scrollTop/Left usage in LayoutTests/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@issue_304768
Patch Set: Fix improper scrollTop/Left usage in LayoutTests/ Created 7 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/resources/check-scroll-position-onload.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 function offsetFromViewportTop(element) 1 function offsetFromViewportTop(element)
2 { 2 {
3 return element.getClientRects()[0].top; 3 return element.getClientRects()[0].top;
4 } 4 }
5 5
6 function offsetOfMiddleFromViewportTop(element) 6 function offsetOfMiddleFromViewportTop(element)
7 { 7 {
8 return element.getClientRects()[0].top + Math.round(element.getClientRects() [0].height / 2); 8 return element.getClientRects()[0].top + Math.round(element.getClientRects() [0].height / 2);
9 } 9 }
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 function performJumpAtTheEdgeTest(useCtrlKeyModifier) 68 function performJumpAtTheEdgeTest(useCtrlKeyModifier)
69 { 69 {
70 var textArea = document.getElementById("input"); 70 var textArea = document.getElementById("input");
71 textArea.focus(); 71 textArea.focus();
72 if (window.eventSender) { 72 if (window.eventSender) {
73 var previousScrollTop = 0, currentScrollTop = 0; 73 var previousScrollTop = 0, currentScrollTop = 0;
74 var jumpDetected = false; 74 var jumpDetected = false;
75 for (var i = 0; i < 120; ++i) { 75 for (var i = 0; i < 120; ++i) {
76 previousScrollTop = document.body.scrollTop; 76 previousScrollTop = document.documentElement.scrollTop;
77 eventSender.keyDown("\r", useCtrlKeyModifier ? ["ctrlKey"] : []); 77 eventSender.keyDown("\r", useCtrlKeyModifier ? ["ctrlKey"] : []);
78 currentScrollTop = document.body.scrollTop; 78 currentScrollTop = document.documentElement.scrollTop;
79 // Smooth scrolls are allowed. 79 // Smooth scrolls are allowed.
80 if (Math.abs(previousScrollTop - currentScrollTop) > 24) { 80 if (Math.abs(previousScrollTop - currentScrollTop) > 24) {
81 jumpDetected = true; 81 jumpDetected = true;
82 break; 82 break;
83 } 83 }
84 } 84 }
85 if (!jumpDetected) 85 if (!jumpDetected)
86 document.write("PASS"); 86 document.write("PASS");
87 else 87 else
88 document.write("FAIL<br>Jump scroll from " + previousScrollTop + " t o " + currentScrollTop); 88 document.write("FAIL<br>Jump scroll from " + previousScrollTop + " t o " + currentScrollTop);
89 } 89 }
90 } 90 }
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/resources/check-scroll-position-onload.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698