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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/constructors/mouse-event-constructor.html

Issue 2406263003: Make PointerEvent coordinates fractional for touch (Closed)
Patch Set: Rebased. Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/constructors/mouse-event-constructor-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 <script src="../resources/input-modifiers.js"></script> 5 <script src="../resources/input-modifiers.js"></script>
6 </head> 6 </head>
7 <body> 7 <body>
8 <script> 8 <script>
9 9
10 description("This tests the constructor for the MouseEvent DOM class."); 10 description("This tests the constructor for the MouseEvent DOM class.");
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 shouldThrow("new MouseEvent('eventType', { view: 'chocolate' }).view"); 54 shouldThrow("new MouseEvent('eventType', { view: 'chocolate' }).view");
55 shouldThrow("new MouseEvent('eventType', { view: 12345 }).view"); 55 shouldThrow("new MouseEvent('eventType', { view: 12345 }).view");
56 shouldThrow("new MouseEvent('eventType', { view: 18446744073709551615 }).view"); 56 shouldThrow("new MouseEvent('eventType', { view: 18446744073709551615 }).view");
57 shouldThrow("new MouseEvent('eventType', { view: NaN }).view"); 57 shouldThrow("new MouseEvent('eventType', { view: NaN }).view");
58 // Note that valueOf() is not called, when the left hand side is evaluated. 58 // Note that valueOf() is not called, when the left hand side is evaluated.
59 shouldThrow("new MouseEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window"); 59 shouldThrow("new MouseEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window");
60 shouldBe("new MouseEvent('eventType', { get view() { return window; } }).view", "window"); 60 shouldBe("new MouseEvent('eventType', { get view() { return window; } }).view", "window");
61 shouldThrow("new MouseEvent('eventType', { get view() { return 123; } }).view"); 61 shouldThrow("new MouseEvent('eventType', { get view() { return 123; } }).view");
62 shouldThrow("new MouseEvent('eventType', { get view() { throw 'MouseEvent Error' ; } })"); 62 shouldThrow("new MouseEvent('eventType', { get view() { throw 'MouseEvent Error' ; } })");
63 63
64 // Max/min for client positions (LayoutUnit max/min). 64 // detail is passed.
65 var MAX_CLIENT_SIZE = "33554431"; 65 // Numeric values.
66 var MIN_CLIENT_SIZE = "-33554432"; 66 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: 0 }).detail", 0);
67 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: 1 }).detail", 1);
68 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: -1 }).detail", -1);
69 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: 2147483647 }).detai l", 2147483647);
70 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: -2147483648 }).deta il", -2147483648);
71 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: 123.45 }).detail", 123);
72 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: -123.45 }).detail", -123);
73 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: NaN }).detail", 0);
74 // Non-numeric values.
75 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: undefined }).detail ", 0);
76 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: null }).detail", 0) ;
77 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: '' }).detail", 0);
78 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: '12345' }).detail", 12345);
79 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: '12345a' }).detail" , 0);
80 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: 'abc' }).detail", 0 );
81 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: [] }).detail", 0);
82 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: [12345] }).detail", 12345);
83 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: [12345, 67890] }).d etail", 0);
84 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: {} }).detail", 0);
85 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: {moemoe: 12345} }). detail", 0);
86 shouldBeEqualToNumber("new MouseEvent('eventType', { detail: {valueOf: function () { return 12345; }} }).detail", 12345);
67 87
68 // detail, screenX, screenY, clientX and clientY are passed. 88 // screenX, screenY, clientX and clientY are passed.
69 ["detail", "screenX", "screenY", "clientX", "clientY"].forEach(function (attr) { 89 ["screenX", "screenY", "clientX", "clientY"].forEach(function (attr) {
70 // numbers within the long range. 90 // Numeric values.
71 shouldBe("new MouseEvent('eventType', { " + attr + ": 0 })." + attr, "0"); 91 shouldBeEqualToNumber("new MouseEvent('eventType', { " + attr + ": 0 })." + attr, 0);
72 shouldBe("new MouseEvent('eventType', { " + attr + ": 2147483647 })." + attr , attr == "clientX" || attr == "clientY" ? MAX_CLIENT_SIZE : "2147483647"); 92 shouldBeEqualToNumber("new MouseEvent('eventType', { " + attr + ": 1 })." + attr, 1);
73 shouldBe("new MouseEvent('eventType', { " + attr + ": -1 })." + attr, "-1"); 93 shouldBeEqualToNumber("new MouseEvent('eventType', { " + attr + ": -1 })." + attr, -1);
74 shouldBe("new MouseEvent('eventType', { " + attr + ": -2147483648 })." + att r, attr == "clientX" || attr == "clientY" ? MIN_CLIENT_SIZE : "-2147483648"); 94 shouldBeEqualToNumber("new MouseEvent('eventType', { " + attr + ": 214748364 7 })." + attr, 2147483647);
75 95 shouldBeEqualToNumber("new MouseEvent('eventType', { " + attr + ": -21474836 48 })." + attr, -2147483648);
76 // numbers out of the long range. 96 shouldBeEqualToNumber("new MouseEvent('eventType', { " + attr + ": 123.45 }) ." + attr, 123);
77 shouldBe("new MouseEvent('eventType', { " + attr + ": 4294967295 })." + attr , "-1"); 97 shouldBeEqualToNumber("new MouseEvent('eventType', { " + attr + ": -123.45 } )." + attr, -123);
78 // 2^{53}-1, the largest number that can be exactly represented by double. 98 shouldThrow("new MouseEvent('eventType', { " + attr + ": NaN })." + attr);
79 shouldBe("new MouseEvent('eventType', { " + attr + ": 9007199254740991 })." + attr, "-1");
80 // 2^{64}-1
81 shouldBe("new MouseEvent('eventType', { " + attr + ": 18446744073709551615 } )." + attr, "0");
82 shouldBe("new MouseEvent('eventType', { " + attr + ": 123.45 })." + attr, "1 23");
83 shouldBe("new MouseEvent('eventType', { " + attr + ": NaN })." + attr, "0");
84 99
85 // Non-numeric values. 100 // Non-numeric values.
86 shouldBe("new MouseEvent('eventType', { " + attr + ": undefined })." + attr, "0"); 101 shouldBeEqualToNumber("new MouseEvent('eventType', { " + attr + ": undefined })." + attr, 0);
87 shouldBe("new MouseEvent('eventType', { " + attr + ": null })." + attr, "0") ; 102 shouldBeEqualToNumber("new MouseEvent('eventType', { " + attr + ": null })." + attr, 0);
88 shouldBe("new MouseEvent('eventType', { " + attr + ": '' })." + attr, "0"); 103 shouldBeEqualToNumber("new MouseEvent('eventType', { " + attr + ": '' })." + attr, 0);
89 shouldBe("new MouseEvent('eventType', { " + attr + ": '12345' })." + attr, " 12345"); 104 shouldBeEqualToNumber("new MouseEvent('eventType', { " + attr + ": '12345' } )." + attr, 12345);
90 shouldBe("new MouseEvent('eventType', { " + attr + ": '12345a' })." + attr, "0"); 105 shouldThrow("new MouseEvent('eventType', { " + attr + ": '12345a' })." + att r);
91 shouldBe("new MouseEvent('eventType', { " + attr + ": 'abc' })." + attr, "0" ); 106 shouldThrow("new MouseEvent('eventType', { " + attr + ": 'abc' })." + attr);
92 shouldBe("new MouseEvent('eventType', { " + attr + ": [] })." + attr, "0"); 107 shouldBeEqualToNumber("new MouseEvent('eventType', { " + attr + ": [] })." + attr, 0);
93 shouldBe("new MouseEvent('eventType', { " + attr + ": [12345] })." + attr, " 12345"); 108 shouldBeEqualToNumber("new MouseEvent('eventType', { " + attr + ": [12345] } )." + attr, 12345);
94 shouldBe("new MouseEvent('eventType', { " + attr + ": [12345, 67890] })." + attr, "0"); 109 shouldThrow("new MouseEvent('eventType', { " + attr + ": [12345, 67890] })." + attr);
95 shouldBe("new MouseEvent('eventType', { " + attr + ": {} })." + attr, "0"); 110 shouldThrow("new MouseEvent('eventType', { " + attr + ": {} })." + attr);
96 shouldBe("new MouseEvent('eventType', { " + attr + ": {moemoe: 12345} })." + attr, "0"); 111 shouldThrow("new MouseEvent('eventType', { " + attr + ": {moemoe: 12345} }). " + attr);
97 shouldBe("new MouseEvent('eventType', { " + attr + ": {valueOf: function () { return 12345; }} })." + attr, "12345"); 112 shouldBeEqualToNumber("new MouseEvent('eventType', { " + attr + ": {valueOf: function () { return 12345; }} })." + attr, 12345);
98 }); 113 });
99 114
100 // ctrlKey, altKey, shiftKey and metaKey are passed. 115 // ctrlKey, altKey, shiftKey and metaKey are passed.
101 ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach(function (attr) { 116 ["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach(function (attr) {
102 shouldBe("new MouseEvent('eventType', { " + attr + ": false })." + attr, "fa lse"); 117 shouldBe("new MouseEvent('eventType', { " + attr + ": false })." + attr, "fa lse");
103 shouldBe("new MouseEvent('eventType', { " + attr + ": true })." + attr, "tru e"); 118 shouldBe("new MouseEvent('eventType', { " + attr + ": true })." + attr, "tru e");
104 }); 119 });
105 120
106 // all modifiers are passed correctly. 121 // all modifiers are passed correctly.
107 forEachModifier(function(attr, modifierName) { 122 forEachModifier(function(attr, modifierName) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).clientY", "555"); 227 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).clientY", "555");
213 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).ctrlKey", "true"); 228 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).ctrlKey", "true");
214 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).shiftKey", "true"); 229 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).shiftKey", "true");
215 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).altKey", "true"); 230 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).altKey", "true");
216 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).metaKey", "true"); 231 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).metaKey", "true");
217 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).button", "666"); 232 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).button", "666");
218 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).relatedTarget", "testDiv"); 233 shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: w indow, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrl Key: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 77 7, relatedTarget: testDiv }).relatedTarget", "testDiv");
219 </script> 234 </script>
220 </body> 235 </body>
221 </html> 236 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/constructors/mouse-event-constructor-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698