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

Side by Side Diff: LayoutTests/fast/forms/range/slider-zoomed.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 html { 6 html {
7 /* zoom: 120%;*/ 7 /* zoom: 120%;*/
8 } 8 }
9 input[type="range"] { 9 input[type="range"] {
10 width: 200px; 10 width: 200px;
11 } 11 }
12 12
13 #results { 13 #results {
14 margin-top: 60px; 14 margin-top: 60px;
15 } 15 }
16 </style> 16 </style>
17 <script type="text/javascript" charset="utf-8"> 17 <script type="text/javascript" charset="utf-8">
18 if (window.testRunner) 18 if (window.testRunner)
19 testRunner.dumpAsText(); 19 testRunner.dumpAsText();
20
21 function dispatchEvent(eventType, clientX, clientY)
22 {
23 var ev = document.createEvent("MouseEvent");
24 ev.initMouseEvent(eventType, true, true, window, 1, 1, 1, clientX, clientY , false, false, false, false, 0, document);
25 var target = document.elementFromPoint(ev.clientX, ev.clientY);
26 target.dispatchEvent(ev);
27 }
28 20
29 function test() 21 function test()
30 { 22 {
31 // For some reason the slider needs mouseup/mousedown, not just a "click" 23 // For some reason the slider needs mouseup/mousedown, not just a "click"
32 dispatchEvent("mousedown", 150, 15); 24 eventSender.mouseMoveTo(150, 15);
33 dispatchEvent("mouseup", 150, 15); 25 eventSender.mouseDown(0);
26 eventSender.mouseUp(0);
34 27
35 const expectedValue = 72; 28 const expectedValue = 72;
36 var val = document.getElementById('slider').value; 29 var val = document.getElementById('slider').value;
37 var result; 30 var result;
38 if (val == expectedValue) 31 if (val == expectedValue)
39 result = "PASS: slider value set to " + expectedValue; 32 result = "PASS: slider value set to " + expectedValue;
40 else 33 else
41 result = "FAIL: expected slider value " + expectedValue + ", got " + val ; 34 result = "FAIL: expected slider value " + expectedValue + ", got " + val ;
42 document.getElementById('results').innerHTML = result; 35 document.getElementById('results').innerHTML = result;
43 } 36 }
44 </script> 37 </script>
45 </head> 38 </head>
46 <body onload="test()"> 39 <body onload="test()">
47 <input type="range" id="slider" min="0" max="100" value="10"> 40 <input type="range" id="slider" min="0" max="100" value="10">
48 <div id="results"> 41 <div id="results">
49 </div> 42 </div>
50 </body> 43 </body>
51 </html> 44 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/range/slider-transformed.html ('k') | LayoutTests/fast/forms/select-list-box-mouse-focus.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698