Index: Source/core/css/resolver/ScopedStyleResolver.h |
diff --git a/Source/core/css/resolver/ScopedStyleResolver.h b/Source/core/css/resolver/ScopedStyleResolver.h |
index 2ad0d7f728c5ea954cf3424561572317f7b4cb9f..bfb471116f89bb50307bdb3ec14f539580cdcc7e 100644 |
--- a/Source/core/css/resolver/ScopedStyleResolver.h |
+++ b/Source/core/css/resolver/ScopedStyleResolver.h |
@@ -30,6 +30,7 @@ |
#include "core/css/ElementRuleCollector.h" |
#include "core/css/RuleSet.h" |
#include "core/dom/ContainerNode.h" |
+#include "core/dom/shadow/ShadowRoot.h" |
#include "wtf/HashMap.h" |
#include "wtf/OwnPtr.h" |
#include "wtf/PassOwnPtr.h" |
@@ -53,6 +54,7 @@ public: |
const TreeScope& treeScope() const { return m_scopingNode.treeScope(); } |
void setParent(ScopedStyleResolver* newParent) { m_parent = newParent; } |
ScopedStyleResolver* parent() { return m_parent; } |
+ bool crossingScopeBoundary(const Element*) const; |
public: |
bool checkRegionStyle(Element*); |
@@ -78,6 +80,27 @@ private: |
KeyframesRuleMap m_keyframesRuleMap; |
}; |
+inline bool ScopedStyleResolver::crossingScopeBoundary(const Element* element) const |
+{ |
+ // Always ++cascadeScope if style scoped. |
dglazkov
2014/01/16 17:31:31
"++cascadeScope" lacks context here. It describes
tasak
2014/01/20 03:50:06
Done.
|
+ if (!m_scopingNode.isShadowRoot()) |
+ return true; |
+ |
+ // If parent is a given shadow host, this resolver is for shadow trees hosted by the host. |
+ // Should not ++casscadeScope. |
+ Element* host = toShadowRoot(&m_scopingNode)->host(); |
+ if (element == host) |
+ return false; |
+ |
+ // If parent is document scope or style scoped, ++cascadeScope. |
+ if (!m_parent || !m_parent->scopingNode().isShadowRoot()) |
+ return true; |
+ |
+ // If parent is hosted by the same shadow host, keep the same cascadeScope. |
+ // Instead, ++cascadeScope. |
+ return toShadowRoot(&m_parent->scopingNode())->host() != host; |
+} |
+ |
} // namespace WebCore |
#endif // ScopedStyleResolver_h |