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

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

Issue 59903015: [Shadow DOM]: Empty shadow insertion points should behave like <shadow><content *leftover*></conten… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 | « Source/core/dom/shadow/ElementShadow.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/events/EventPath.cpp
diff --git a/Source/core/events/EventPath.cpp b/Source/core/events/EventPath.cpp
index 086d53cf7fc5e1aae91f3f3b4e6f902e88d37c8d..954ef21816a6447785378ee0d6785422412f5c61 100644
--- a/Source/core/events/EventPath.cpp
+++ b/Source/core/events/EventPath.cpp
@@ -204,27 +204,27 @@ void EventPath::calculateAdjustedEventPathForEachNode()
}
#ifndef NDEBUG
-static inline bool movedFromChildToParent(const TreeScope& lastTreeScope, const TreeScope& currentTreeScope)
+static inline bool movedFromOlderToYounger(const TreeScope& lastTreeScope, const TreeScope& currentTreeScope)
{
- return lastTreeScope.parentTreeScope() == &currentTreeScope;
+ Node* rootNode = lastTreeScope.rootNode();
+ return rootNode->isShadowRoot() && toShadowRoot(rootNode)->youngerShadowRoot() == currentTreeScope.rootNode();
}
-static inline bool movedFromOlderToYounger(const TreeScope& lastTreeScope, const TreeScope& currentTreeScope)
+static inline bool movedFromYoungerToOlder(const TreeScope& lastTreeScope, const TreeScope& currentTreeScope)
{
Node* rootNode = lastTreeScope.rootNode();
- return rootNode->isShadowRoot() && toShadowRoot(rootNode)->youngerShadowRoot() == currentTreeScope.rootNode();
+ return rootNode->isShadowRoot() && toShadowRoot(rootNode)->olderShadowRoot() == currentTreeScope.rootNode();
}
#endif
-static inline bool movedFromParentToChild(const TreeScope& lastTreeScope, const TreeScope& currentTreeScope)
+static inline bool movedFromChildToParent(const TreeScope& lastTreeScope, const TreeScope& currentTreeScope)
{
- return currentTreeScope.parentTreeScope() == &lastTreeScope;
+ return lastTreeScope.parentTreeScope() == &currentTreeScope;
}
-static inline bool movedFromYoungerToOlder(const TreeScope& lastTreeScope, const TreeScope& currentTreeScope)
+static inline bool movedFromParentToChild(const TreeScope& lastTreeScope, const TreeScope& currentTreeScope)
{
- Node* rootNode = lastTreeScope.rootNode();
- return rootNode->isShadowRoot() && toShadowRoot(rootNode)->olderShadowRoot() == currentTreeScope.rootNode();
+ return currentTreeScope.parentTreeScope() == &lastTreeScope;
}
void EventPath::calculateAdjustedTargets()
@@ -239,14 +239,21 @@ void EventPath::calculateAdjustedTargets()
if (targetStack.isEmpty()) {
targetStack.append(current);
} else if (*lastTreeScope != currentTreeScope && !isSVGElement) {
- if (movedFromParentToChild(*lastTreeScope, currentTreeScope) || movedFromYoungerToOlder(*lastTreeScope, currentTreeScope)) {
+ if (movedFromParentToChild(*lastTreeScope, currentTreeScope)) {
targetStack.append(targetStack.last());
+ } else if (movedFromChildToParent(*lastTreeScope, currentTreeScope)) {
+ ASSERT(!targetStack.isEmpty());
+ targetStack.removeLast();
+ if (targetStack.isEmpty())
+ targetStack.append(current);
} else {
- ASSERT(movedFromChildToParent(*lastTreeScope, currentTreeScope) || movedFromOlderToYounger(*lastTreeScope, currentTreeScope));
+ ASSERT(movedFromYoungerToOlder(*lastTreeScope, currentTreeScope) || movedFromOlderToYounger(*lastTreeScope, currentTreeScope));
ASSERT(!targetStack.isEmpty());
targetStack.removeLast();
if (targetStack.isEmpty())
targetStack.append(current);
+ else
+ targetStack.append(targetStack.last());
}
}
at(i).setTarget(eventTargetRespectingTargetRules(targetStack.last()));
« no previous file with comments | « Source/core/dom/shadow/ElementShadow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698