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

Unified Diff: sky/engine/core/css/resolver/StyleResolver.cpp

Issue 767273003: Remove parent() concept from ScopedStyleResolver. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « sky/engine/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/css/resolver/StyleResolver.cpp
diff --git a/sky/engine/core/css/resolver/StyleResolver.cpp b/sky/engine/core/css/resolver/StyleResolver.cpp
index 5aa48a10214be96b9356c05d66a8706672faeae8..cb9f08acb3248d54340a0bc2a11d50a4c61b2aef 100644
--- a/sky/engine/core/css/resolver/StyleResolver.cpp
+++ b/sky/engine/core/css/resolver/StyleResolver.cpp
@@ -344,7 +344,8 @@ void StyleResolver::matchAuthorRules(Element* element, ElementRuleCollector& col
}
Vector<RawPtr<ScopedStyleResolver>, 8> resolvers;
- resolveScopedStyles(element, resolvers);
+ if (ScopedStyleResolver* resolver = element->treeScope().scopedStyleResolver())
+ resolvers.append(resolver);
Vector<RawPtr<ScopedStyleResolver>, 8> resolversInShadowTree;
collectScopedResolversForHostedShadowTrees(element, resolversInShadowTree);
@@ -660,21 +661,6 @@ bool StyleResolver::applyAnimatedProperties(StyleResolverState& state, Element*
return true;
}
-static inline ScopedStyleResolver* scopedResolverFor(const Element* element)
-{
- for (TreeScope* treeScope = &element->treeScope(); treeScope; treeScope = treeScope->parentTreeScope()) {
- if (ScopedStyleResolver* scopedStyleResolver = treeScope->scopedStyleResolver())
- return scopedStyleResolver;
- }
- return 0;
-}
-
-void StyleResolver::resolveScopedStyles(const Element* element, Vector<RawPtr<ScopedStyleResolver>, 8>& resolvers)
-{
- for (ScopedStyleResolver* scopedResolver = scopedResolverFor(element); scopedResolver; scopedResolver = scopedResolver->parent())
- resolvers.append(scopedResolver);
-}
-
void StyleResolver::collectScopedResolversForHostedShadowTrees(const Element* element, Vector<RawPtr<ScopedStyleResolver>, 8>& resolvers)
{
ElementShadow* shadow = element->shadow();
@@ -692,18 +678,12 @@ void StyleResolver::collectScopedResolversForHostedShadowTrees(const Element* el
void StyleResolver::styleTreeResolveScopedKeyframesRules(const Element* element, Vector<RawPtr<ScopedStyleResolver>, 8>& resolvers)
{
- Document& document = element->document();
- TreeScope& treeScope = element->treeScope();
- bool applyAuthorStyles = treeScope.applyAuthorStyles();
-
// Add resolvers for shadow roots hosted by the given element.
collectScopedResolversForHostedShadowTrees(element, resolvers);
// Add resolvers while walking up DOM tree from the given element.
- for (ScopedStyleResolver* scopedResolver = scopedResolverFor(element); scopedResolver; scopedResolver = scopedResolver->parent()) {
- if (scopedResolver->treeScope() == treeScope || (applyAuthorStyles && scopedResolver->treeScope() == document))
- resolvers.append(scopedResolver);
- }
+ if (ScopedStyleResolver* resolver = element->treeScope().scopedStyleResolver())
+ resolvers.append(resolver);
}
template <StyleResolver::StyleApplicationPass pass>
« no previous file with comments | « sky/engine/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698