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

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

Issue 1942683004: Ctrl/Alt+Enter shouldn't insert newline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Yosin's review Created 4 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 unified diff | Download patch
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 function performVerticalScrollingPasteTest() 59 function performVerticalScrollingPasteTest()
60 { 60 {
61 copyText(); 61 copyText();
62 if (performVerticalScrollingTest()) { 62 if (performVerticalScrollingTest()) {
63 document.execCommand("selectall"); 63 document.execCommand("selectall");
64 document.execCommand("paste"); 64 document.execCommand("paste");
65 } 65 }
66 } 66 }
67 67
68 function performJumpAtTheEdgeTest(useCtrlKeyModifier) 68 function performJumpAtTheEdgeTest()
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.documentElement.scrollTop; 76 previousScrollTop = document.documentElement.scrollTop;
77 eventSender.keyDown("\r", useCtrlKeyModifier ? ["ctrlKey"] : []); 77 eventSender.keyDown("\r", []);
78 currentScrollTop = document.documentElement.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

Powered by Google App Engine
This is Rietveld 408576698