Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/RuleFeature.h |
| diff --git a/third_party/WebKit/Source/core/css/RuleFeature.h b/third_party/WebKit/Source/core/css/RuleFeature.h |
| index eb4637caf1878c4c32596feaed361e8e828c8262..56bb24bf31a0026a819ee8f6a8589cfa7e825036 100644 |
| --- a/third_party/WebKit/Source/core/css/RuleFeature.h |
| +++ b/third_party/WebKit/Source/core/css/RuleFeature.h |
| @@ -80,13 +80,13 @@ public: |
| bool hasSelectorForAttribute(const AtomicString& attributeName) const |
| { |
| - ASSERT(!attributeName.isEmpty()); |
| + DCHECK(!attributeName.isEmpty()); |
| return m_attributeInvalidationSets.contains(attributeName); |
| } |
| bool hasSelectorForClass(const AtomicString& classValue) const |
| { |
| - ASSERT(!classValue.isEmpty()); |
| + DCHECK(!classValue.isEmpty()); |
| return m_classInvalidationSets.contains(classValue); |
| } |
| @@ -117,7 +117,7 @@ public: |
| bool isAlive() const { return m_isAlive; } |
| protected: |
| - InvalidationSet* invalidationSetForSelector(const CSSSelector&, InvalidationType); |
| + InvalidationSet* invalidationSetForSimpleSelector(const CSSSelector&, InvalidationType); |
| private: |
| // Each map entry is either a DescendantInvalidationSet or SiblingInvalidationSet. |
| @@ -152,15 +152,17 @@ private: |
| struct InvalidationSetFeatures { |
| DISALLOW_NEW(); |
| + void add(const InvalidationSetFeatures& other); |
|
Eric Willigers
2016/09/03 02:57:57
+1
We have discussed in the past reducing the inv
rune
2016/09/05 08:16:20
Yes. I initially wanted to land this optimization,
|
| + bool hasFeatures() const; |
| + |
| Vector<AtomicString> classes; |
| Vector<AtomicString> attributes; |
| Vector<AtomicString> ids; |
| Vector<AtomicString> tagNames; |
| - unsigned maxDirectAdjacentSelectors = UINT_MAX; |
| + unsigned maxDirectAdjacentSelectors = 0; |
| bool customPseudoElement = false; |
| bool hasBeforeOrAfter = false; |
| bool treeBoundaryCrossing = false; |
| - bool adjacent = false; |
| bool insertionPointCrossing = false; |
| bool forceSubtree = false; |
| bool contentPseudoCrossing = false; |
| @@ -168,15 +170,26 @@ private: |
| bool hasNthPseudo = false; |
| }; |
| - static bool extractInvalidationSetFeature(const CSSSelector&, InvalidationSetFeatures&); |
| + static void extractInvalidationSetFeature(const CSSSelector&, InvalidationSetFeatures&); |
| enum UseFeaturesType { UseFeatures, ForceSubtree }; |
| enum PositionType { Subject, Ancestor }; |
| - std::pair<const CSSSelector*, UseFeaturesType> extractInvalidationSetFeatures(const CSSSelector&, InvalidationSetFeatures&, PositionType, CSSSelector::PseudoType = CSSSelector::PseudoUnknown); |
| + |
| + void extractInvalidationSetFeaturesFromSimpleSelector(const CSSSelector&, InvalidationSetFeatures&); |
| + const CSSSelector* extractInvalidationSetFeaturesFromCompound(const CSSSelector&, InvalidationSetFeatures&, PositionType, CSSSelector::PseudoType = CSSSelector::PseudoUnknown); |
| + const CSSSelector* extractInvalidationSetFeaturesFromSelectorList(const CSSSelector&, InvalidationSetFeatures&, PositionType); |
| + void updateFeaturesFromCombinator(const CSSSelector&, |
| + const CSSSelector* lastCompoundSelectorInAdjacentChain, |
| + InvalidationSetFeatures& lastCompoundInAdjacentChainFeatures, |
| + InvalidationSetFeatures*& siblingFeatures, |
| + InvalidationSetFeatures& descendantFeatures); |
| void addFeaturesToInvalidationSet(InvalidationSet&, const InvalidationSetFeatures&); |
| - void addFeaturesToInvalidationSets(const CSSSelector*, InvalidationSetFeatures* siblingFeatures, InvalidationSetFeatures& descendantFeatures); |
| + void addFeaturesToInvalidationSets(const CSSSelector&, InvalidationSetFeatures& descendantFeatures); |
| + const CSSSelector* addFeaturesToInvalidationSetsForCompoundSelector(const CSSSelector&, InvalidationSetFeatures* siblingFeatures, InvalidationSetFeatures& descendantFeatures); |
| + void addFeaturesToInvalidationSetsForSimpleSelector(const CSSSelector&, InvalidationSetFeatures* siblingFeatures, InvalidationSetFeatures& descendantFeatures); |
| + void addFeaturesToInvalidationSetsForSelectorList(const CSSSelector&, InvalidationSetFeatures* siblingFeatures, InvalidationSetFeatures& descendantFeatures); |
| void addFeaturesToUniversalSiblingInvalidationSet(const InvalidationSetFeatures& siblingFeatures, const InvalidationSetFeatures& descendantFeatures); |
| void addClassToInvalidationSet(const AtomicString& className, Element&); |