Closed Bug 1823661 Opened 2 years ago Closed 1 year ago

Fix wpt failures in pointerevent_attributes_hoverable_pointers.html?mouse

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: hsinyi, Assigned: masayuki)

References

(Depends on 1 open bug)

Details

Summary: Fix wpt failures in pointerevent_attributes_hoverable_pointers.html%3Fmouse → Fix wpt failures in pointerevent_attributes_hoverable_pointers.html?mouse
Assignee: nobody → masayuki
Status: NEW → ASSIGNED

It seems that there are 2 bugs. One is .button and .buttons values of ePointerOut, ePointerOver, ePointerLeave and ePointerEnter are just copied from the source mouse events.

The other is, when pointerDown in the <iframe>, oddly pointermove event is not fired. I'm still not sure the reason. The pointer is moved to the top-left corner of the parent document before clicking in the <iframe>. Therefore, ePointerMove event should be fired simply on the clicking element.

I've not gotten what is wrong about dispatching pointermove in the <iframe>.

The first test, calling clickInTarget(input_pointertype, square1); seems working. At this point, the <div> in the parent becomes invisible and the <div> in the child becomes visible. Then, the second test (clickInTarget(input_pointertype, square2);) starts after once the mouse pointer is moved to top-left of the document. Then, clickInTarget moves the pointer to the target first. At this point, ePointerMove should be fired on the newly visible <div> in the child. However, ePointerMove is dispatched to the root element (<html>) in the child. Then, ePointerDown is dispatched to the <div> and that causes ePointerOver and ePointerEnter. Therefore, I suspected a flushing pending layout timing issue. Therefore, I tried to make PresShell::EventHandler::MaybeFlushPendingNotifications flush pending notifications when eMouseMove. However, that does not fix. I have no idea why PresShell fails to target the <div> of eMouseMove and ePointerMove...

Edgar, do you have any ideas?

Flags: needinfo?(echen)

This patched events:

0:12.73 TEST_START: /pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse
 0:12.89 pid:51372 setting property to visible
 0:12.89 pid:51372 setting property to hidden
 0:12.90 pid:51372 setting property to 276px
 0:12.91 INFO {'actions': [{'type': 'none', 'actions': [{'type': 'pause', 'duration': 16}, {'type': 'pause', 'duration': 16}, {'type': 'pause', 'duration': 16}], 'id': '0'}, {'type': 'pointer', 'actions': [{'type': 'pointerMove', 'x': 0, 'y': 0, 'origin': {'element-6066-11e4-a52e-4f735466cecf': 'd2d81b19-b069-48d8-9560-7cc564b7b413'}}, {'type': 'pointerDown', 'button': 0}, {'type': 'pointerUp', 'button': 0}], 'parameters': {'pointerType': 'mouse'}, 'id': 'mousePointer1'}]}
 0:12.97 pid:51372 ePointerMove event target = div['square1'].body.html.#document (http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse)
 0:12.98 pid:51372 eMouseMove event target = div['square1'].body.html.#document (http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse)
 0:12.98 pid:51372 ePointerDown event target = div['square1'].body.html.#document (http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse)
 0:12.98 pid:51372 eMouseDown event target = div['square1'].body.html.#document (http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse)
 0:13.00 pid:51372 ePointerUp event target = div['square1'].body.html.#document (http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse)
 0:13.01 pid:51372 eMouseUp event target = div['square1'].body.html.#document (http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse)
 0:13.01 pid:51372 eMouseClick event target = div['square1'].body.html.#document (http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse)
 0:13.04 INFO {'actions': [{'type': 'none', 'actions': [{'type': 'pause', 'duration': 16}], 'id': '1'}, {'type': 'pointer', 'actions': [{'type': 'pointerMove', 'x': 0, 'y': 0, 'origin': 'viewport'}], 'parameters': {'pointerType': 'mouse'}, 'id': 'mousePointer1'}]}
 0:13.10 INFO {'actions': [{'type': 'none', 'actions': [{'type': 'pause', 'duration': 16}, {'type': 'pause', 'duration': 16}, {'type': 'pause', 'duration': 16}], 'id': '2'}, {'type': 'pointer', 'actions': [{'type': 'pointerMove', 'x': 0, 'y': 0, 'origin': {'element-6066-11e4-a52e-4f735466cecf': '6bedb3fe-96f5-495d-908e-c08f323be135'}}, {'type': 'pointerDown', 'button': 0}, {'type': 'pointerUp', 'button': 0}], 'parameters': {'pointerType': 'mouse'}, 'id': 'mousePointer1'}]}
 0:13.14 pid:51372 setting property to hidden
 0:13.14 pid:51372 setting property to visible
 0:13.14 pid:51372 ePointerMove event target = html.#document (http://web-platform.test:8000/pointerevents/resources/pointerevent_attributes_hoverable_pointers-iframe.html)
 0:13.14 pid:51372 eMouseMove event target = html.#document (http://web-platform.test:8000/pointerevents/resources/pointerevent_attributes_hoverable_pointers-iframe.html)
 0:13.14 pid:51372 ePointerDown event target = div['square2'].body.html.#document (http://web-platform.test:8000/pointerevents/resources/pointerevent_attributes_hoverable_pointers-iframe.html)
 0:13.15 pid:51372 eMouseDown event target = div['square2'].body.html.#document (http://web-platform.test:8000/pointerevents/resources/pointerevent_attributes_hoverable_pointers-iframe.html)
 0:13.16 pid:51372 ePointerUp event target = div['square2'].body.html.#document (http://web-platform.test:8000/pointerevents/resources/pointerevent_attributes_hoverable_pointers-iframe.html)
 0:13.17 pid:51372 eMouseUp event target = div['square2'].body.html.#document (http://web-platform.test:8000/pointerevents/resources/pointerevent_attributes_hoverable_pointers-iframe.html)
 0:13.17 pid:51372 eMouseClick event target = div['square2'].body.html.#document (http://web-platform.test:8000/pointerevents/resources/pointerevent_attributes_hoverable_pointers-iframe.html)

