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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/selection/stay-in-textarea.html

Issue 2270663002: Selection API of INPUT/TEXTAREA should not update FrameSelection without focusing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust more tests Created 4 years, 3 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 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <html> 2 <html>
3 <body> 3 <body>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 5
6 <p id="before">Before</p> 6 <p id="before">Before</p>
7 <textarea id="textarea">Text</textarea> 7 <textarea id="textarea">Text</textarea>
8 <p id="after">After</p> 8 <p id="after">After</p>
9 9
10 <div id="console"></div> 10 <div id="console"></div>
11 <script> 11 <script>
12 description("Ensure that extending a selection beyond a textarea does not escape outside its shadow root."); 12 description("Ensure that extending a selection beyond a textarea does not escape outside its shadow root.");
13 13
14 var before = document.getElementById("before"); 14 var before = document.getElementById("before");
15 var after = document.getElementById("after"); 15 var after = document.getElementById("after");
16 var textarea = document.getElementById("textarea"); 16 var textarea = document.getElementById("textarea");
17 17
18 textarea.focus();
18 textarea.setSelectionRange(0, 2); 19 textarea.setSelectionRange(0, 2);
19 var textareaSelection = internals.youngestShadowRoot(textarea).getSelection(); 20 var textareaSelection = internals.youngestShadowRoot(textarea).getSelection();
20 var initialTextareaFocusNode = textareaSelection.focusNode; 21 var initialTextareaFocusNode = textareaSelection.focusNode;
21 22
22 var initialFocusNode = window.getSelection().focusNode; 23 var initialFocusNode = window.getSelection().focusNode;
23 var initialFocusOffset = window.getSelection().focusOffset; 24 var initialFocusOffset = window.getSelection().focusOffset;
24 25
25 shouldBe("textareaSelection.focusOffset", "2"); 26 shouldBe("textareaSelection.focusOffset", "2");
26 27
27 textareaSelection.modify("extend", "forward", "character"); 28 textareaSelection.modify("extend", "forward", "character");
(...skipping 18 matching lines...) Expand all
46 shouldBe("textareaSelection.focusNode", "initialTextareaFocusNode"); 47 shouldBe("textareaSelection.focusNode", "initialTextareaFocusNode");
47 shouldBe("textareaSelection.focusOffset", "4"); 48 shouldBe("textareaSelection.focusOffset", "4");
48 49
49 shouldBe("window.getSelection().focusNode", "initialFocusNode"); 50 shouldBe("window.getSelection().focusNode", "initialFocusNode");
50 shouldBe("window.getSelection().focusOffset", "initialFocusOffset"); 51 shouldBe("window.getSelection().focusOffset", "initialFocusOffset");
51 52
52 </script> 53 </script>
53 54
54 </body> 55 </body>
55 </html> 56 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698