Title: [120615] trunk
Revision
120615
Author
[email protected]
Date
2012-06-18 12:16:50 -0700 (Mon, 18 Jun 2012)

Log Message

Event dispatcher should use InsertionPoint::hasDistribution instead of InsertinPoint::isActive in re-targeting.
https://bugs.webkit.org/show_bug.cgi?id=89180

Reviewed by Dimitri Glazkov.

Source/WebCore:

If an event is fired on a fallback element within a insertion
point which does not select any nodes, the result of event's
re-targeting will be wrong since it uses
InsertionPoint::isActive() to judge an existence of a lower boundary.
That must use InsertionPoint::hasDistribution().

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

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

LayoutTests:

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

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (120614 => 120615)


--- trunk/LayoutTests/ChangeLog	2012-06-18 19:02:37 UTC (rev 120614)
+++ trunk/LayoutTests/ChangeLog	2012-06-18 19:16:50 UTC (rev 120615)
@@ -1,3 +1,13 @@
+2012-06-18  Hayato Ito  <[email protected]>
+
+        Event dispatcher should use InsertionPoint::hasDistribution instead of InsertinPoint::isActive in re-targeting.
+        https://bugs.webkit.org/show_bug.cgi?id=89180
+
+        Reviewed by Dimitri Glazkov.
+
+        * fast/dom/shadow/shadow-dom-event-dispatching-expected.txt:
+        * fast/dom/shadow/shadow-dom-event-dispatching.html:
+
 2012-06-18  Zan Dobersek  <[email protected]>
 
         Unreviewed GTK gardening, updating baselines after r120596 and r120609.

Modified: trunk/LayoutTests/fast/dom/shadow/shadow-dom-event-dispatching-expected.txt (120614 => 120615)


--- trunk/LayoutTests/fast/dom/shadow/shadow-dom-event-dispatching-expected.txt	2012-06-18 19:02:37 UTC (rev 120614)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-dom-event-dispatching-expected.txt	2012-06-18 19:16:50 UTC (rev 120615)
@@ -399,6 +399,32 @@
      @non-distributed-node (target: non-distributed-node)
      @A (target: non-distributed-node)
      @top (target: non-distributed-node)
+
+
+Composed Shadow Tree will be:
+DIV	 id=sandbox
+	DIV	 id=top
+		DIV	 id=A
+			DIV	 id=fallback
+
+
+Moving mouse from A/fallback to A
+
+  mouseout
+     @fallback (target: fallback) (related: A)
+     @content (target: fallback) (related: A)
+     @shadow-root (target: fallback) (related: A)
+
+  mouseover
+
+Moving mouse from A to A/fallback
+
+  mouseout
+
+  mouseover
+     @fallback (target: fallback) (related: A)
+     @content (target: fallback) (related: A)
+     @shadow-root (target: fallback) (related: A)
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/dom/shadow/shadow-dom-event-dispatching.html (120614 => 120615)


--- trunk/LayoutTests/fast/dom/shadow/shadow-dom-event-dispatching.html	2012-06-18 19:02:37 UTC (rev 120614)
+++ trunk/LayoutTests/fast/dom/shadow/shadow-dom-event-dispatching.html	2012-06-18 19:16:50 UTC (rev 120615)
@@ -352,6 +352,25 @@
     debugDispatchedEvent('click');
 }
 
+function testEventsOnFallbackElements()
+{
+    sandbox.innerHTML = '';
+    sandbox.appendChild(
+        createDOM('div', {'id': 'top'},
+                  createDOM('div', {'id': 'A'},
+                            createShadowRoot(
+                                createDOM('content', {'id': 'content', 'select': '#none'},
+                                          createDOM('div', {'id': 'fallback'}))),
+                            createDOM('div', {'id': 'B'}))));
+
+    addEventListeners(['top', 'A', 'B', 'A/', 'A/content', 'A/fallback']);
+    getNodeInShadowTreeStack('A/').id = 'shadow-root';
+    showSandboxTree();
+
+    moveMouse('A/fallback', 'A');
+    moveMouse('A', 'A/fallback');
+}
+
 function test()
 {
     if (window.layoutTestController)
@@ -366,6 +385,7 @@
     testEventsOnChildOfInactiveContent();
     testEventsOnMultipleShadowRoots();
     testEventsOnNonDistributedNodes();
+    testEventsOnFallbackElements();
 }
 
 test();

Modified: trunk/Source/WebCore/ChangeLog (120614 => 120615)


--- trunk/Source/WebCore/ChangeLog	2012-06-18 19:02:37 UTC (rev 120614)
+++ trunk/Source/WebCore/ChangeLog	2012-06-18 19:16:50 UTC (rev 120615)
@@ -1,3 +1,21 @@
+2012-06-18  Hayato Ito  <[email protected]>
+
+        Event dispatcher should use InsertionPoint::hasDistribution instead of InsertinPoint::isActive in re-targeting.
+        https://bugs.webkit.org/show_bug.cgi?id=89180
+
+        Reviewed by Dimitri Glazkov.
+
+        If an event is fired on a fallback element within a insertion
+        point which does not select any nodes, the result of event's
+        re-targeting will be wrong since it uses
+        InsertionPoint::isActive() to judge an existence of a lower boundary.
+        That must use InsertionPoint::hasDistribution().
+
+        Test: fast/dom/shadow/shadow-dom-event-dispatching.html
+
+        * dom/EventDispatcher.cpp:
+        (WebCore::EventDispatcher::ensureEventAncestors):
+
 2012-06-18  Tony Payne  <[email protected]>
 
        [chromium] Add iccjpeg and qcms to chromium port

Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (120614 => 120615)


--- trunk/Source/WebCore/dom/EventDispatcher.cpp	2012-06-18 19:02:37 UTC (rev 120614)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp	2012-06-18 19:16:50 UTC (rev 120615)
@@ -205,7 +205,7 @@
     Vector<EventTarget*> targetStack;
     for (ComposedShadowTreeParentWalker walker(m_node.get()); walker.get(); walker.parentIncludingInsertionPointAndShadowRoot()) {
         Node* node = walker.get();
-        if (isActiveInsertionPoint(node) || targetStack.isEmpty())
+        if ((isInsertionPoint(node) && toInsertionPoint(node)->hasDistribution()) || targetStack.isEmpty())
             targetStack.append(eventTargetRespectingSVGTargetRules(node));
         m_ancestors.append(EventContext(node, eventTargetRespectingSVGTargetRules(node), targetStack.last()));
         if (!inDocument)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to