I put the printf here.

I think the issue is that the mouse isn't moved by moveToDocument() at all, I have ran into the same problem before, see bug 1520785, I workaround it by changing the coordinate from (0, 0) to (1, 1) in test. We could also do that in this test, but I would like to clarify the behavior of gecko driver as well, I filed bug 1850148.

Flags: needinfo?(echen)
See Also: → 1520785
Depends on: 1850148

If I apply this patch:

diff --git a/testing/web-platform/tests/pointerevents/pointerevent_support.js b/testing/web-platform/tests/pointerevents/pointerevent_support.js
--- a/testing/web-platform/tests/pointerevents/pointerevent_support.js
+++ b/testing/web-platform/tests/pointerevents/pointerevent_support.js
@@ -396,16 +396,17 @@ function pointerHoverInTarget(pointerTyp
     .pointerMove(3 * x_delta, 3 * y_delta, {origin: target})
     .send();
 }

 function moveToDocument(pointerType) {
   var pointerId = pointerType + "Pointer1";
   return new test_driver.Actions()
     .addPointer(pointerId, pointerType)
+    .pointerMove(1, 1)
     .pointerMove(0, 0)
     .send();
 }

 // Returns a promise that only gets resolved when the condition is met.
 function resolveWhen(condition) {
   return new Promise((resolve, reject) => {
     function tick() {

The test gets these result:

  UNEXPECTED-PASS mouse pointerevent attributes
  UNEXPECTED-PASS Inner frame  mouse pointermove.type should be pointermove
  PRECONDITION_FAILED Inner frame  mouse pointermove.fromElement value is null - undefined
check_PointerEvent/<@http://web-platform.test:8000/pointerevents/pointerevent_support.js:78:31
Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:2599:25
test@http://web-platform.test:8000/resources/testharness.js:628:30
check_PointerEvent@http://web-platform.test:8000/pointerevents/pointerevent_support.js:77:7
checkPointerEventAttributes@http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse:81:35
run/</<@http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse:119:52
  PRECONDITION_FAILED Inner frame  mouse pointermove.toElement value is null - undefined
check_PointerEvent/<@http://web-platform.test:8000/pointerevents/pointerevent_support.js:82:31
Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:2599:25
test@http://web-platform.test:8000/resources/testharness.js:628:30
check_PointerEvent@http://web-platform.test:8000/pointerevents/pointerevent_support.js:81:7
checkPointerEventAttributes@http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse:81:35
run/</<@http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse:119:52
  UNEXPECTED-PASS Inner frame  mouse pointerdown.type should be pointerdown
  PRECONDITION_FAILED Inner frame  mouse pointerout.fromElement value is null - undefined
check_PointerEvent/<@http://web-platform.test:8000/pointerevents/pointerevent_support.js:78:31
Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:2599:25
test@http://web-platform.test:8000/resources/testharness.js:628:30
check_PointerEvent@http://web-platform.test:8000/pointerevents/pointerevent_support.js:77:7
checkPointerEventAttributes@http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse:81:35
run/</<@http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse:119:52
  PRECONDITION_FAILED Inner frame  mouse pointerout.toElement value is null - undefined
check_PointerEvent/<@http://web-platform.test:8000/pointerevents/pointerevent_support.js:82:31
Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:2599:25
test@http://web-platform.test:8000/resources/testharness.js:628:30
check_PointerEvent@http://web-platform.test:8000/pointerevents/pointerevent_support.js:81:7
checkPointerEventAttributes@http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse:81:35
run/</<@http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse:119:52
  PRECONDITION_FAILED Inner frame  mouse pointerleave.fromElement value is null - undefined
check_PointerEvent/<@http://web-platform.test:8000/pointerevents/pointerevent_support.js:78:31
Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:2599:25
test@http://web-platform.test:8000/resources/testharness.js:628:30
check_PointerEvent@http://web-platform.test:8000/pointerevents/pointerevent_support.js:77:7
checkPointerEventAttributes@http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse:81:35
run/</<@http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse:119:52
  PRECONDITION_FAILED Inner frame  mouse pointerleave.toElement value is null - undefined
check_PointerEvent/<@http://web-platform.test:8000/pointerevents/pointerevent_support.js:82:31
Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:2599:25
test@http://web-platform.test:8000/resources/testharness.js:628:30
check_PointerEvent@http://web-platform.test:8000/pointerevents/pointerevent_support.js:81:7
checkPointerEventAttributes@http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse:81:35
run/</<@http://web-platform.test:8000/pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse:119:52
  UNEXPECTED-OK /pointerevents/pointerevent_attributes_hoverable_pointers.html?mouse

Finally, the meta file will be updated as:

diff --git a/testing/web-platform/meta/pointerevents/pointerevent_attributes_hoverable_pointers.html.ini b/testing/web-platform/meta/pointerevents/pointerevent_attributes_hoverable_pointers.html.ini
--- a/testing/web-platform/meta/pointerevents/pointerevent_attributes_hoverable_pointers.html.ini
+++ b/testing/web-platform/meta/pointerevents/pointerevent_attributes_hoverable_pointers.html.ini
@@ -1,19 +1,15 @@
 [pointerevent_attributes_hoverable_pointers.html?pen]
   expected: ERROR
   [pen pointerevent attributes]
     expected: NOTRUN


 [pointerevent_attributes_hoverable_pointers.html?mouse]
-  expected: TIMEOUT
-  [mouse pointerevent attributes]
-    expected: NOTRUN
-
   [mouse pointerover.fromElement value is null]
     expected: PRECONDITION_FAILED

   [mouse pointerover.toElement value is null]
     expected: PRECONDITION_FAILED

   [mouse pointerenter.fromElement value is null]
     expected: PRECONDITION_FAILED
@@ -58,25 +54,37 @@
     expected: PRECONDITION_FAILED

   [Inner frame  mouse pointerenter.fromElement value is null]
     expected: PRECONDITION_FAILED

   [Inner frame  mouse pointerenter.toElement value is null]
     expected: PRECONDITION_FAILED

-  [Inner frame  mouse pointermove.type should be pointermove]
-    expected: FAIL
-
   [Inner frame  mouse pointerdown.fromElement value is null]
     expected: PRECONDITION_FAILED

   [Inner frame  mouse pointerdown.toElement value is null]
     expected: PRECONDITION_FAILED

-  [Inner frame  mouse pointerdown.type should be pointerdown]
-    expected: FAIL
-
   [Inner frame  mouse pointerup.fromElement value is null]
     expected: PRECONDITION_FAILED

   [Inner frame  mouse pointerup.toElement value is null]
     expected: PRECONDITION_FAILED
+
+  [Inner frame  mouse pointermove.fromElement value is null]
+    expected: PRECONDITION_FAILED
+
+  [Inner frame  mouse pointermove.toElement value is null]
+    expected: PRECONDITION_FAILED
+
+  [Inner frame  mouse pointerout.fromElement value is null]
+    expected: PRECONDITION_FAILED
+
+  [Inner frame  mouse pointerout.toElement value is null]
+    expected: PRECONDITION_FAILED
+
+  [Inner frame  mouse pointerleave.fromElement value is null]
+    expected: PRECONDITION_FAILED
+
+  [Inner frame  mouse pointerleave.toElement value is null]
+    expected: PRECONDITION_FAILED

Only the 2 FAIL are the problem here.
https://searchfox.org/mozilla-central/rev/eadfec923e2b9c927ade8d0dd4f08a82da50a8a9/testing/web-platform/meta/pointerevents/pointerevent_attributes_hoverable_pointers.html.ini#67,76

Therefore, this now completely depend on bug 1850148.

According to the current spec and the newly added test on WebDriver, the first action in each sequence with coordinates (0,0) is considered a no-op action. Therefore, I think we could update the test to avoid using (0,0) as the coordinate to move the mouse out of the iframe. Instead of using a non-(0,0) random coordinates, we could add a dummy element and move mouse there. WDYT?

Well, the function is a utility method of multiple tests, and some tests might expect that the pointer was moved to (0, 0). So, I think that my approach in comment 6 must be safer. I'll post it onto tryserver to check whether it causes unexpected failures in the other tests.

Except PRECONDITION_FAILED tests, now, all green in wpt.fy.

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED

FYI: The PRECONDITION_FAILEDs are caused by bug 1539619.

Depends on: 1539619
You need to log in before you can comment on or make changes to this bug.