Chromium Code Reviews| Index: Source/core/css/RuleFeature.h |
| diff --git a/Source/core/css/RuleFeature.h b/Source/core/css/RuleFeature.h |
| index a609342c466053a52ee7e630a4913309fefb2862..1f5eeebe15a5c648469319f43396ccd59e5fc497 100644 |
| --- a/Source/core/css/RuleFeature.h |
| +++ b/Source/core/css/RuleFeature.h |
| @@ -29,10 +29,13 @@ |
| namespace WebCore { |
| +class Document; |
| +class ShadowRoot; |
| class StyleRule; |
| class CSSSelector; |
| class CSSSelectorList; |
| class RuleData; |
| +class SpaceSplitString; |
| struct RuleFeature { |
| RuleFeature(StyleRule* rule, unsigned selectorIndex, bool hasDocumentSecurityOrigin) |
| @@ -48,7 +51,7 @@ struct RuleFeature { |
| class RuleFeatureSet { |
| public: |
| - RuleFeatureSet() { } |
| + RuleFeatureSet(); |
| void add(const RuleFeatureSet&); |
| void clear(); |
| @@ -79,6 +82,13 @@ public: |
| return m_metadata.idsInRules.contains(idValue); |
| } |
| + // If a class changed on the element, this method should be called in order to schedule style recalc. |
|
ojan
2014/01/30 19:08:39
We generally don't put "what" comments like this.
chrishtr
2014/01/30 19:25:48
Done.
|
| + void scheduleStyleInvalidationForClassChange(const SpaceSplitString& changedClasses, Element*); |
| + void scheduleStyleInvalidationForClassChange(const SpaceSplitString& oldClasses, const SpaceSplitString& newClasses, Element*); |
| + |
| + // Computes which elements in the document need style recalculation. |
|
ojan
2014/01/30 19:08:39
Ditto. This comment doesn't really tell me anythin
chrishtr
2014/01/30 19:25:48
Done.
|
| + void computeStyleInvalidation(Document&); |
| + |
| int hasIdsInSelectors() const |
| { |
| return m_metadata.idsInRules.size() > 0; |
| @@ -93,6 +103,8 @@ public: |
| private: |
| typedef HashMap<AtomicString, RefPtr<DescendantInvalidationSet> > InvalidationSetMap; |
| + typedef Vector<DescendantInvalidationSet*> InvalidationList; |
| + typedef HashMap<Element*, InvalidationList*> PendingInvalidationMap; |
| struct FeatureMetadata { |
| FeatureMetadata() |
| : usesFirstLineRules(false) |
| @@ -110,13 +122,28 @@ private: |
| HashSet<AtomicString> attrsInRules; |
| }; |
| + // These return true if setNeedsStyleRecalc() should be run on the Element, as a fallback. |
| + bool computeInvalidationSetsForClassChange(const SpaceSplitString& changedClasses, Element*); |
| + bool computeInvalidationSetsForClassChange(const SpaceSplitString& oldClasses, const SpaceSplitString& newClasses, Element*); |
| + |
| void collectFeaturesFromSelector(const CSSSelector&, FeatureMetadata&); |
| void collectFeaturesFromSelectorList(const CSSSelectorList*, FeatureMetadata&); |
| + |
| DescendantInvalidationSet& ensureClassInvalidationSet(const AtomicString& className); |
| bool updateClassInvalidationSets(const CSSSelector&); |
| - InvalidationSetMap m_classInvalidationSets; |
| + void addClassToInvalidationSet(const AtomicString& className, Element*); |
| + |
| + bool invalidateStyleForClassChange(Element*, Vector<AtomicString>&, bool foundInvalidationSet); |
| + bool invalidateStyleForClassChangeOnChildren(Element*, Vector<AtomicString>& invalidationClasses, bool foundInvalidationSet); |
| + |
| + InvalidationList& ensurePendingInvalidationList(Element*); |
| + |
| FeatureMetadata m_metadata; |
| + InvalidationSetMap m_classInvalidationSets; |
| + PendingInvalidationMap m_pendingInvalidationMap; |
| + |
| + bool m_targetedStyleRecalcEnabled; |
| }; |
| } // namespace WebCore |