DescriptionWIP Logging for Contextual Search: Node->Element.
Base patch description below.
============================================
Fix the wrong TextNode handling in EventHanlder and MouseEventManager
EventHandler and MouseEventManager are storing a clicked node (or a touched node) as Node*, instead of Element*,
That would be a bad practice. Actually, that would be the cause of several wrong behaviors in Blink, such as:
(A) Blink does NOT fire a click event when a clicked text node has been removed in mouseup.
This is wrong because a click event should be fired on an element node.
See [1] for details.
(B) Blink DOES fire a touch event on a non-element node.
This is wrong because TouchEvent specification says all kinds of touch events' event target types are only Document and Element.
For reference, (A) would happen in the following scenario:
1. User presses a mouse button
2. UA did a hittest. The result's innerNode() is a text node.
3. MouseEventManager#click_node_ is set to the parent element of the clicked
text node
4. Dispatch mouse press events (or anything)
5. User releases a mouse button
6. UA did another hittest because UA would dispatch a click event at the commo
n ancestor of:
- A location of mouse pressed; MouseEventManager#click_node_ is used in this case.
- and A location of mouse released; The 2nd hit test's result is used in this case.
7. Users removed a text node, which is the result of 2nd hit test.
8. Since there is no common ancestor of MouseEventManager#click_node_ and the
2nd hit test's result, a click event is not dispatched.
To prevent these wrong behaviors, this CL does:
- Replaces the usage of |Node*| to |Element*| as much as possible so that it rejects the wrong code at type level.
- To prevent a false-negative event firing, like in the mentioned case, preserve the parent *element*, if necessary, of a clicked node
before dispatching MouseRelease event so that a following click event should be fired correctly even when a text node has been removed in mouseup.
- [1]: topmost event target; https://www.w3.org/TR/uievents/#topmost-event-target
- [2]: Trusted proximal event target types are: Document and Element; https://w3c.github.io/touch-events/#list-of-touchevent-types
This CL mainly aims to fix bug 708394. I think there are other places, such as other events, which should be fixed, which can be done in another CL.
BUG=708394, 710425
patch from issue 2807123002 at patchset 80001 (http://crrev.com/2807123002#ps80001)
Patch Set 1 #
Total comments: 3
Messages
Total messages: 7 (2 generated)
|