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

Side by Side Diff: third_party/WebKit/LayoutTests/touchadjustment/touch-links-longpress.html

Issue 2247963002: Suppress drag and drop on links on touch screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase mac result so it uses the expected txt shared by all platforms 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 <head> 3 <head>
4 <title>Touch Adjustment : Testing that a drag/drop will start on a long pres s - bug 92914</title> 4 <title>Touch Adjustment : Testing that a drag/drop will start on a long pres s - bug 92914</title>
5 <script src="../resources/js-test.js"></script> 5 <script src="../resources/js-test.js"></script>
6 <script src="resources/touchadjustment.js"></script> 6 <script src="resources/touchadjustment.js"></script>
7 <style> 7 <style>
8 #sandbox { 8 #sandbox {
9 position: absolute; 9 position: absolute;
10 left: 0px; 10 left: 0px;
11 top: 0px; 11 top: 0px;
12 } 12 }
13 </style> 13 </style>
14 </head> 14 </head>
15 15
16 <body> 16 <body>
17 17
18 <div id="sandbox"> 18 <div id="sandbox">
19 <p><a href="" id="link1">I</a> propose to consider <a href="" id="link2">the que stion</a>, "Can machines think?"<br>This should begin with definitions of the me aning of the terms "machine" and <a href="" id="link3">"think."</a></p> 19 <p><a id="link1">I</a> propose to consider <a id="link2">the question</a>, "Can machines think?"<br>This should begin with definitions of the meaning of the ter ms "machine" and <a id="link3">"think."</a></p>
20 </div> 20 </div>
21 21
22 <p id='description'></p> 22 <p id='description'></p>
23 <div id='console'></div> 23 <div id='console'></div>
24 24
25 <script> 25 <script>
26 var element; 26 var element;
27 var adjustedNode; 27 var adjustedNode;
28 // Set up shortcut access to elements 28 // Set up shortcut access to elements
29 var e = {}; 29 var e = {};
30 ['sandbox', 'link1', 'link2', 'link3'].forEach(function(a) { 30 ['sandbox', 'link1', 'link2', 'link3'].forEach(function(a) {
31 e[a] = document.getElementById(a); 31 e[a] = document.getElementById(a);
32 }); 32 });
33 33
34 document.ondragstart = function(e) { debug("PASS"); e.preventDefault();} 34 document.ondragstart = function(e) { debug("PASS"); e.preventDefault();}
35 35
36 function testLongPress(touchpoint) 36 function testLongPress(touchpoint)
37 { 37 {
38 if (eventSender.gestureLongPress) 38 if (eventSender.gestureLongPress) {
39 // Anchor tags without href are not treated as links, but as texts
40 // instead.
41 // The first long press selects the text. The second long press will
42 // initiate drag and drop.
39 eventSender.gestureLongPress(touchpoint.x, touchpoint.y, touchpoint. width, touchpoint.height); 43 eventSender.gestureLongPress(touchpoint.x, touchpoint.y, touchpoint. width, touchpoint.height);
44 eventSender.leapForward(100);
45 eventSender.gestureLongPress(touchpoint.x, touchpoint.y, touchpoint. width, touchpoint.height);
46 }
40 else 47 else
41 debug("gestureLongPress not implemented by this platform."); 48 debug("gestureLongPress not implemented by this platform.");
42 } 49 }
43 50
44 function testDirectTouch(element) 51 function testDirectTouch(element)
45 { 52 {
46 // Touch directly in the center of the element. 53 // Touch directly in the center of the element.
47 var touchpoint = offsetTouchPoint(findAbsoluteBounds(element), 'center', 0, 20, 30); 54 var touchpoint = offsetTouchPoint(findAbsoluteBounds(element), 'center', 0, 20, 30);
48 if (document.elementFromPoint(touchpoint.x, touchpoint.y) != element) 55 if (document.elementFromPoint(touchpoint.x, touchpoint.y) != element)
49 testFailed('Direct touch ended up on some other element'); 56 testFailed('Direct touch ended up on some other element');
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 description('Tests if a long press gesture on links will trigger a d rag/drop when touch adjustment is used.'); 100 description('Tests if a long press gesture on links will trigger a d rag/drop when touch adjustment is used.');
94 testDirectTouches(); 101 testDirectTouches();
95 testIndirectTouches(); 102 testIndirectTouches();
96 e.sandbox.style.display = 'none'; 103 e.sandbox.style.display = 'none';
97 } 104 }
98 } 105 }
99 runTests(); 106 runTests();
100 </script> 107 </script>
101 </body> 108 </body>
102 </html> 109 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698