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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp

Issue 1885453002: Rename Node::treeScope() to Node::treeScopeOrDocument() Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 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
Index: third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
index 0fea015ee3232792e21c805d18038169265c13bb..4042acf814dac590a1627bff068173a39d71e61c 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
@@ -229,12 +229,12 @@ void StyleResolver::appendCSSStyleSheet(CSSStyleSheet& cssSheet)
ASSERT(!cssSheet.disabled());
ASSERT(cssSheet.ownerDocument());
ASSERT(cssSheet.ownerNode());
- ASSERT(isHTMLStyleElement(cssSheet.ownerNode()) || isSVGStyleElement(cssSheet.ownerNode()) || cssSheet.ownerNode()->treeScope() == cssSheet.ownerDocument());
+ ASSERT(isHTMLStyleElement(cssSheet.ownerNode()) || isSVGStyleElement(cssSheet.ownerNode()) || cssSheet.ownerNode()->treeScopeOrDocument() == cssSheet.ownerDocument());
if (cssSheet.mediaQueries() && !m_medium->eval(cssSheet.mediaQueries(), &m_viewportDependentMediaQueryResults, &m_deviceDependentMediaQueryResults))
return;
- TreeScope* treeScope = &cssSheet.ownerNode()->treeScope();
+ TreeScope* treeScope = &cssSheet.ownerNode()->treeScopeOrDocument();
// TODO(rune@opera.com): This is a workaround for crbug.com/559292
// when we're in the middle of removing a subtree with a style element
// and the treescope has been changed but inDocument and isInShadowTree
@@ -388,7 +388,7 @@ void StyleResolver::clearStyleSharingList()
static inline ScopedStyleResolver* scopedResolverFor(const Element& element)
{
- // Ideally, returning element->treeScope().scopedStyleResolver() should be
+ // Ideally, returning element->treeScopeOrDocument().scopedStyleResolver() should be
// enough, but ::cue and custom pseudo elements like ::-webkit-meter-bar pierce
// through a shadow dom boundary, yet they are not part of m_treeBoundaryCrossingScopes.
// The assumption here is that these rules only pierce through one boundary and
@@ -399,7 +399,7 @@ static inline ScopedStyleResolver* scopedResolverFor(const Element& element)
// FIXME: Make ::cue and custom pseudo elements part of boundary crossing rules
// when moving those rules to ScopedStyleResolver as part of issue 401359.
- TreeScope* treeScope = &element.treeScope();
+ TreeScope* treeScope = &element.treeScopeOrDocument();
if (ScopedStyleResolver* resolver = treeScope->scopedStyleResolver()) {
ASSERT(element.shadowPseudoId().isEmpty());
ASSERT(!element.isVTTElement());
@@ -440,7 +440,7 @@ static void matchSlottedRules(const Element& element, ElementRuleCollector& coll
HeapVector<Member<ScopedStyleResolver>> resolvers;
for (; slot; slot = slot->assignedSlot()) {
- if (ScopedStyleResolver* resolver = slot->treeScope().scopedStyleResolver())
+ if (ScopedStyleResolver* resolver = slot->treeScopeOrDocument().scopedStyleResolver())
resolvers.append(resolver);
}
for (auto it = resolvers.rbegin(); it != resolvers.rend(); ++it) {
@@ -471,13 +471,13 @@ static void matchElementScopeRules(const Element& element, ScopedStyleResolver*
static bool shouldCheckScope(const Element& element, const Node& scopingNode, bool isInnerTreeScope)
{
- if (isInnerTreeScope && element.treeScope() != scopingNode.treeScope()) {
+ if (isInnerTreeScope && element.treeScopeOrDocument() != scopingNode.treeScopeOrDocument()) {
// Check if |element| may be affected by a ::content rule in |scopingNode|'s style.
// If |element| is a descendant of a shadow host which is ancestral to |scopingNode|,
// the |element| should be included for rule collection.
// Skip otherwise.
- const TreeScope* scope = &scopingNode.treeScope();
- while (scope && scope->parentTreeScope() != &element.treeScope())
+ const TreeScope* scope = &scopingNode.treeScopeOrDocument();
+ while (scope && scope->parentTreeScope() != &element.treeScopeOrDocument())
scope = scope->parentTreeScope();
Element* shadowHost = scope ? scope->rootNode().shadowHost() : nullptr;
return shadowHost && element.isDescendantOf(shadowHost);
@@ -485,12 +485,12 @@ static bool shouldCheckScope(const Element& element, const Node& scopingNode, bo
// When |element| can be distributed to |scopingNode| via <shadow>, ::content rule can match,
// thus the case should be included.
- if (!isInnerTreeScope && scopingNode.parentOrShadowHostNode() == element.treeScope().rootNode().parentOrShadowHostNode())
+ if (!isInnerTreeScope && scopingNode.parentOrShadowHostNode() == element.treeScopeOrDocument().rootNode().parentOrShadowHostNode())
return true;
// Obviously cases when ancestor scope has /deep/ or ::shadow rule should be included.
// Skip otherwise.
- return scopingNode.treeScope().scopedStyleResolver()->hasDeepOrShadowSelector();
+ return scopingNode.treeScopeOrDocument().scopedStyleResolver()->hasDeepOrShadowSelector();
}
void StyleResolver::matchScopedRules(const Element& element, ElementRuleCollector& collector)
@@ -512,15 +512,15 @@ void StyleResolver::matchScopedRules(const Element& element, ElementRuleCollecto
bool matchElementScopeDone = !elementScopeResolver && !element.inlineStyle();
for (auto it = m_treeBoundaryCrossingScopes.rbegin(); it != m_treeBoundaryCrossingScopes.rend(); ++it) {
- const TreeScope& scope = (*it)->treeScope();
+ const TreeScope& scope = (*it)->treeScopeOrDocument();
ScopedStyleResolver* resolver = scope.scopedStyleResolver();
ASSERT(resolver);
- bool isInnerTreeScope = element.treeScope().isInclusiveAncestorOf(scope);
+ bool isInnerTreeScope = element.treeScopeOrDocument().isInclusiveAncestorOf(scope);
if (!shouldCheckScope(element, **it, isInnerTreeScope))
continue;
- if (!matchElementScopeDone && scope.isInclusiveAncestorOf(element.treeScope())) {
+ if (!matchElementScopeDone && scope.isInclusiveAncestorOf(element.treeScopeOrDocument())) {
matchElementScopeDone = true;
@@ -660,12 +660,12 @@ void StyleResolver::collectTreeBoundaryCrossingRules(const Element& element, Ele
for (const auto& scopingNode : m_treeBoundaryCrossingScopes) {
// Skip rule collection for element when tree boundary crossing rules of scopingNode's
// scope can never apply to it.
- bool isInnerTreeScope = element.treeScope().isInclusiveAncestorOf(scopingNode->treeScope());
+ bool isInnerTreeScope = element.treeScopeOrDocument().isInclusiveAncestorOf(scopingNode->treeScopeOrDocument());
if (!shouldCheckScope(element, *scopingNode, isInnerTreeScope))
continue;
CascadeOrder cascadeOrder = isInnerTreeScope ? innerCascadeOrder : outerCascadeOrder;
- scopingNode->treeScope().scopedStyleResolver()->collectMatchingTreeBoundaryCrossingRules(collector, cascadeOrder);
+ scopingNode->treeScopeOrDocument().scopedStyleResolver()->collectMatchingTreeBoundaryCrossingRules(collector, cascadeOrder);
++innerCascadeOrder;
--outerCascadeOrder;
@@ -1150,7 +1150,7 @@ StyleRuleKeyframes* StyleResolver::findKeyframesRule(const Element* element, con
{
HeapVector<Member<ScopedStyleResolver>, 8> resolvers;
collectScopedResolversForHostedShadowTrees(*element, resolvers);
- if (ScopedStyleResolver* scopedResolver = element->treeScope().scopedStyleResolver())
+ if (ScopedStyleResolver* scopedResolver = element->treeScopeOrDocument().scopedStyleResolver())
resolvers.append(scopedResolver);
for (size_t i = 0; i < resolvers.size(); ++i) {

Powered by Google App Engine
This is Rietveld 408576698