Index: Source/WebCore/dom/Node.cpp |
=================================================================== |
--- Source/WebCore/dom/Node.cpp (revision 78113) |
+++ Source/WebCore/dom/Node.cpp (working copy) |
@@ -2839,6 +2839,18 @@ |
gNodesDispatchingSimulatedClicks->remove(this); |
} |
+// FIXME: Once https://bugs.webkit.org/show_bug.cgi?id=52963 lands, this should |
+// be greatly improved. See https://bugs.webkit.org/show_bug.cgi?id=54025. |
+static Node* pullOutOfShadow(Node* node) |
+{ |
+ Node* outermostShadowBoundary = node; |
+ for (Node* n = node; n; n = n->parentOrHostNode()) { |
+ if (n->isShadowRoot()) |
+ outermostShadowBoundary = n->parentOrHostNode(); |
+ } |
+ return outermostShadowBoundary; |
+} |
+ |
bool Node::dispatchMouseEvent(const AtomicString& eventType, int button, int detail, |
int pageX, int pageY, int screenX, int screenY, |
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, |
@@ -2861,7 +2873,7 @@ |
bool swallowEvent = false; |
// Attempting to dispatch with a non-EventTarget relatedTarget causes the relatedTarget to be silently ignored. |
- RefPtr<Node> relatedTarget = relatedTargetArg; |
+ RefPtr<Node> relatedTarget = pullOutOfShadow(relatedTargetArg); |
int adjustedPageX = pageX; |
int adjustedPageY = pageY; |