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

Unified Diff: third_party/WebKit/Source/core/css/RuleFeature.cpp

Issue 2303443003: CSS: Additional asserts for style invalidation (Closed)
Patch Set: Created 4 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: third_party/WebKit/Source/core/css/RuleFeature.cpp
diff --git a/third_party/WebKit/Source/core/css/RuleFeature.cpp b/third_party/WebKit/Source/core/css/RuleFeature.cpp
index 8ba872b147dd812063caee2a940108d165509c56..f9923e022a54fa9d649cb570bc7d10e4ea629750 100644
--- a/third_party/WebKit/Source/core/css/RuleFeature.cpp
+++ b/third_party/WebKit/Source/core/css/RuleFeature.cpp
@@ -223,7 +223,9 @@ InvalidationSet& ensureInvalidationSet(Map& map, const typename Map::KeyType& ke
if (type == InvalidateDescendants)
return toSiblingInvalidationSet(addResult.storedValue->value.get())->ensureDescendants();
- addResult.storedValue->value = SiblingInvalidationSet::create(toDescendantInvalidationSet(addResult.storedValue->value.get()));
+ RefPtr<InvalidationSet> descendants = addResult.storedValue->value;
+ RefPtr<InvalidationSet> siblings = SiblingInvalidationSet::create(toDescendantInvalidationSet(descendants.get()));
+ addResult.storedValue->value = siblings;
return *addResult.storedValue->value;
}
@@ -276,21 +278,25 @@ RuleFeatureSet::~RuleFeatureSet()
ALWAYS_INLINE InvalidationSet& RuleFeatureSet::ensureClassInvalidationSet(const AtomicString& className, InvalidationType type)
{
+ RELEASE_ASSERT(!className.isEmpty());
return ensureInvalidationSet(m_classInvalidationSets, className, type);
}
ALWAYS_INLINE InvalidationSet& RuleFeatureSet::ensureAttributeInvalidationSet(const AtomicString& attributeName, InvalidationType type)
{
+ RELEASE_ASSERT(!attributeName.isEmpty());
return ensureInvalidationSet(m_attributeInvalidationSets, attributeName, type);
}
ALWAYS_INLINE InvalidationSet& RuleFeatureSet::ensureIdInvalidationSet(const AtomicString& id, InvalidationType type)
{
+ RELEASE_ASSERT(!id.isEmpty());
return ensureInvalidationSet(m_idInvalidationSets, id, type);
}
ALWAYS_INLINE InvalidationSet& RuleFeatureSet::ensurePseudoInvalidationSet(CSSSelector::PseudoType pseudoType, InvalidationType type)
{
+ RELEASE_ASSERT(pseudoType != CSSSelector::PseudoUnknown);
return ensureInvalidationSet(m_pseudoInvalidationSets, pseudoType, type);
}
@@ -730,6 +736,7 @@ void RuleFeatureSet::add(const RuleFeatureSet& other)
{
RELEASE_ASSERT(m_isAlive);
RELEASE_ASSERT(other.m_isAlive);
+ RELEASE_ASSERT(&other != this);
for (const auto& entry : other.m_classInvalidationSets)
ensureInvalidationSet(m_classInvalidationSets, entry.key, entry.value->type()).combine(*entry.value);
for (const auto& entry : other.m_attributeInvalidationSets)
@@ -737,7 +744,7 @@ void RuleFeatureSet::add(const RuleFeatureSet& other)
for (const auto& entry : other.m_idInvalidationSets)
ensureInvalidationSet(m_idInvalidationSets, entry.key, entry.value->type()).combine(*entry.value);
for (const auto& entry : other.m_pseudoInvalidationSets)
- ensureInvalidationSet(m_pseudoInvalidationSets, static_cast<CSSSelector::PseudoType>(entry.key), entry.value->type()).combine(*entry.value);
+ ensureInvalidationSet(m_pseudoInvalidationSets, entry.key, entry.value->type()).combine(*entry.value);
if (other.m_universalSiblingInvalidationSet)
ensureUniversalSiblingInvalidationSet().combine(*other.m_universalSiblingInvalidationSet);
if (other.m_nthInvalidationSet)

Powered by Google App Engine
This is Rietveld 408576698