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

Unified Diff: Source/core/css/invalidation/DescendantInvalidationSet.cpp

Issue 1317533002: Sibling invalidation sets (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: sibling-inserted Created 5 years, 4 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/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)

Powered by Google App Engine
This is Rietveld 408576698