Index: Source/core/css/invalidation/DescendantInvalidationSet.cpp |
diff --git a/Source/core/css/invalidation/DescendantInvalidationSet.cpp b/Source/core/css/invalidation/DescendantInvalidationSet.cpp |
index 6b4a355730a5dd2e354e25ec86e423c602ad7d7d..f48efe020dda9dddf5c50adfec4f769535809cf7 100644 |
--- a/Source/core/css/invalidation/DescendantInvalidationSet.cpp |
+++ b/Source/core/css/invalidation/DescendantInvalidationSet.cpp |
@@ -52,7 +52,9 @@ void DescendantInvalidationSet::cacheTracingFlag() |
} |
DescendantInvalidationSet::DescendantInvalidationSet() |
- : m_allDescendantsMightBeInvalid(false) |
+ : m_maxDirectAdjacentSelectors(1) |
+ , m_siblingInvalid(false) |
+ , m_allDescendantsMightBeInvalid(false) |
, m_customPseudoInvalid(false) |
, m_treeBoundaryCrossing(false) |
, m_insertionPointCrossing(false) |
@@ -98,6 +100,8 @@ bool DescendantInvalidationSet::invalidatesElement(Element& element) const |
void DescendantInvalidationSet::combine(const DescendantInvalidationSet& other) |
{ |
+ m_maxDirectAdjacentSelectors = std::max(m_maxDirectAdjacentSelectors, other.m_maxDirectAdjacentSelectors); |
+ |
// No longer bother combining data structures, since the whole subtree is deemed invalid. |
if (wholeSubtreeInvalid()) |
return; |
@@ -107,6 +111,9 @@ void DescendantInvalidationSet::combine(const DescendantInvalidationSet& other) |
return; |
} |
+ if (other.siblingInvalid()) |
+ setSiblingInvalid(); |
+ |
if (other.customPseudoInvalid()) |
setCustomPseudoInvalid(); |
@@ -135,6 +142,11 @@ void DescendantInvalidationSet::combine(const DescendantInvalidationSet& other) |
for (const auto& attribute : *other.m_attributes) |
addAttribute(attribute); |
} |
+ |
+ if (other.descendants()) |
+ ensureDescendantInvalidationSet().combine(*other.descendants()); |
+ |
+ m_maxDirectAdjacentSelectors = std::max(m_maxDirectAdjacentSelectors, other.maxDirectAdjacentSelectors()); |
} |
WillBeHeapHashSet<AtomicString>& DescendantInvalidationSet::ensureClassSet() |
@@ -165,6 +177,14 @@ WillBeHeapHashSet<AtomicString>& DescendantInvalidationSet::ensureAttributeSet() |
return *m_attributes; |
} |
+DescendantInvalidationSet& DescendantInvalidationSet::ensureDescendantInvalidationSet() |
+{ |
+ if (!m_descendantInvalidationSet) |
+ m_descendantInvalidationSet = DescendantInvalidationSet::create(); |
+ |
+ return *m_descendantInvalidationSet; |
+} |
+ |
void DescendantInvalidationSet::addClass(const AtomicString& className) |
{ |
if (wholeSubtreeInvalid()) |
@@ -199,6 +219,7 @@ void DescendantInvalidationSet::setWholeSubtreeInvalid() |
return; |
m_allDescendantsMightBeInvalid = true; |
+ m_siblingInvalid = false; |
m_customPseudoInvalid = false; |
m_treeBoundaryCrossing = false; |
m_insertionPointCrossing = false; |
@@ -206,6 +227,7 @@ void DescendantInvalidationSet::setWholeSubtreeInvalid() |
m_ids = nullptr; |
m_tagNames = nullptr; |
m_attributes = nullptr; |
+ m_descendantInvalidationSet = nullptr; |
} |
DEFINE_TRACE(DescendantInvalidationSet) |