Chromium Code Reviews| Index: Source/core/css/RuleFeature.h |
| diff --git a/Source/core/css/RuleFeature.h b/Source/core/css/RuleFeature.h |
| index 6018c8e5b5dd86d1b68cb959b623045b19041735..061e19963548e418c5c4dc36ff337e812dfc1b2c 100644 |
| --- a/Source/core/css/RuleFeature.h |
| +++ b/Source/core/css/RuleFeature.h |
| @@ -48,10 +48,7 @@ struct RuleFeature { |
| class RuleFeatureSet { |
| public: |
| - RuleFeatureSet() |
| - : m_usesFirstLineRules(false) |
| - , m_maxDirectAdjacentSelectors(0) |
| - { } |
| + RuleFeatureSet() { } |
| void add(const RuleFeatureSet&); |
| void clear(); |
| @@ -60,48 +57,61 @@ public: |
| void collectFeaturesFromRuleData(const RuleData&); |
| bool usesSiblingRules() const { return !siblingRules.isEmpty(); } |
| - bool usesFirstLineRules() const { return m_usesFirstLineRules; } |
| + bool usesFirstLineRules() const { return m_metadata.usesFirstLineRules; } |
| - unsigned maxDirectAdjacentSelectors() const { return m_maxDirectAdjacentSelectors; } |
| - void setMaxDirectAdjacentSelectors(unsigned value) { m_maxDirectAdjacentSelectors = std::max(value, m_maxDirectAdjacentSelectors); } |
| + unsigned maxDirectAdjacentSelectors() const { return m_metadata.maxDirectAdjacentSelectors; } |
| + void setMaxDirectAdjacentSelectors(unsigned value) { m_metadata.maxDirectAdjacentSelectors = std::max(value, m_metadata.maxDirectAdjacentSelectors); } |
| inline bool hasSelectorForAttribute(const AtomicString& attributeName) const |
| { |
| ASSERT(!attributeName.isEmpty()); |
| - return attrsInRules.contains(attributeName); |
| + return m_metadata.attrsInRules.contains(attributeName); |
| } |
| inline bool hasSelectorForClass(const AtomicString& classValue) const |
| { |
| ASSERT(!classValue.isEmpty()); |
| - return classesInRules.contains(classValue); |
| + return m_metadata.classesInRules.contains(classValue); |
| } |
| inline bool hasSelectorForId(const AtomicString& idValue) const |
| { |
| ASSERT(!idValue.isEmpty()); |
| - return idsInRules.contains(idValue); |
| + return m_metadata.idsInRules.contains(idValue); |
| } |
| - HashSet<AtomicString> idsInRules; |
| - HashSet<AtomicString> classesInRules; |
| - HashSet<AtomicString> attrsInRules; |
| + // Marks the given attribute name as "appearing in a selector". Used for select: |
|
esprehn
2014/01/23 01:13:29
select: ? I'm not sure what that is.
chrishtr
2014/01/23 01:20:56
Fixed comment.
|
| + // properties where the value of the property contains attr(...) |
| + void addAttributeInASelector(const AtomicString& attributeName); |
| + |
| Vector<RuleFeature> siblingRules; |
| Vector<RuleFeature> uncommonAttributeRules; |
| private: |
| - void collectFeaturesFromSelectorList(const CSSSelectorList*); |
| - |
| - bool m_usesFirstLineRules; |
| - unsigned m_maxDirectAdjacentSelectors; |
| - |
| typedef HashMap<AtomicString, RefPtr<DescendantInvalidationSet> > InvalidationSetMap; |
| - |
| + struct FeatureMetadata { |
| + FeatureMetadata() |
| + : usesFirstLineRules(false) |
| + , maxDirectAdjacentSelectors(0) |
| + { } |
| + void add(const FeatureMetadata& other); |
| + void clear(); |
| + |
| + bool usesFirstLineRules; |
| + bool foundSiblingSelector; |
| + unsigned maxDirectAdjacentSelectors; |
| + HashSet<AtomicString> idsInRules; |
| + HashSet<AtomicString> classesInRules; |
| + HashSet<AtomicString> attrsInRules; |
| + }; |
| + |
| + void collectFeaturesFromSelector(const CSSSelector*, FeatureMetadata&); |
| + void collectFeaturesFromSelectorList(const CSSSelectorList*, FeatureMetadata&); |
| DescendantInvalidationSet& ensureClassInvalidationSet(const AtomicString& className); |
| - |
| bool updateClassInvalidationSets(const CSSSelector*); |
| InvalidationSetMap m_classInvalidationSets; |
| + FeatureMetadata m_metadata; |
| }; |
| } // namespace WebCore |