Implement MouseEvent's x/y and offsetX/offsetY attributes

This commit is contained in:
Micah Tigley 2019-10-18 16:04:18 -04:00
parent 1d450ba1f3
commit 38b91c3501
6 changed files with 74 additions and 29 deletions

View file

@ -616088,7 +616088,7 @@
"testharness"
],
"css/cssom-view/mouseEvent.html": [
"7e194b8909317806ff80e300cd480b31680a397e",
"d50959729239599ff057a71143553b4a53f88975",
"testharness"
],
"css/cssom-view/negativeMargins.html": [

View file

@ -128,12 +128,6 @@
[Range interface: operation getClientRects()]
expected: FAIL
[MouseEvent interface: attribute y]
expected: FAIL
[MouseEvent interface: attribute x]
expected: FAIL
[Element interface: calling scrollIntoView([object Object\],[object Object\]) on document.createElement("img") with too few arguments must throw TypeError]
expected: FAIL
@ -251,12 +245,6 @@
[Element interface: calling convertRectFromNode(DOMRectReadOnly, GeometryNode, ConvertCoordinateOptions) on document.createElement("div") with too few arguments must throw TypeError]
expected: FAIL
[MouseEvent interface: attribute offsetX]
expected: FAIL
[MouseEvent interface: attribute offsetY]
expected: FAIL
[CSSPseudoElement interface: operation convertRectFromNode(DOMRectReadOnly, GeometryNode, ConvertCoordinateOptions)]
expected: FAIL
@ -298,15 +286,3 @@
[Partial dictionary MouseEventInit: member names are unique]
expected: FAIL
[MouseEvent interface: new MouseEvent("foo") must inherit property "offsetY" with the proper type]
expected: FAIL
[MouseEvent interface: new MouseEvent("foo") must inherit property "y" with the proper type]
expected: FAIL
[MouseEvent interface: new MouseEvent("foo") must inherit property "x" with the proper type]
expected: FAIL
[MouseEvent interface: new MouseEvent("foo") must inherit property "offsetX" with the proper type]
expected: FAIL

View file

@ -1,4 +0,0 @@
[mouseEvent.html]
[MouseEvent's x and y must be equal to clientX and clientY.]
expected: FAIL

View file

@ -29,5 +29,14 @@ test(function () {
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');
test(function () {
var mouseEvent = new MouseEvent('mousedown', {clientX: 10, clientY: 20});
assert_equals(mouseEvent.offsetX, mouseEvent.pageX);
assert_equals(mouseEvent.offsetY, mouseEvent.pageY);
scrollBy(0, 5000);
assert_equals(mouseEvent.offsetX, mouseEvent.pageX);
assert_equals(mouseEvent.offsetY, mouseEvent.pageY);
}, 'MouseEvent\'s offsetX/offsetY attributes should be the same value as its pageX/pageY attributes.');
</script>
</head>