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

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

Issue 10382217: Merge 117307 - Avoid jumpscroll when entering new text in a multi-line editor. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 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
« no previous file with comments | « no previous file | LayoutTests/editing/input/scroll-to-edge-if-line-break-at-end-of-document-contenteditable.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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
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
68 function performJumpAtTheEdgeTest(useCtrlKeyModifier)
69 {
70 var textArea = document.getElementById("input");
71 textArea.focus();
72 if (window.eventSender) {
73 var previousScrollTop = 0, currentScrollTop = 0;
74 var jumpDetected = false;
75 for (var i = 0; i < 120; ++i) {
76 previousScrollTop = document.body.scrollTop;
77 eventSender.keyDown("\r", useCtrlKeyModifier ? ["ctrlKey"] : []);
78 currentScrollTop = document.body.scrollTop;
79 // Smooth scrolls are allowed.
80 if (Math.abs(previousScrollTop - currentScrollTop) > 24) {
81 jumpDetected = true;
82 break;
83 }
84 }
85 if (!jumpDetected)
86 document.write("PASS");
87 else
88 document.write("FAIL<br>Jump scroll from " + previousScrollTop + " t o " + currentScrollTop);
89 }
90 }
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/editing/input/scroll-to-edge-if-line-break-at-end-of-document-contenteditable.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698