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

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

Issue 1224673002: Implement proposed shadow tree cascade order. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added documentation Created 5 years, 4 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: Source/core/css/ElementRuleCollector.cpp
diff --git a/Source/core/css/ElementRuleCollector.cpp b/Source/core/css/ElementRuleCollector.cpp
index 1168c87613d667ce06de7e77f90bc0cb1ea33929..69ed650cf4f929ce06e16266efa5c974b081b4f1 100644
--- a/Source/core/css/ElementRuleCollector.cpp
+++ b/Source/core/css/ElementRuleCollector.cpp
@@ -110,7 +110,7 @@ void ElementRuleCollector::addElementStyleProperties(const StylePropertySet* pro
return;
m_result.addMatchedProperties(propertySet);
if (!isCacheable)
- m_result.isCacheable = false;
+ m_result.setIsCacheable(false);
}
static bool rulesApplicableInCurrentTreeScope(const Element* element, const ContainerNode* scopingNode, bool matchingTreeBoundaryRules)
@@ -129,7 +129,7 @@ static bool rulesApplicableInCurrentTreeScope(const Element* element, const Cont
}
template<typename RuleDataListType>
-void ElementRuleCollector::collectMatchingRulesForList(const RuleDataListType* rules, CascadeOrder cascadeOrder, const MatchRequest& matchRequest)
+void ElementRuleCollector::collectMatchingRulesForList(const RuleDataListType* rules, const MatchRequest& matchRequest)
{
if (!rules)
return;
@@ -177,7 +177,7 @@ void ElementRuleCollector::collectMatchingRulesForList(const RuleDataListType* r
}
matched++;
- didMatchRule(ruleData, result, cascadeOrder, matchRequest);
+ didMatchRule(ruleData, result, matchRequest);
}
if (StyleResolver* resolver = m_context.element()->document().styleResolver()) {
@@ -187,7 +187,7 @@ void ElementRuleCollector::collectMatchingRulesForList(const RuleDataListType* r
}
}
-void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest, CascadeOrder cascadeOrder, bool matchingTreeBoundaryRules)
+void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest, bool matchingTreeBoundaryRules)
{
ASSERT(matchRequest.ruleSet);
ASSERT(m_context.element());
@@ -196,11 +196,11 @@ void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest
const AtomicString& pseudoId = element.shadowPseudoId();
if (!pseudoId.isEmpty()) {
ASSERT(element.isStyledElement());
- collectMatchingRulesForList(matchRequest.ruleSet->shadowPseudoElementRules(pseudoId), cascadeOrder, matchRequest);
+ collectMatchingRulesForList(matchRequest.ruleSet->shadowPseudoElementRules(pseudoId), matchRequest);
}
if (element.isVTTElement())
- collectMatchingRulesForList(matchRequest.ruleSet->cuePseudoRules(), cascadeOrder, matchRequest);
+ collectMatchingRulesForList(matchRequest.ruleSet->cuePseudoRules(), matchRequest);
// Check whether other types of rules are applicable in the current tree scope. Criteria for this:
// a) it's a UA rule
// b) the rules comes from a scoped style sheet within the same tree scope
@@ -213,23 +213,23 @@ void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest
// We need to collect the rules for id, class, tag, and everything else into a buffer and
// then sort the buffer.
if (element.hasID())
- collectMatchingRulesForList(matchRequest.ruleSet->idRules(element.idForStyleResolution()), cascadeOrder, matchRequest);
+ collectMatchingRulesForList(matchRequest.ruleSet->idRules(element.idForStyleResolution()), matchRequest);
if (element.isStyledElement() && element.hasClass()) {
for (size_t i = 0; i < element.classNames().size(); ++i)
- collectMatchingRulesForList(matchRequest.ruleSet->classRules(element.classNames()[i]), cascadeOrder, matchRequest);
+ collectMatchingRulesForList(matchRequest.ruleSet->classRules(element.classNames()[i]), matchRequest);
}
if (element.isLink())
- collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules(), cascadeOrder, matchRequest);
+ collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules(), matchRequest);
if (SelectorChecker::matchesFocusPseudoClass(element))
- collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules(), cascadeOrder, matchRequest);
- collectMatchingRulesForList(matchRequest.ruleSet->tagRules(element.localNameForSelectorMatching()), cascadeOrder, matchRequest);
- collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), cascadeOrder, matchRequest);
+ collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules(), matchRequest);
+ collectMatchingRulesForList(matchRequest.ruleSet->tagRules(element.localNameForSelectorMatching()), matchRequest);
+ collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), matchRequest);
}
-void ElementRuleCollector::collectMatchingShadowHostRules(const MatchRequest& matchRequest, CascadeOrder cascadeOrder, bool matchingTreeBoundaryRules)
+void ElementRuleCollector::collectMatchingShadowHostRules(const MatchRequest& matchRequest, bool matchingTreeBoundaryRules)
{
- collectMatchingRulesForList(matchRequest.ruleSet->shadowHostRules(), cascadeOrder, matchRequest);
+ collectMatchingRulesForList(matchRequest.ruleSet->shadowHostRules(), matchRequest);
}
template<class CSSRuleCollection>
@@ -293,12 +293,9 @@ void ElementRuleCollector::sortAndTransferMatchedRules()
const RuleData* ruleData = m_matchedRules[i].ruleData();
m_result.addMatchedProperties(&ruleData->rule()->properties(), ruleData->linkMatchType(), ruleData->propertyWhitelistType(m_matchingUARules));
}
-
- if (m_matchingUARules)
- m_result.uaEnd = m_result.matchedProperties.size();
}
-void ElementRuleCollector::didMatchRule(const RuleData& ruleData, const SelectorChecker::MatchResult& result, CascadeOrder cascadeOrder, const MatchRequest& matchRequest)
+void ElementRuleCollector::didMatchRule(const RuleData& ruleData, const SelectorChecker::MatchResult& result, const MatchRequest& matchRequest)
{
PseudoId dynamicPseudo = result.dynamicPseudo;
// If we're matching normal rules, set a pseudo bit if
@@ -316,7 +313,7 @@ void ElementRuleCollector::didMatchRule(const RuleData& ruleData, const Selector
if (m_style && ruleData.containsUncommonAttributeSelector())
m_style->setUnique();
- m_matchedRules.append(MatchedRule(&ruleData, result.specificity, cascadeOrder, matchRequest.styleSheetIndex, matchRequest.styleSheet));
+ m_matchedRules.append(MatchedRule(&ruleData, result.specificity, matchRequest.styleSheetIndex, matchRequest.styleSheet));
}
}

Powered by Google App Engine
This is Rietveld 408576698