Implements pageX and pageY attributes

This commit is contained in:
Micah Tigley 2019-10-16 11:31:57 -04:00
parent 58c61d3aed
commit 4b93a2350c
5 changed files with 49 additions and 15 deletions

View file

@ -613547,7 +613547,7 @@
"testharness"
],
"css/cssom-view/mouseEvent.html": [
"907a2b405e442ba09ae623327d6f7de5492d3a80",
"7e194b8909317806ff80e300cd480b31680a397e",
"testharness"
],
"css/cssom-view/negativeMargins.html": [

View file

@ -29,12 +29,6 @@
[Text interface: document.createTextNode("x") must inherit property "getBoxQuads(BoxQuadOptions)" with the proper type]
expected: FAIL
[MouseEvent interface: attribute pageX]
expected: FAIL
[MouseEvent interface: attribute pageY]
expected: FAIL
[HTMLImageElement interface: document.createElement("img") must inherit property "x" with the proper type]
expected: FAIL
@ -316,10 +310,3 @@
[MouseEvent interface: new MouseEvent("foo") must inherit property "offsetX" with the proper type]
expected: FAIL
[MouseEvent interface: new MouseEvent("foo") must inherit property "pageY" with the proper type]
expected: FAIL
[MouseEvent interface: new MouseEvent("foo") must inherit property "pageX" with the proper type]
expected: FAIL

View file

@ -2,6 +2,9 @@
<meta charset=utf-8>
<head>
<title>CSSOM MouseEvent tests</title>
<div style="background:lightblue; height:10000px">
Hello
</div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
@ -13,5 +16,18 @@ test(function () {
assert_equals(mouseEvent.x, 30);
assert_equals(mouseEvent.y, 40);
}, 'MouseEvent\'s x and y must be equal to clientX and clientY.');
test(function () {
var mouseEvent1 = new MouseEvent('mousedown', {clientX: 10, clientY: 20});
assert_equals(mouseEvent1.pageX, 10);
assert_equals(mouseEvent1.pageY, 20);
scrollBy(0, 5000);
assert_equals(mouseEvent1.pageX, 10);
assert_equals(mouseEvent1.pageY, 5020);
var mouseEvent2 = new MouseEvent('mousedown', {clientX: 10, clientY: 20});
assert_equals(mouseEvent2.pageX, 10);
assert_equals(mouseEvent2.pageY, 5020);
}, 'MouseEvent\'s pageX and pageY attributes should be the sum of the scroll offset and clientX/clientY');
</script>
</head>