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

Unified Diff: Source/core/css/invalidation/InvalidationSet.h

Issue 1317533002: Sibling invalidation sets (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 3 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/invalidation/InvalidationSet.h
diff --git a/Source/core/css/invalidation/InvalidationSet.h b/Source/core/css/invalidation/InvalidationSet.h
index 28bc2ce50ffeb8fcf0eab90ed253b34854c900d3..d518e7982936bed74435576384a083c7683609a3 100644
--- a/Source/core/css/invalidation/InvalidationSet.h
+++ b/Source/core/css/invalidation/InvalidationSet.h
@@ -45,8 +45,8 @@ namespace blink {
class Element;
class TracedValue;
-// Tracks data to determine which elements of a DOM subtree need to have style
-// recalculated.
+// Tracks data to determine which descendants in a DOM subtree, or
+// siblings and their descendants, need to have style recalculated.
class CORE_EXPORT InvalidationSet final : public RefCountedWillBeGarbageCollected<InvalidationSet> {
WTF_MAKE_NONCOPYABLE(InvalidationSet);
public:
@@ -66,6 +66,10 @@ public:
void addTagName(const AtomicString& tagName);
void addAttribute(const AtomicString& attributeLocalName);
+ const InvalidationSet* descendants() const { return m_descendantInvalidationSet.get(); }
+
+ InvalidationSet& ensureDescendantInvalidationSet();
+
void setWholeSubtreeInvalid();
bool wholeSubtreeInvalid() const { return m_allDescendantsMightBeInvalid; }
@@ -81,6 +85,9 @@ public:
void setCustomPseudoInvalid() { m_customPseudoInvalid = true; }
bool customPseudoInvalid() const { return m_customPseudoInvalid; }
+ unsigned maxDirectAdjacentSelectors() const { return m_maxDirectAdjacentSelectors; }
+ void updateMaxDirectAdjacentSelectors(unsigned value) { m_maxDirectAdjacentSelectors = std::max(value, m_maxDirectAdjacentSelectors); }
+
bool isEmpty() const { return !m_classes && !m_ids && !m_tagNames && !m_attributes && !m_customPseudoInvalid; }
DECLARE_TRACE();
@@ -119,6 +126,23 @@ private:
// If true, insertion point descendants must be invalidated.
unsigned m_insertionPointCrossing : 1;
+
+ // Only for sibling invalidation sets, indicates the maximum possible number of siblings affected.
+ unsigned m_maxDirectAdjacentSelectors;
rune 2015/10/02 13:17:59 Can we use sub-classing instead? SiblingInvalidat
Eric Willigers 2015/10/14 00:25:40 Done.
+
+ // Only for sibling invalidation sets, indicates the descendants of siblings.
+ RefPtrWillBeMember<InvalidationSet> m_descendantInvalidationSet;
+
+ friend class RuleFeatureSetTest;
+};
+
+using InvalidationSetVector = WillBeHeapVector<RefPtrWillBeMember<InvalidationSet>>;
+
+struct InvalidationLists {
+ STACK_ALLOCATED();
+
+ InvalidationSetVector descendants;
+ InvalidationSetVector siblings;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698