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

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

Issue 214333003: Refactoring MatchRanges and RuleRange. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | « no previous file | Source/core/css/resolver/MatchResult.h » ('j') | Source/core/css/resolver/MatchResult.h » ('J')
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 7b1dc574f3a7cc983f1e89a804a2f046acc48d01..2e192a511b8812e5fce16eb54b4a042041b15f05 100644
--- a/Source/core/css/ElementRuleCollector.cpp
+++ b/Source/core/css/ElementRuleCollector.cpp
@@ -109,9 +109,8 @@ void ElementRuleCollector::addElementStyleProperties(const StylePropertySet* pro
{
if (!propertySet)
return;
- m_result.ranges.lastAuthorRule = m_result.matchedProperties.size();
- if (m_result.ranges.firstAuthorRule == -1)
- m_result.ranges.firstAuthorRule = m_result.ranges.lastAuthorRule;
+
+ m_result.ranges.authorRuleRange().shiftLast(m_result.matchedProperties.size());
m_result.addMatchedProperties(propertySet);
if (!isCacheable)
m_result.isCacheable = false;
@@ -301,10 +300,7 @@ void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, Select
m_style->setHasPseudoStyle(dynamicPseudo);
} else {
// Update our first/last rule indices in the matched rules array.
- ++ruleRange.lastRuleIndex;
- if (ruleRange.firstRuleIndex == -1)
- ruleRange.firstRuleIndex = ruleRange.lastRuleIndex;
-
+ ruleRange.shiftLastByOne();
// Add this rule to our list of matched rules.
addMatchedRule(&ruleData, result.specificity, cascadeScope, cascadeOrder, matchRequest.styleSheetIndex, matchRequest.styleSheet);
return;
@@ -339,9 +335,8 @@ bool ElementRuleCollector::hasAnyMatchingRules(RuleSet* ruleSet)
// To check whether a given RuleSet has any rule matching a given element,
// should not see the element's treescope. Because RuleSet has no
// information about "scope".
- int firstRuleIndex = -1, lastRuleIndex = -1;
- RuleRange ruleRange(firstRuleIndex, lastRuleIndex);
// FIXME: Verify whether it's ok to ignore CascadeScope here.
+ RuleRange ruleRange;
collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::StaysWithinTreeScope);
return m_matchedRules && !m_matchedRules->isEmpty();
« no previous file with comments | « no previous file | Source/core/css/resolver/MatchResult.h » ('j') | Source/core/css/resolver/MatchResult.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698