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

Side by Side Diff: LayoutTests/editing/selection/move-by-line-004.html

Issue 14794012: Make contenteditable="false" element as atomic node for selection motion (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-05-27T14:00 Created 7 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 | Annotate | Revision Log
OLDNEW
1 <p> 1 <script src="../../fast/js/resources/js-test-pre.js"></script>
2 Test that moving the caret with line granularity within the highest 2 <script src="./resources/js-test-selection-shared.js"></script>
3 editable root works across non-editable content. 3
4 </p> 4 <div id="test" contenteditable="true">
5 <pre id="console"></pre>
6 <div contenteditable="true">
7 <div contenteditable="false"> 5 <div contenteditable="false">
8 <span id="pie" contenteditable="true">apple pie</span> 6 <span id="pie" contenteditable="true">apple pie</span>
9 </div> 7 </div>
10 <div contenteditable="false"> 8 <div contenteditable="false">
11 pineapple 9 pineapple
12 </div> 10 </div>
13 <div contenteditable="false"> 11 <div contenteditable="false">
14 <span id="juice" contenteditable="true">apple juice</span> 12 <span id="juice" contenteditable="true">apple juice</span>
15 </div> 13 </div>
16 </div> 14 </div>
15
17 <script> 16 <script>
18 function log(message) 17 description('Test that moving the caret with line granularity within the highest editable root doesn\'t work across non-editable content.');
19 {
20 document.getElementById("console").appendChild(document.createTextNode(m essage + "\n"));
21 }
22 18
23 if (window.testRunner) 19 testCaretMotion({
24 testRunner.dumpAsText(); 20 'direction': 'forward',
21 'granularity': 'line',
22 'origin': 'pie',
23 'originOffset': 3,
24 'target': 'pie',
25 'targetOffset': -1,
26 });
25 27
26 var fail = false; 28 testCaretMotion({
27 var pie = document.getElementById("pie"); 29 'direction': 'backward',
28 var juice = document.getElementById("juice"); 30 'granularity': 'line',
31 'origin': 'juice',
32 'originOffset': 3,
33 'target': 'juice',
34 'targetOffset': 0,
35 });
29 36
30 var sel = getSelection(); 37 if (window.testRunner)
31 sel.setPosition(pie.firstChild, 3); 38 $('test').outerHTML = '';
32 sel.modify("move", "forward", "line");
33
34 if (sel.anchorNode !== juice.firstChild || sel.anchorOffset != 3) {
35 log("FAIL: Did not move to the next line");
36 fail = true;
37 }
38
39 sel.setPosition(juice.firstChild, 3);
40 sel.modify("move", "backward", "line");
41
42 if (sel.anchorNode !== pie.firstChild || sel.anchorOffset != 3) {
43 log("FAIL: Did not move to the previous line");
44 fail = true;
45 }
46
47 if (!fail)
48 log("PASS");
49 </script> 39 </script>
40 <script src="../../fast/js/resources/js-test-post.js"></script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698