Title: [87914] trunk
- Revision
- 87914
- Author
- [email protected]
- Date
- 2011-06-02 08:59:38 -0700 (Thu, 02 Jun 2011)
Log Message
2011-06-02 Dimitri Glazkov <[email protected]>
Reviewed by Darin Adler.
Stop event propagation for cases where relatedTarget is both ancestor of the target and at shadow boundary.
https://bugs.webkit.org/show_bug.cgi?id=61892
* fast/events/shadow-boundary-crossing.html: Added a test that uses new shadow DOM testing machinery.
* fast/events/shadow-boundary-crossing-expected.txt: Updated expectations.
2011-06-02 Dimitri Glazkov <[email protected]>
Reviewed by Darin Adler.
Stop event propagation for cases where relatedTarget is both ancestor of the target and at shadow boundary.
https://bugs.webkit.org/show_bug.cgi?id=61892
In the cases where the relatedTarget of an event is an ancestor of the target, and the relatedTarget is
a shadow host, we should not allow events to escape out of the hosted shadow DOM subtree.
* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::adjustToShadowBoundaries): Added a check that is valid for both new and old shadow DOM.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (87913 => 87914)
--- trunk/LayoutTests/ChangeLog 2011-06-02 15:48:11 UTC (rev 87913)
+++ trunk/LayoutTests/ChangeLog 2011-06-02 15:59:38 UTC (rev 87914)
@@ -1,3 +1,13 @@
+2011-06-02 Dimitri Glazkov <[email protected]>
+
+ Reviewed by Darin Adler.
+
+ Stop event propagation for cases where relatedTarget is both ancestor of the target and at shadow boundary.
+ https://bugs.webkit.org/show_bug.cgi?id=61892
+
+ * fast/events/shadow-boundary-crossing.html: Added a test that uses new shadow DOM testing machinery.
+ * fast/events/shadow-boundary-crossing-expected.txt: Updated expectations.
+
2011-06-02 Mario Sanchez Prada <[email protected]>
Unreviewed, skipping failing tests in GTK after r87901.
Modified: trunk/LayoutTests/fast/events/shadow-boundary-crossing-expected.txt (87913 => 87914)
--- trunk/LayoutTests/fast/events/shadow-boundary-crossing-expected.txt 2011-06-02 15:48:11 UTC (rev 87913)
+++ trunk/LayoutTests/fast/events/shadow-boundary-crossing-expected.txt 2011-06-02 15:59:38 UTC (rev 87914)
@@ -5,6 +5,7 @@
Mutation events should not propagate out of the shadow DOM: PASS
The selectstart event should not propagate out of the shadow DOM: PASS
The mouseover/mouseout event between two elements inside the same shadow subtree should not propagate out of the shadow DOM: PASS
+The mouseover event in a shadow subtree, where related target is the tree host should not escape out of shadow DOM: PASS
The mouseover/mouseout event on a shadow subtree host should propagate out of the shadow DOM: PASS
Label should look beyond shadow boundary to detect if it encloses its associated element: PASS
Events for default event handler should not be retargeted: PASS
Modified: trunk/LayoutTests/fast/events/shadow-boundary-crossing.html (87913 => 87914)
--- trunk/LayoutTests/fast/events/shadow-boundary-crossing.html 2011-06-02 15:48:11 UTC (rev 87913)
+++ trunk/LayoutTests/fast/events/shadow-boundary-crossing.html 2011-06-02 15:59:38 UTC (rev 87914)
@@ -114,6 +114,28 @@
document.body.removeEventListener('mouseout', countEventDispatch, false);
fileInput.parentNode.removeChild(fileInput);
},
+ relatedTargetAsHost: function()
+ {
+ var count = 0;
+ var relatedTarget = document.createElement('div');
+ relatedTarget.style.cssText = 'width: 50px; height: 50px; padding-left: 50px;';
+ document.body.appendChild(relatedTarget);
+ var target = document.createElement('div');
+ target.style.cssText = 'width: 50px; height: 50px';
+ layoutTestController.ensureShadowRoot(relatedTarget).appendChild(target);
+ moveOverLeftQuarterOf(relatedTarget);
+ var countEventDispatch = function()
+ {
+ count++;
+ }
+ relatedTarget.addEventListener('mouseover', countEventDispatch, false)
+ moveOverRightQuarterOf(relatedTarget);
+
+ log("The mouseover event in a shadow subtree, where related target is the tree host should not escape out of shadow DOM", count == 0);
+
+ relatedTarget.removeEventListener('mouseover', countEventDispatch, false);
+ document.body.removeChild(relatedTarget);
+ },
mouseOverOnHost: function()
{
var count = 0;
Modified: trunk/Source/WebCore/ChangeLog (87913 => 87914)
--- trunk/Source/WebCore/ChangeLog 2011-06-02 15:48:11 UTC (rev 87913)
+++ trunk/Source/WebCore/ChangeLog 2011-06-02 15:59:38 UTC (rev 87914)
@@ -1,3 +1,16 @@
+2011-06-02 Dimitri Glazkov <[email protected]>
+
+ Reviewed by Darin Adler.
+
+ Stop event propagation for cases where relatedTarget is both ancestor of the target and at shadow boundary.
+ https://bugs.webkit.org/show_bug.cgi?id=61892
+
+ In the cases where the relatedTarget of an event is an ancestor of the target, and the relatedTarget is
+ a shadow host, we should not allow events to escape out of the hosted shadow DOM subtree.
+
+ * dom/EventDispatcher.cpp:
+ (WebCore::EventDispatcher::adjustToShadowBoundaries): Added a check that is valid for both new and old shadow DOM.
+
2011-06-02 Hans Wennborg <[email protected]>
Reviewed by Tony Gentilcore.
Modified: trunk/Source/WebCore/dom/EventDispatcher.cpp (87913 => 87914)
--- trunk/Source/WebCore/dom/EventDispatcher.cpp 2011-06-02 15:48:11 UTC (rev 87913)
+++ trunk/Source/WebCore/dom/EventDispatcher.cpp 2011-06-02 15:59:38 UTC (rev 87914)
@@ -125,6 +125,11 @@
return node->isShadowRoot() || node->isSVGShadowRoot();
}
+static inline bool isShadowHost(Node* node)
+{
+ return node->isElementNode() && toElement(node)->shadowRoot();
+}
+
PassRefPtr<EventTarget> EventDispatcher::adjustToShadowBoundaries(PassRefPtr<Node> relatedTarget, const Vector<Node*> relatedTargetAncestors)
{
Vector<EventContext>::const_iterator lowestCommonBoundary = m_ancestors.end();
@@ -159,7 +164,8 @@
if (!diverged) {
// The relatedTarget is an ancestor or shadowHost of the target.
- if (m_node->shadowHost() == relatedTarget.get())
+ // FIXME: Remove the first check once conversion to new shadow DOM is complete <http://webkit.org/b/48698>
+ if (m_node->shadowHost() == relatedTarget.get() || isShadowHost(relatedTarget.get()))
lowestCommonBoundary = m_ancestors.begin();
} else if ((*firstDivergentBoundary) == m_node.get()) {
// Since ancestors does not contain target itself, we must account
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes