PointerEvents: Firing MEs correctly after PE handler removes its target |
|||
Issue descriptionCurrently we fire the compat MouseEvent for a PointerEvent to the target of the PE. This correct as long as the PE handler doesn't delete the target node. The spec defines the ME's target to be the nearest "live" ancestor: > Unless otherwise noted, the target of any mapped mouse event should be > the same target as the respective pointer event unless the target is no > longer participating in its ownerDocument's tree. In this case, the > mouse event should be fired at the original target's nearest ancestor > node (at the time it was removed from the tree) that still participates > in its ownerDocument's tree, meaning that a new event path (based on > the new target node) is built for the mouse event. We need to fix this, add a test, and check Edge behavior. Thanks Rick for catching this.
,
Apr 29 2016
Sure.
,
May 2 2016
What if the pointer event handler first re-parent the node and then removes it? In that case even building the parent tree before pointer event handler would not help. Right?
,
May 2 2016
My interpretation of the spec above is that suppressing MEs on deleted node is all we need. Re-parented would still get MEs as if this _was_ the state before firing the PE. What does Edge do?
,
May 3 2016
I don't think that's what spec means. What I understand from the spec is retargeting the event to the first parent of the element when it belonged to the document before removing. So if it gets reparented and then removed I expected the new parent gets the mousedown targeted at itself. However, what Edge does is retargeting the mousedown to the parent node of the removed element before calling the pointerdown handler. Essentially it ignores the reparenting behavior there.
,
May 3 2016
In #4, I used "suppressing" to emphasize not sending MEs to an orphan node. I took the "retargeting" as the obvious outcome of the current spec wording, sorry for being too concise.
I agree that the last quoted line from the spec in #0 above ("a new event path ... is built for the mouse event") is the troubling point. Without it, we would treat compat mouse propagation path to be the same as PE propagation path for optimization, and easily match Edge.
Whichever way the spec clarifies it, in reality there would always be a way to tweak the DOM to break the spec wording. We shouldn't worry to much about such cases, and keep the spec wording simple to match existing implementations.
So, I am inclined to redefining compat ME propagation path as the PE propagation path in the PE spec. Let's go for a pull request to draw the attention of the WG, specially the Edge engineers. If they don't like it, both Edge and us will go for a new (non-optimized) implementation.
,
May 6 2016
,
May 9 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/827f606ae83c257352ab1711fe0eb4b142b8828f commit 827f606ae83c257352ab1711fe0eb4b142b8828f Author: nzolghadr <nzolghadr@chromium.org> Date: Mon May 09 15:17:55 2016 Retarget mouse event if the target is removed This CL calculates the ancenstor chain for every mouse event and retarget the mouse event to the first ancestor of the node that is still in the document if the pointer event handler removes the target node. BUG= 608003 Review-Url: https://codereview.chromium.org/1949563002 Cr-Commit-Position: refs/heads/master@{#392319} [add] https://crrev.com/827f606ae83c257352ab1711fe0eb4b142b8828f/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-node-remove-expected.txt [add] https://crrev.com/827f606ae83c257352ab1711fe0eb4b142b8828f/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-node-remove.html [modify] https://crrev.com/827f606ae83c257352ab1711fe0eb4b142b8828f/third_party/WebKit/LayoutTests/virtual/pointerevent/fast/events/pointerevents/mouse-pointer-capture-expected.txt [modify] https://crrev.com/827f606ae83c257352ab1711fe0eb4b142b8828f/third_party/WebKit/Source/core/events/Event.h [modify] https://crrev.com/827f606ae83c257352ab1711fe0eb4b142b8828f/third_party/WebKit/Source/core/input/PointerEventManager.cpp
,
May 9 2016
|
|||
►
Sign in to add a comment |
|||
Comment 1 by mustaq@chromium.org
, Apr 29 2016Owner: nzolghadr@chromium.org
Status: Assigned (was: Available)