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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/input/option-page-up-down.html

Issue 2709983005: Selection API: Do not change focus by Selection functions. (Closed)
Patch Set: . Created 3 years, 9 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 <head> 1 <head>
2 <script src="../../resources/ahem.js"></script> 2 <script src="../../resources/ahem.js"></script>
3 <style type="text/css"> 3 <style type="text/css">
4 .ahem { font: 20px Ahem; } 4 .ahem { font: 20px Ahem; }
5 </style> 5 </style>
6 <script> 6 <script>
7 if (window.testRunner) 7 if (window.testRunner)
8 testRunner.dumpAsText(); 8 testRunner.dumpAsText();
9 9
10 function runTest() { 10 function runTest() {
11 runFrameCursorMoveTest(); 11 runFrameCursorMoveTest();
12 runDivCursorMoveTest(); 12 runDivCursorMoveTest();
13 } 13 }
14 14
15 function generateContent() { 15 function generateContent() {
16 var content = ""; 16 var content = "";
17 for (var i = 0; i < 10; ++i) 17 for (var i = 0; i < 10; ++i)
18 content += "<p>line " + i + "</p>\n"; 18 content += "<p>line " + i + "</p>\n";
19 return content; 19 return content;
20 } 20 }
21 21
22 function runFrameCursorMoveTest() { 22 function runFrameCursorMoveTest() {
23 var frame = frames[0]; 23 var frame = frames[0];
24 var doc = frame.document; 24 var doc = frame.document;
25 var body = doc.body; 25 var body = doc.body;
26 body.innerHTML = generateContent(); 26 body.innerHTML = generateContent();
27 frame.focus(); 27 frame.focus();
28 body.focus();
28 frame.getSelection().collapse(body.firstChild, 0); 29 frame.getSelection().collapse(body.firstChild, 0);
29 runCursorMoveTest("iframe", frame, frame); 30 runCursorMoveTest("iframe", frame, frame);
30 } 31 }
31 32
32 function runDivCursorMoveTest() { 33 function runDivCursorMoveTest() {
33 var editable = document.getElementById('editable'); 34 var editable = document.getElementById('editable');
34 editable.innerHTML = generateContent(); 35 editable.innerHTML = generateContent();
35 editable.focus(); 36 editable.focus();
36 window.getSelection().collapse(editable, 0); 37 window.getSelection().collapse(editable, 0);
37 runCursorMoveTest("div", editable, window); 38 runCursorMoveTest("div", editable, window);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 </script> 83 </script>
83 </head> 84 </head>
84 <body onload="runTest()"> 85 <body onload="runTest()">
85 <div>Page up/down (option+page up/down on Mac) should move the move cursor and s croll the content 86 <div>Page up/down (option+page up/down on Mac) should move the move cursor and s croll the content
86 in contenteditable elements. This sample covers cursor position move test of a) iframe element containing 87 in contenteditable elements. This sample covers cursor position move test of a) iframe element containing
87 contenteditable body, and b) content editable div element.</div> 88 contenteditable body, and b) content editable div element.</div>
88 <iframe src="../resources/contenteditable-iframe-fixed-size-src.html"></iframe> 89 <iframe src="../resources/contenteditable-iframe-fixed-size-src.html"></iframe>
89 <div id="editable" contenteditable="true" class="ahem" style="height:150px; over flow:auto;"></div> 90 <div id="editable" contenteditable="true" class="ahem" style="height:150px; over flow:auto;"></div>
90 <div id="results"></div> 91 <div id="results"></div>
91 </body> 92 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698