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

Side by Side Diff: content/test/data/touch_selection.html

Issue 23823004: Re-enable TouchCursorInTextfieldTest with some fixes and logs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a TODO to remove logs Created 7 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/web_contents/touch_editable_impl_aura_browsertest.cc ('k') | no next file » | 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 <div id='textDiv'>Some text we can select</div> 2 <div id='textDiv'>Some text we can select</div>
3 <input id='textfield' type="text" value="Text in a textfield"> 3 <input id='textfield' type="text" value="Text in a textfield">
4 <script> 4 <script>
5 5
6 function select_all_text() { 6 function select_all_text() {
7 var div = document.getElementById("textDiv"); 7 var div = document.getElementById("textDiv");
8 var range = document.createRange(); 8 var range = document.createRange();
9 range.selectNodeContents(div); 9 range.selectNodeContents(div);
10 var sel = window.getSelection(); 10 var sel = window.getSelection();
11 sel.removeAllRanges(); 11 sel.removeAllRanges();
12 sel.addRange(range); 12 sel.addRange(range);
13 } 13 }
14 14
15 function get_selection() { 15 function get_selection() {
16 return (window.getSelection() + ""); 16 return (window.getSelection() + "");
17 } 17 }
18 18
19 function focus_textfield() { 19 function focus_textfield() {
20 document.getElementById("textfield").focus(); 20 document.getElementById("textfield").focus();
21 window.getSelection().collapseToStart();
varunjain 2013/09/05 22:34:42 nit: small comment on why this is required.
21 } 22 }
22 23
23 function get_cursor_position() { 24 function get_cursor_position() {
24 var div = document.getElementById("textfield"); 25 var div = document.getElementById("textfield");
25 var start = div.selectionStart; 26 var start = div.selectionStart;
26 var end = div.selectionEnd; 27 var end = div.selectionEnd;
27 if (start == end) 28 if (start == end)
28 return start; 29 return start;
29 else 30 else
30 return -1; 31 return -1;
31 } 32 }
32 33
33 </script> 34 </script>
34 35
35 </html> 36 </html>
OLDNEW
« no previous file with comments | « content/browser/web_contents/touch_editable_impl_aura_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698