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

Side by Side Diff: LayoutTests/fast/forms/range/slider-transformed.html

Issue 894913002: Prevent default actions for JS-generated mouse events other than click (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: TIL, gclient sync may rebase changes back in time Created 5 years, 6 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 <html> 1 <html>
2 <head> 2 <head>
3 <meta http-equiv="Content-type" content="text/html; charset=utf-8"> 3 <meta http-equiv="Content-type" content="text/html; charset=utf-8">
4 <title>slider-transformed</title> 4 <title>slider-transformed</title>
5 <style type="text/css" media="screen"> 5 <style type="text/css" media="screen">
6 input[type="range"] { 6 input[type="range"] {
7 -webkit-transform-origin: top left; 7 -webkit-transform-origin: top left;
8 transform: rotate(45deg); 8 transform: rotate(45deg);
9 width: 200px; 9 width: 200px;
10 } 10 }
11 11
12 #results { 12 #results {
13 margin-top: 160px; 13 margin-top: 160px;
14 } 14 }
15 </style> 15 </style>
16 <script type="text/javascript" charset="utf-8"> 16 <script type="text/javascript" charset="utf-8">
17 if (window.testRunner) 17 if (window.testRunner)
18 testRunner.dumpAsText(); 18 testRunner.dumpAsText();
19
20 function dispatchEvent(eventType, clientX, clientY)
21 {
22 var ev = document.createEvent("MouseEvent");
23 ev.initMouseEvent(eventType, true, true, window, 1, 1, 1, clientX, clientY , false, false, false, false, 0, document);
24 var target = document.elementFromPoint(ev.clientX, ev.clientY);
25 target.dispatchEvent(ev);
26 }
27 19
28 function test() 20 function test()
29 { 21 {
30 // For some reason the slider needs mouseup/mousedown, not just a "click" 22 // For some reason the slider needs mouseup/mousedown, not just a "click"
31 dispatchEvent("mousedown", 61, 71); 23 eventSender.mouseMoveTo(61, 71);
32 dispatchEvent("mouseup", 61, 71); 24 eventSender.mouseDown(0);
25 eventSender.mouseUp(0);
26
33 27
34 const expectedValue = 39; 28 const expectedValue = 39;
35 var val = document.getElementById('slider').value; 29 var val = document.getElementById('slider').value;
36 var result; 30 var result;
37 if (val == expectedValue) 31 if (val == expectedValue)
38 result = "PASS: slider value set to " + expectedValue; 32 result = "PASS: slider value set to " + expectedValue;
39 else 33 else
40 result = "FAIL: expected slider value " + expectedValue + ", got " + val ; 34 result = "FAIL: expected slider value " + expectedValue + ", got " + val ;
41 document.getElementById('results').innerHTML = result; 35 document.getElementById('results').innerHTML = result;
42 } 36 }
43 </script> 37 </script>
44 </head> 38 </head>
45 <body onload="test()"> 39 <body onload="test()">
46 <input type="range" id="slider" min="0" max="100" value="10"> 40 <input type="range" id="slider" min="0" max="100" value="10">
47 <div id="results"> 41 <div id="results">
48 </div> 42 </div>
49 </body> 43 </body>
50 </html> 44 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/listbox-onchange.html ('k') | LayoutTests/fast/forms/range/slider-zoomed.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698