Index: Source/core/css/RuleFeature.h |
diff --git a/Source/core/css/RuleFeature.h b/Source/core/css/RuleFeature.h |
index e90bab40ff1ed459d444d0a65beff1ddd7b934c5..bbee7200c21f3bb9bd36433422acaea613821c4a 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) |
@@ -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. |
+ void scheduleStyleInvalidationForClassChange(const SpaceSplitString& changedClasses, Element*); |
+ void scheduleStyleInvalidationForClassChange(const SpaceSplitString& oldClasses, const SpaceSplitString& newClasses, Element*); |
+ |
+ // Computes which elements in the document need style recalculation. |
+ 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 scheduleStyleInvalidationForClassChangeInternal(const SpaceSplitString& changedClasses, Element*); |
+ bool scheduleStyleInvalidationForClassChangeInternal(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 computeStyleInvalidationInternal(Element*, Vector<AtomicString>&, bool foundInvalidationSet); |
+ bool computeStyleInvalidationForChildren(Element*, Vector<AtomicString>& invalidationClasses, bool foundInvalidationSet); |
+ |
+ InvalidationList& ensurePendingInvalidationList(Element*); |
+ |
FeatureMetadata m_metadata; |
+ |
+ InvalidationSetMap m_classInvalidationSets; |
+ |
+ PendingInvalidationMap m_pendingInvalidationMap; |
}; |
} // namespace WebCore |