Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Unified Diff: third_party/WebKit/Source/core/events/EventPath.cpp

Issue 2384403002: Dispatch synthetic events even when target and relatedTarget are identical (Closed)
Patch Set: fix Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/events/EventPath.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/events/EventPath.cpp
diff --git a/third_party/WebKit/Source/core/events/EventPath.cpp b/third_party/WebKit/Source/core/events/EventPath.cpp
index 28c8bb6ed0f95648d74e17c6d97db1dd7031fcbd..95d95b54c008a82a2a85bba28a3cf1cd6c833505 100644
--- a/third_party/WebKit/Source/core/events/EventPath.cpp
+++ b/third_party/WebKit/Source/core/events/EventPath.cpp
@@ -300,7 +300,7 @@ void EventPath::adjustForRelatedTarget(Node& target,
if (target.document() != relatedNode->document())
return;
retargetRelatedTarget(*relatedNode);
- shrinkForRelatedTarget(target, *relatedNode);
+ shrinkForRelatedTarget(target);
}
void EventPath::retargetRelatedTarget(const Node& relatedTargetNode) {
@@ -315,13 +315,22 @@ void EventPath::retargetRelatedTarget(const Node& relatedTargetNode) {
}
}
-void EventPath::shrinkForRelatedTarget(const Node& target,
- const Node& relatedTarget) {
- if (!target.isInShadowTree() && !relatedTarget.isInShadowTree())
- return;
+bool EventPath::shouldStopEventPath(EventTarget& currentTarget,
+ EventTarget& currentRelatedTarget,
+ const Node& target) {
+ if (&currentTarget != &currentRelatedTarget)
+ return false;
+ if (m_event->isTrusted())
+ return true;
+ Node* currentTargetNode = currentTarget.toNode();
+ if (!currentTargetNode)
+ return false;
+ return currentTargetNode->treeScope() != target.treeScope();
+}
+
+void EventPath::shrinkForRelatedTarget(const Node& target) {
for (size_t i = 0; i < size(); ++i) {
- if (at(i).target() == at(i).relatedTarget()) {
- // Event dispatching should be stopped here.
+ if (shouldStopEventPath(*at(i).target(), *at(i).relatedTarget(), target)) {
shrink(i);
break;
}
« no previous file with comments | « third_party/WebKit/Source/core/events/EventPath.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698