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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/touch/gesture/gesture-tap-setrangetext-with-events.html

Issue 2201853002: Blink handle selection handle visibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed incorrect rebase Created 3 years, 11 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 <script src="../../../../resources/testharness.js"></script> 2 <script src="../../../../resources/testharness.js"></script>
3 <script src="../../../../resources/testharnessreport.js"></script> 3 <script src="../../../../resources/testharnessreport.js"></script>
4 <input type="text" value="value" id="textfield"></input> 4 <input type="text" value="value" id="textfield"></input>
5 <script> 5 <script>
6 async_test(function(t) { 6 async_test(function(t) {
7 window.onload = t.step_func(function() { 7 window.onload = t.step_func(function() {
8 if (!window.eventSender) { 8 if (!window.eventSender) {
9 t.done(); 9 t.done();
10 return; 10 return;
11 } 11 }
12 doSetSelectionRange('focus'); 12 doSetSelectionRange('focus');
13 doSetSelectionRange('mousedown');
14 doSetSelectionRange('mouseup'); 13 doSetSelectionRange('mouseup');
15 doSetSelectionRange('click'); 14 doSetSelectionRange('click');
16 t.done(); 15 t.done();
17 }); 16 });
18 17
19 function doSetSelectionRange(eventType) { 18 function doSetSelectionRange(eventType) {
20 var textfield = document.getElementById('textfield'); 19 var textfield = document.getElementById('textfield');
21 textfield.setSelectionRange(0, 0); 20 textfield.setSelectionRange(0, 0);
22 var tx = textfield.offsetLeft + 4; 21 var tx = textfield.offsetLeft + 4;
23 var ty = textfield.offsetTop + 4; 22 var ty = textfield.offsetTop + 4;
24 23
25 textfield.addEventListener(eventType, setSelectionRange); 24 textfield.addEventListener(eventType, setSelectionRange);
26 eventSender.gestureTapDown(tx, ty); 25 eventSender.gestureTapDown(tx, ty);
27 eventSender.gestureShowPress(tx, ty); 26 eventSender.gestureShowPress(tx, ty);
28 eventSender.gestureTap(tx, ty); 27 eventSender.gestureTap(tx, ty);
29 if (eventType === 'mousedown') { 28 assert_equals(textfield.selectionStart, 0);
30 assert_equals(textfield.selectionStart, 0); 29 assert_equals(textfield.selectionEnd, 5);
31 assert_equals(textfield.selectionEnd, 0);
32 } else {
33 assert_equals(textfield.selectionStart, 0);
34 assert_equals(textfield.selectionEnd, 5);
35 }
36 textfield.setSelectionRange(0, 0); 30 textfield.setSelectionRange(0, 0);
37 textfield.removeEventListener(eventType, setSelectionRange); 31 textfield.removeEventListener(eventType, setSelectionRange);
38 } 32 }
39 33
40 function setSelectionRange(e) { 34 function setSelectionRange(e) {
41 var textfield = document.getElementById('textfield'); 35 var textfield = document.getElementById('textfield');
42 textfield.setSelectionRange(0, textfield.value.length); 36 textfield.setSelectionRange(0, textfield.value.length);
43 } 37 }
44 }, "This tests the selection of the text field after setSelectionRange is called during a tap."); 38 }, "This tests the selection of the text field after setSelectionRange is called during a tap.");
45 </script> 39 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698