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

Unified Diff: Source/core/css/ElementRuleCollector.cpp

Issue 581663003: Remove more stuff from applyAuthorStyles. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 | « Source/core/css/ElementRuleCollector.h ('k') | Source/core/css/TreeBoundaryCrossingRules.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/ElementRuleCollector.cpp
diff --git a/Source/core/css/ElementRuleCollector.cpp b/Source/core/css/ElementRuleCollector.cpp
index e421fbb7e5f520afda79d359612f3b52af914737..b835c87aaabecc6bb1d5587b7b55529c71a2a360 100644
--- a/Source/core/css/ElementRuleCollector.cpp
+++ b/Source/core/css/ElementRuleCollector.cpp
@@ -118,16 +118,14 @@ void ElementRuleCollector::addElementStyleProperties(const StylePropertySet* pro
m_result.isCacheable = false;
}
-static bool rulesApplicableInCurrentTreeScope(const Element* element, const ContainerNode* scopingNode, bool elementApplyAuthorStyles)
+static bool rulesApplicableInCurrentTreeScope(const Element* element, const ContainerNode* scopingNode, bool matchingTreeBoundaryRules)
{
- TreeScope& treeScope = element->treeScope();
-
// [skipped, because already checked] a) it's a UA rule
- // b) element is allowed to apply author rules
- if (elementApplyAuthorStyles)
+ // b) We're mathcing tree boundary rules.
+ if (matchingTreeBoundaryRules)
return true;
// c) the rules comes from a scoped style sheet within the same tree scope
- if (!scopingNode || treeScope == scopingNode->treeScope())
+ if (!scopingNode || element->treeScope() == scopingNode->treeScope())
return true;
// d) the rules comes from a scoped style sheet within an active shadow root whose host is the given element
if (SelectorChecker::isHostInItsShadowTree(*element, scopingNode))
@@ -135,7 +133,7 @@ static bool rulesApplicableInCurrentTreeScope(const Element* element, const Cont
return false;
}
-void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest, RuleRange& ruleRange, SelectorChecker::ContextFlags contextFlags, CascadeScope cascadeScope, CascadeOrder cascadeOrder)
+void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest, RuleRange& ruleRange, SelectorChecker::ContextFlags contextFlags, CascadeScope cascadeScope, CascadeOrder cascadeOrder, bool matchingTreeBoundaryRules)
{
ASSERT(matchRequest.ruleSet);
ASSERT(m_context.element());
@@ -151,12 +149,11 @@ void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest
collectMatchingRulesForList(matchRequest.ruleSet->cuePseudoRules(), contextFlags, cascadeScope, cascadeOrder, matchRequest, ruleRange);
// Check whether other types of rules are applicable in the current tree scope. Criteria for this:
// a) it's a UA rule
- // b) the tree scope allows author rules
- // c) the rules comes from a scoped style sheet within the same tree scope
- // d) the rules comes from a scoped style sheet within an active shadow root whose host is the given element
- // e) the rules can cross boundaries
+ // b) the rules comes from a scoped style sheet within the same tree scope
+ // c) the rules comes from a scoped style sheet within an active shadow root whose host is the given element
+ // d) the rules can cross boundaries
// b)-e) is checked in rulesApplicableInCurrentTreeScope.
- if (!m_matchingUARules && !rulesApplicableInCurrentTreeScope(&element, matchRequest.scope, matchRequest.elementApplyAuthorStyles))
+ if (!m_matchingUARules && !rulesApplicableInCurrentTreeScope(&element, matchRequest.scope, matchingTreeBoundaryRules))
return;
// We need to collect the rules for id, class, tag, and everything else into a buffer and
« no previous file with comments | « Source/core/css/ElementRuleCollector.h ('k') | Source/core/css/TreeBoundaryCrossingRules.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698