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

Unified Diff: third_party/WebKit/Source/core/dom/StyleEngine.cpp

Issue 1854423002: ASSERT -> {DCHECK|DCHECK_XX}, ENABLE(ASSERT) -> DCHECK_IS_ON() in dom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mark svg/as-image/svg-nested.html crash on win Created 4 years, 8 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/dom/StyleEngine.cpp
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.cpp b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
index 98c81eb566bef1530da6f4848b9fc3a096002ff2..cfe4388ab96377a56ef01895c70a27babf18027d 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -162,13 +162,13 @@ void StyleEngine::addPendingSheet()
// This method is called whenever a top-level stylesheet has finished loading.
void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode)
{
- ASSERT(styleSheetCandidateNode);
+ DCHECK(styleSheetCandidateNode);
TreeScope* treeScope = isStyleElement(*styleSheetCandidateNode) ? &styleSheetCandidateNode->treeScope() : m_document.get();
if (styleSheetCandidateNode->inShadowIncludingDocument())
markTreeScopeDirty(*treeScope);
// Make sure we knew this sheet was pending, and that our count isn't out of sync.
- ASSERT(m_pendingStylesheets > 0);
+ DCHECK_GT(m_pendingStylesheets, 0);
m_pendingStylesheets--;
if (m_pendingStylesheets)
@@ -190,7 +190,7 @@ void StyleEngine::setNeedsActiveStyleUpdate(StyleSheet* sheet, StyleResolverUpda
Node* node = sheet->ownerNode();
if (node && node->inShadowIncludingDocument()) {
TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *m_document;
- ASSERT(isStyleElement(*node) || node->treeScope() == m_document);
+ DCHECK(isStyleElement(*node) || node->treeScope() == m_document);
markTreeScopeDirty(treeScope);
}
}
@@ -204,10 +204,10 @@ void StyleEngine::addStyleSheetCandidateNode(Node* node)
return;
TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *m_document;
- ASSERT(isStyleElement(*node) || treeScope == m_document);
- ASSERT(!isXSLStyleSheet(*node));
+ DCHECK(isStyleElement(*node) || treeScope == m_document);
+ DCHECK(!isXSLStyleSheet(*node));
TreeScopeStyleSheetCollection* collection = ensureStyleSheetCollectionFor(treeScope);
- ASSERT(collection);
+ DCHECK(collection);
collection->addStyleSheetCandidateNode(node);
markTreeScopeDirty(treeScope);
@@ -222,8 +222,8 @@ void StyleEngine::removeStyleSheetCandidateNode(Node* node)
void StyleEngine::removeStyleSheetCandidateNode(Node* node, TreeScope& treeScope)
{
- ASSERT(isStyleElement(*node) || treeScope == m_document);
- ASSERT(!isXSLStyleSheet(*node));
+ DCHECK(isStyleElement(*node) || treeScope == m_document);
+ DCHECK(!isXSLStyleSheet(*node));
TreeScopeStyleSheetCollection* collection = styleSheetCollectionFor(treeScope);
// After detaching document, collection could be null. In the case,
@@ -241,7 +241,7 @@ void StyleEngine::modifiedStyleSheetCandidateNode(Node* node)
return;
TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *m_document;
- ASSERT(isStyleElement(*node) || treeScope == m_document);
+ DCHECK(isStyleElement(*node) || treeScope == m_document);
markTreeScopeDirty(treeScope);
resolverChanged(FullStyleUpdate);
}
@@ -268,9 +268,9 @@ bool StyleEngine::shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdate
void StyleEngine::clearMediaQueryRuleSetOnTreeScopeStyleSheets(UnorderedTreeScopeSet& treeScopes)
{
for (TreeScope* treeScope : treeScopes) {
- ASSERT(treeScope != m_document);
+ DCHECK(treeScope != m_document);
ShadowTreeStyleSheetCollection* collection = static_cast<ShadowTreeStyleSheetCollection*>(styleSheetCollectionFor(*treeScope));
- ASSERT(collection);
+ DCHECK(collection);
collection->clearMediaQueryRuleSetStyleSheets();
}
}
@@ -284,7 +284,7 @@ void StyleEngine::clearMediaQueryRuleSetStyleSheets()
void StyleEngine::updateStyleSheetsInImport(DocumentStyleSheetCollector& parentCollector)
{
- ASSERT(!isMaster());
+ DCHECK(!isMaster());
HeapVector<Member<StyleSheet>> sheetsForList;
ImportedDocumentStyleSheetCollector subcollector(parentCollector, sheetsForList);
documentStyleSheetCollection()->collectStyleSheets(*this, subcollector);
@@ -293,22 +293,22 @@ void StyleEngine::updateStyleSheetsInImport(DocumentStyleSheetCollector& parentC
void StyleEngine::updateActiveStyleSheetsInShadow(StyleResolverUpdateMode updateMode, TreeScope* treeScope, UnorderedTreeScopeSet& treeScopesRemoved)
{
- ASSERT(treeScope != m_document);
+ DCHECK_NE(treeScope, m_document);
ShadowTreeStyleSheetCollection* collection = static_cast<ShadowTreeStyleSheetCollection*>(styleSheetCollectionFor(*treeScope));
- ASSERT(collection);
+ DCHECK(collection);
collection->updateActiveStyleSheets(*this, updateMode);
if (!collection->hasStyleSheetCandidateNodes()) {
treeScopesRemoved.add(treeScope);
// When removing TreeScope from ActiveTreeScopes,
// its resolver should be destroyed by invoking resetAuthorStyle.
- ASSERT(!treeScope->scopedStyleResolver());
+ DCHECK(!treeScope->scopedStyleResolver());
}
}
void StyleEngine::updateActiveStyleSheets(StyleResolverUpdateMode updateMode)
{
- ASSERT(isMaster());
- ASSERT(!document().inStyleRecalc());
+ DCHECK(isMaster());
+ DCHECK(!document().inStyleRecalc());
if (!document().isActive())
return;
@@ -379,7 +379,7 @@ void StyleEngine::shadowRootRemovedFromDocument(ShadowRoot* shadowRoot)
void StyleEngine::appendActiveAuthorStyleSheets()
{
- ASSERT(isMaster());
+ DCHECK(isMaster());
m_resolver->appendAuthorStyleSheets(documentStyleSheetCollection()->activeAuthorStyleSheets());
for (TreeScope* treeScope : m_activeTreeScopes) {
@@ -396,7 +396,7 @@ void StyleEngine::createResolver()
// which is not in a frame. Code which hits this should have checked
// Document::isActive() before calling into code which could get here.
- ASSERT(document().frame());
+ DCHECK(document().frame());
m_resolver = StyleResolver::create(*m_document);
@@ -407,8 +407,8 @@ void StyleEngine::createResolver()
void StyleEngine::clearResolver()
{
- ASSERT(!document().inStyleRecalc());
- ASSERT(isMaster() || !m_resolver);
+ DCHECK(!document().inStyleRecalc());
+ DCHECK(isMaster() || !m_resolver);
document().clearScopedStyleResolver();
// StyleEngine::shadowRootRemovedFromDocument removes not-in-document
@@ -475,7 +475,7 @@ void StyleEngine::updateGenericFontFamilySettings()
{
// FIXME: we should not update generic font family settings when
// document is inactive.
- ASSERT(document().isActive());
+ DCHECK(document().isActive());
if (!m_fontSelector)
return;
@@ -505,7 +505,7 @@ void StyleEngine::markTreeScopeDirty(TreeScope& scope)
return;
}
- ASSERT(m_styleSheetCollectionMap.contains(&scope));
+ DCHECK(m_styleSheetCollectionMap.contains(&scope));
m_dirtyTreeScopes.add(&scope);
}
@@ -522,7 +522,7 @@ static bool isCacheableForStyleElement(const StyleSheetContents& contents)
if (!contents.importRules().isEmpty())
return false;
// Until import rules are supported in cached sheets it's not possible for loading to fail.
- ASSERT(!contents.didLoadErrorOccur());
+ DCHECK(!contents.didLoadErrorOccur());
// It is not the original sheet anymore.
if (contents.isMutable())
return false;
@@ -548,13 +548,13 @@ RawPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const String& text, T
}
} else {
StyleSheetContents* contents = result.storedValue->value;
- ASSERT(contents);
- ASSERT(isCacheableForStyleElement(*contents));
- ASSERT(contents->singleOwnerDocument() == e->document());
+ DCHECK(contents);
+ DCHECK(isCacheableForStyleElement(*contents));
+ DCHECK_EQ(contents->singleOwnerDocument(), e->document());
styleSheet = CSSStyleSheet::createInline(contents, e, startPosition);
}
- ASSERT(styleSheet);
+ DCHECK(styleSheet);
styleSheet->setTitle(e->title());
return styleSheet;
}
@@ -735,7 +735,7 @@ void StyleEngine::setStatsEnabled(bool enabled)
void StyleEngine::setShadowCascadeOrder(ShadowCascadeOrder order)
{
- ASSERT(order != ShadowCascadeOrder::ShadowCascadeNone);
+ DCHECK_NE(order, ShadowCascadeOrder::ShadowCascadeNone);
if (order == m_shadowCascadeOrder)
return;
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleElement.cpp ('k') | third_party/WebKit/Source/core/dom/StyleSheetCandidate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698