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

Unified Diff: Source/core/css/resolver/MatchResult.h

Issue 1155393002: Refactor matched rule ranges. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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/resolver/MatchResult.h
diff --git a/Source/core/css/resolver/MatchResult.h b/Source/core/css/resolver/MatchResult.h
index 612f7aec9f8a76b500f31169f802a918ec5608af..ceb37b386ea7b852ba4ea7bfc195ca360b4b91e8 100644
--- a/Source/core/css/resolver/MatchResult.h
+++ b/Source/core/css/resolver/MatchResult.h
@@ -33,22 +33,6 @@ namespace blink {
class StylePropertySet;
-struct RuleRange {
- RuleRange(int& firstRuleIndex, int& lastRuleIndex): firstRuleIndex(firstRuleIndex), lastRuleIndex(lastRuleIndex) { }
- int& firstRuleIndex;
- int& lastRuleIndex;
-};
-
-struct MatchRanges {
- MatchRanges() : firstUARule(-1), lastUARule(-1), firstAuthorRule(-1), lastAuthorRule(-1) { }
- int firstUARule;
- int lastUARule;
- int firstAuthorRule;
- int lastAuthorRule;
- RuleRange UARuleRange() { return RuleRange(firstUARule, lastUARule); }
- RuleRange authorRuleRange() { return RuleRange(firstAuthorRule, lastAuthorRule); }
-};
-
struct MatchedProperties {
ALLOW_ONLY_INLINE_ALLOCATION();
public:
@@ -78,12 +62,18 @@ namespace blink {
class MatchResult {
STACK_ALLOCATED();
public:
- MatchResult() : isCacheable(true) { }
- WillBeHeapVector<MatchedProperties, 64> matchedProperties;
- MatchRanges ranges;
- bool isCacheable;
-
void addMatchedProperties(const StylePropertySet* properties, unsigned linkMatchType = CSSSelector::MatchAll, PropertyWhitelistType = PropertyWhitelistNone);
+
+ int firstRule() const { return 0; }
+ int lastRule() const { return matchedProperties.size() - 1; }
+ int firstUARule() const { return lastUARuleIndex == -1 ? -1 : 0; }
+ int lastUARule() const { return lastUARuleIndex; }
+ int firstAuthorRule() const { return lastUARuleIndex + 1; }
+ int lastAuthorRule() const { return lastRule(); }
+
+ WillBeHeapVector<MatchedProperties, 64> matchedProperties;
+ int lastUARuleIndex = -1;
+ bool isCacheable = true;
};
inline bool operator==(const MatchedProperties& a, const MatchedProperties& b)

Powered by Google App Engine
This is Rietveld 408576698