Commit 82f64862 authored by rune@opera.com's avatar rune@opera.com

Removed unused CascadeOrder.

CascadeOrder is always ignoreCascadeOrder after [1] and can be removed.

[1] https://codereview.chromium.org/1298173004

BUG=487125

Review URL: https://codereview.chromium.org/1291873005

git-svn-id: svn://svn.chromium.org/blink/trunk@201019 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e93d8c95
...@@ -129,7 +129,7 @@ static bool rulesApplicableInCurrentTreeScope(const Element* element, const Cont ...@@ -129,7 +129,7 @@ static bool rulesApplicableInCurrentTreeScope(const Element* element, const Cont
} }
template<typename RuleDataListType> 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) if (!rules)
return; return;
...@@ -177,7 +177,7 @@ void ElementRuleCollector::collectMatchingRulesForList(const RuleDataListType* r ...@@ -177,7 +177,7 @@ void ElementRuleCollector::collectMatchingRulesForList(const RuleDataListType* r
} }
matched++; matched++;
didMatchRule(ruleData, result, cascadeOrder, matchRequest); didMatchRule(ruleData, result, matchRequest);
} }
if (StyleResolver* resolver = m_context.element()->document().styleResolver()) { if (StyleResolver* resolver = m_context.element()->document().styleResolver()) {
...@@ -187,7 +187,7 @@ void ElementRuleCollector::collectMatchingRulesForList(const RuleDataListType* r ...@@ -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(matchRequest.ruleSet);
ASSERT(m_context.element()); ASSERT(m_context.element());
...@@ -196,11 +196,11 @@ void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest ...@@ -196,11 +196,11 @@ void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest
const AtomicString& pseudoId = element.shadowPseudoId(); const AtomicString& pseudoId = element.shadowPseudoId();
if (!pseudoId.isEmpty()) { if (!pseudoId.isEmpty()) {
ASSERT(element.isStyledElement()); ASSERT(element.isStyledElement());
collectMatchingRulesForList(matchRequest.ruleSet->shadowPseudoElementRules(pseudoId), cascadeOrder, matchRequest); collectMatchingRulesForList(matchRequest.ruleSet->shadowPseudoElementRules(pseudoId), matchRequest);
} }
if (element.isVTTElement()) 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: // Check whether other types of rules are applicable in the current tree scope. Criteria for this:
// a) it's a UA rule // a) it's a UA rule
// b) the rules comes from a scoped style sheet within the same tree scope // b) the rules comes from a scoped style sheet within the same tree scope
...@@ -213,23 +213,23 @@ void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest ...@@ -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 // We need to collect the rules for id, class, tag, and everything else into a buffer and
// then sort the buffer. // then sort the buffer.
if (element.hasID()) if (element.hasID())
collectMatchingRulesForList(matchRequest.ruleSet->idRules(element.idForStyleResolution()), cascadeOrder, matchRequest); collectMatchingRulesForList(matchRequest.ruleSet->idRules(element.idForStyleResolution()), matchRequest);
if (element.isStyledElement() && element.hasClass()) { if (element.isStyledElement() && element.hasClass()) {
for (size_t i = 0; i < element.classNames().size(); ++i) 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()) if (element.isLink())
collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules(), cascadeOrder, matchRequest); collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules(), matchRequest);
if (SelectorChecker::matchesFocusPseudoClass(element)) if (SelectorChecker::matchesFocusPseudoClass(element))
collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules(), cascadeOrder, matchRequest); collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules(), matchRequest);
collectMatchingRulesForList(matchRequest.ruleSet->tagRules(element.localNameForSelectorMatching()), cascadeOrder, matchRequest); collectMatchingRulesForList(matchRequest.ruleSet->tagRules(element.localNameForSelectorMatching()), matchRequest);
collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), cascadeOrder, 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> template<class CSSRuleCollection>
...@@ -295,7 +295,7 @@ void ElementRuleCollector::sortAndTransferMatchedRules() ...@@ -295,7 +295,7 @@ void ElementRuleCollector::sortAndTransferMatchedRules()
} }
} }
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; PseudoId dynamicPseudo = result.dynamicPseudo;
// If we're matching normal rules, set a pseudo bit if // If we're matching normal rules, set a pseudo bit if
...@@ -313,7 +313,7 @@ void ElementRuleCollector::didMatchRule(const RuleData& ruleData, const Selector ...@@ -313,7 +313,7 @@ void ElementRuleCollector::didMatchRule(const RuleData& ruleData, const Selector
if (m_style && ruleData.containsUncommonAttributeSelector()) if (m_style && ruleData.containsUncommonAttributeSelector())
m_style->setUnique(); 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));
} }
} }
......
...@@ -39,22 +39,17 @@ class RuleSet; ...@@ -39,22 +39,17 @@ class RuleSet;
class SelectorFilter; class SelectorFilter;
class StaticCSSRuleList; class StaticCSSRuleList;
typedef unsigned CascadeOrder;
const CascadeOrder ignoreCascadeOrder = 0;
class MatchedRule { class MatchedRule {
ALLOW_ONLY_INLINE_ALLOCATION(); ALLOW_ONLY_INLINE_ALLOCATION();
public: public:
MatchedRule(const RuleData* ruleData, unsigned specificity, CascadeOrder cascadeOrder, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet) MatchedRule(const RuleData* ruleData, unsigned specificity, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet)
: m_ruleData(ruleData) : m_ruleData(ruleData)
, m_specificity(specificity) , m_specificity(specificity)
, m_parentStyleSheet(parentStyleSheet) , m_parentStyleSheet(parentStyleSheet)
{ {
ASSERT(m_ruleData); ASSERT(m_ruleData);
static const unsigned BitsForPositionInRuleData = 18; static const unsigned BitsForPositionInRuleData = 18;
static const unsigned BitsForStyleSheetIndex = 32; m_position = ((uint64_t)styleSheetIndex << BitsForPositionInRuleData) + m_ruleData->position();
m_position = ((uint64_t)cascadeOrder << (BitsForStyleSheetIndex + BitsForPositionInRuleData)) + ((uint64_t)styleSheetIndex << BitsForPositionInRuleData)+ m_ruleData->position();
} }
const RuleData* ruleData() const { return m_ruleData; } const RuleData* ruleData() const { return m_ruleData; }
...@@ -122,8 +117,8 @@ public: ...@@ -122,8 +117,8 @@ public:
PassRefPtrWillBeRawPtr<StyleRuleList> matchedStyleRuleList(); PassRefPtrWillBeRawPtr<StyleRuleList> matchedStyleRuleList();
PassRefPtrWillBeRawPtr<CSSRuleList> matchedCSSRuleList(); PassRefPtrWillBeRawPtr<CSSRuleList> matchedCSSRuleList();
void collectMatchingRules(const MatchRequest&, CascadeOrder = ignoreCascadeOrder, bool matchingTreeBoundaryRules = false); void collectMatchingRules(const MatchRequest&, bool matchingTreeBoundaryRules = false);
void collectMatchingShadowHostRules(const MatchRequest&, CascadeOrder = ignoreCascadeOrder, bool matchingTreeBoundaryRules = false); void collectMatchingShadowHostRules(const MatchRequest&, bool matchingTreeBoundaryRules = false);
void sortAndTransferMatchedRules(); void sortAndTransferMatchedRules();
void clearMatchedRules(); void clearMatchedRules();
void addElementStyleProperties(const StylePropertySet*, bool isCacheable = true); void addElementStyleProperties(const StylePropertySet*, bool isCacheable = true);
...@@ -132,9 +127,9 @@ public: ...@@ -132,9 +127,9 @@ public:
private: private:
template<typename RuleDataListType> template<typename RuleDataListType>
void collectMatchingRulesForList(const RuleDataListType*, CascadeOrder, const MatchRequest&); void collectMatchingRulesForList(const RuleDataListType*, const MatchRequest&);
void didMatchRule(const RuleData&, const SelectorChecker::MatchResult&, CascadeOrder, const MatchRequest&); void didMatchRule(const RuleData&, const SelectorChecker::MatchResult&, const MatchRequest&);
template<class CSSRuleCollection> template<class CSSRuleCollection>
CSSRule* findStyleRule(CSSRuleCollection*, StyleRule*); CSSRule* findStyleRule(CSSRuleCollection*, StyleRule*);
......
...@@ -143,31 +143,31 @@ void ScopedStyleResolver::addKeyframeStyle(PassRefPtrWillBeRawPtr<StyleRuleKeyfr ...@@ -143,31 +143,31 @@ void ScopedStyleResolver::addKeyframeStyle(PassRefPtrWillBeRawPtr<StyleRuleKeyfr
} }
} }
void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& collector, bool includeEmptyRules, CascadeOrder cascadeOrder) void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& collector, bool includeEmptyRules)
{ {
ASSERT(!collector.scopeContainsLastMatchedElement()); ASSERT(!collector.scopeContainsLastMatchedElement());
collector.setScopeContainsLastMatchedElement(true); collector.setScopeContainsLastMatchedElement(true);
for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) {
ASSERT(m_authorStyleSheets[i]->ownerNode()); ASSERT(m_authorStyleSheets[i]->ownerNode());
MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet(), includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i); MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet(), includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i);
collector.collectMatchingRules(matchRequest, cascadeOrder); collector.collectMatchingRules(matchRequest);
} }
collector.setScopeContainsLastMatchedElement(false); collector.setScopeContainsLastMatchedElement(false);
} }
void ScopedStyleResolver::collectMatchingShadowHostRules(ElementRuleCollector& collector, bool includeEmptyRules, CascadeOrder cascadeOrder) void ScopedStyleResolver::collectMatchingShadowHostRules(ElementRuleCollector& collector, bool includeEmptyRules)
{ {
ASSERT(!collector.scopeContainsLastMatchedElement()); ASSERT(!collector.scopeContainsLastMatchedElement());
collector.setScopeContainsLastMatchedElement(true); collector.setScopeContainsLastMatchedElement(true);
for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) {
ASSERT(m_authorStyleSheets[i]->ownerNode()); ASSERT(m_authorStyleSheets[i]->ownerNode());
MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet(), includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i); MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet(), includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i);
collector.collectMatchingShadowHostRules(matchRequest, cascadeOrder); collector.collectMatchingShadowHostRules(matchRequest);
} }
collector.setScopeContainsLastMatchedElement(false); collector.setScopeContainsLastMatchedElement(false);
} }
void ScopedStyleResolver::collectMatchingTreeBoundaryCrossingRules(ElementRuleCollector& collector, bool includeEmptyRules, CascadeOrder cascadeOrder) void ScopedStyleResolver::collectMatchingTreeBoundaryCrossingRules(ElementRuleCollector& collector, bool includeEmptyRules)
{ {
if (!m_treeBoundaryCrossingRuleSet) if (!m_treeBoundaryCrossingRuleSet)
return; return;
...@@ -177,7 +177,7 @@ void ScopedStyleResolver::collectMatchingTreeBoundaryCrossingRules(ElementRuleCo ...@@ -177,7 +177,7 @@ void ScopedStyleResolver::collectMatchingTreeBoundaryCrossingRules(ElementRuleCo
for (const auto& rules : *m_treeBoundaryCrossingRuleSet) { for (const auto& rules : *m_treeBoundaryCrossingRuleSet) {
MatchRequest request(rules->m_ruleSet.get(), includeEmptyRules, &treeScope().rootNode(), rules->m_parentStyleSheet, rules->m_parentIndex); MatchRequest request(rules->m_ruleSet.get(), includeEmptyRules, &treeScope().rootNode(), rules->m_parentStyleSheet, rules->m_parentIndex);
collector.collectMatchingRules(request, cascadeOrder, true); collector.collectMatchingRules(request, true);
} }
collector.setScopeContainsLastMatchedElement(false); collector.setScopeContainsLastMatchedElement(false);
......
...@@ -57,9 +57,9 @@ public: ...@@ -57,9 +57,9 @@ public:
StyleRuleKeyframes* keyframeStylesForAnimation(const StringImpl* animationName); StyleRuleKeyframes* keyframeStylesForAnimation(const StringImpl* animationName);
void appendCSSStyleSheet(CSSStyleSheet&, const MediaQueryEvaluator&); void appendCSSStyleSheet(CSSStyleSheet&, const MediaQueryEvaluator&);
void collectMatchingAuthorRules(ElementRuleCollector&, bool includeEmptyRules, CascadeOrder = ignoreCascadeOrder); void collectMatchingAuthorRules(ElementRuleCollector&, bool includeEmptyRules);
void collectMatchingShadowHostRules(ElementRuleCollector&, bool includeEmptyRules, CascadeOrder = ignoreCascadeOrder); void collectMatchingShadowHostRules(ElementRuleCollector&, bool includeEmptyRules);
void collectMatchingTreeBoundaryCrossingRules(ElementRuleCollector&, bool includeEmptyRules, CascadeOrder = ignoreCascadeOrder); void collectMatchingTreeBoundaryCrossingRules(ElementRuleCollector&, bool includeEmptyRules);
void matchPageRules(PageRuleCollector&); void matchPageRules(PageRuleCollector&);
void collectFeaturesTo(RuleFeatureSet&, HashSet<const StyleSheetContents*>& visitedSharedStyleSheetContents) const; void collectFeaturesTo(RuleFeatureSet&, HashSet<const StyleSheetContents*>& visitedSharedStyleSheetContents) const;
void resetAuthorStyle(); void resetAuthorStyle();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment