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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/selection-functions.html

Issue 1437813002: Set selection to INPUT/TEXTAREA before dispatching 'focus' event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: improve selection-functions.html Created 5 years, 1 month 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 | third_party/WebKit/LayoutTests/fast/forms/selection-functions-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script type="text/javascript"> 3 <script type="text/javascript">
4 function print(message) 4 function print(message)
5 { 5 {
6 var paragraph = document.createElement("div"); 6 var paragraph = document.createElement("div");
7 if (message == "") { 7 if (message == "") {
8 paragraph.appendChild(document.createElement("br")); 8 paragraph.appendChild(document.createElement("br"));
9 } else { 9 } else {
10 paragraph.appendChild(document.createTextNode(message)); 10 paragraph.appendChild(document.createTextNode(message));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 elt.selectionEnd = 2; 81 elt.selectionEnd = 2;
82 display(elt); 82 display(elt);
83 elt.selectionEnd = -1; 83 elt.selectionEnd = -1;
84 display(elt); 84 display(elt);
85 elt.selectionEnd = 54; 85 elt.selectionEnd = 54;
86 display(elt); 86 display(elt);
87 elt.selectionStart = 7; 87 elt.selectionStart = 7;
88 elt.selectionEnd = 7; 88 elt.selectionEnd = 7;
89 display(elt); 89 display(elt);
90 90
91 print("");
92 print("selectionStart and selectionEnd in focus handler don't re turn wrong values 0,0:");
93 elt.selectionStart = elt.selectionEnd = 7;
94 // Need to clear selection. Selection API calls above modified
95 // both of real selection and |elt|'s cached selection even
96 // though |elt| has no focus.
97 // We'd like to check the behavior in case that real selection
98 // and the cached selection are mismatched.
99 getSelection().removeAllRanges();
100 // selectionStart and selectionEnd are still 7.
101 elt.onfocus = function() { display(elt); };
102 elt.focus();
103
91 elt.value = ""; 104 elt.value = "";
92 } 105 }
93 function testButtonSelectionAccess(button, access) 106 function testButtonSelectionAccess(button, access)
94 { 107 {
95 var source = "button" + access; 108 var source = "button" + access;
96 try { 109 try {
97 eval(source); 110 eval(source);
98 print(source + " did not throw exception"); 111 print(source + " did not throw exception");
99 } catch(e) { 112 } catch(e) {
100 print(source + " threw exception"); 113 print(source + " threw exception");
(...skipping 13 matching lines...) Expand all
114 <p>If this test passed you'll see a bunch of correct selection ranges be low. Check the expected file for the correct ranges.</p> 127 <p>If this test passed you'll see a bunch of correct selection ranges be low. Check the expected file for the correct ranges.</p>
115 <hr /> 128 <hr />
116 <form> 129 <form>
117 <textarea id="text"></textarea> 130 <textarea id="text"></textarea>
118 <input type="text" id="input" /> 131 <input type="text" id="input" />
119 <input type="button" id="button" /> 132 <input type="button" id="button" />
120 </form> 133 </form>
121 <hr /> 134 <hr />
122 <p id="console"></p> 135 <p id="console"></p>
123 </body> 136 </body>
124 </html> 137 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/forms/selection-functions-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698