Modify event re-targeting algorithm so that we can tell which distributed node is...
authorhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jun 2012 18:10:03 +0000 (18:10 +0000)
committerhayato@chromium.org <hayato@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jun 2012 18:10:03 +0000 (18:10 +0000)
commit6320f5945240725003d526dbe9b4492fa4822d8f
treeb9f60295bbbc65f22898fb93e28b02cdf15dc008
parent3dec47d6184d68d07d3b018a1c4744db8b60878a
Modify event re-targeting algorithm so that we can tell which distributed node is clicked.
https://bugs.webkit.org/show_bug.cgi?id=89073

Reviewed by Dimitri Glazkov.

Source/WebCore:

Re-landing r120945 since bug 89172 was resolved.

Adopt a new event re-targeting algorithm in the latest Shadow DOM spec.
The corresponding bug in the shadow DOM spec is:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=17090

This change is introduced to handle the following use case:
1. There is an insertion point, with zero or more nodes distributed into it.
2. User clicks on one of the items.
3. The event handler in shadow DOM subtree wants to know which item was clicked on.

The new re-targeting algorithm sets an event's target to a
distributed node where an event was originally fired, instead of
an insertion point to where the node is distributed.

The similar re-targeting algorithm also applies to an event's
relatedTarget.

Test: fast/dom/shadow/shadow-dom-event-dispatching.html

* dom/EventDispatcher.cpp:
(WebCore::EventRelatedTargetAdjuster::adjust):
(WebCore::EventDispatcher::ensureEventAncestors):

LayoutTests:

* fast/dom/shadow/shadow-dom-event-dispatching-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@121040 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/shadow/shadow-dom-event-dispatching-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/dom/EventDispatcher.cpp