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

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

Issue 192293002: Use new is*Element() helper functions in DOM code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add is*Element(PassRefPtr) helper Created 6 years, 9 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/dom/StyleEngine.cpp
diff --git a/Source/core/dom/StyleEngine.cpp b/Source/core/dom/StyleEngine.cpp
index f59a38e203d880478af6b41ac56e4eeaad749b46..f5612f1b22c5de7aefda138e2b839eaffd8665b9 100644
--- a/Source/core/dom/StyleEngine.cpp
+++ b/Source/core/dom/StyleEngine.cpp
@@ -244,7 +244,8 @@ void StyleEngine::addPendingSheet()
// This method is called whenever a top-level stylesheet has finished loading.
void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode, RemovePendingSheetNotificationType notification)
{
- TreeScope* treeScope = styleSheetCandidateNode->hasTagName(styleTag) ? &styleSheetCandidateNode->treeScope() : &m_document;
+ ASSERT(styleSheetCandidateNode);
+ TreeScope* treeScope = isHTMLStyleElement(*styleSheetCandidateNode) ? &styleSheetCandidateNode->treeScope() : &m_document;
markTreeScopeDirty(*treeScope);
master()->styleEngine()->notifyPendingStyleSheetRemoved(notification);
}
@@ -284,8 +285,8 @@ void StyleEngine::modifiedStyleSheet(StyleSheet* sheet)
if (!node || !node->inDocument())
return;
- TreeScope& treeScope = node->hasTagName(styleTag) ? node->treeScope() : m_document;
- ASSERT(node->hasTagName(styleTag) || treeScope == m_document);
+ TreeScope& treeScope = isHTMLStyleElement(*node) ? node->treeScope() : m_document;
+ ASSERT(isHTMLStyleElement(node) || treeScope == m_document);
markTreeScopeDirty(treeScope);
}
@@ -295,8 +296,8 @@ void StyleEngine::addStyleSheetCandidateNode(Node* node, bool createdByParser)
if (!node->inDocument())
return;
- TreeScope& treeScope = node->hasTagName(styleTag) ? node->treeScope() : m_document;
- ASSERT(node->hasTagName(styleTag) || treeScope == m_document);
+ TreeScope& treeScope = isHTMLStyleElement(*node) ? node->treeScope() : m_document;
+ ASSERT(isHTMLStyleElement(node) || treeScope == m_document);
TreeScopeStyleSheetCollection* collection = ensureStyleSheetCollectionFor(treeScope);
ASSERT(collection);
@@ -310,7 +311,7 @@ void StyleEngine::addStyleSheetCandidateNode(Node* node, bool createdByParser)
void StyleEngine::removeStyleSheetCandidateNode(Node* node, ContainerNode* scopingNode)
{
TreeScope& treeScope = scopingNode ? scopingNode->treeScope() : m_document;
- ASSERT(node->hasTagName(styleTag) || treeScope == m_document);
+ ASSERT(isHTMLStyleElement(node) || treeScope == m_document);
TreeScopeStyleSheetCollection* collection = styleSheetCollectionFor(treeScope);
ASSERT(collection);
@@ -325,8 +326,8 @@ void StyleEngine::modifiedStyleSheetCandidateNode(Node* node)
if (!node->inDocument())
return;
- TreeScope& treeScope = node->hasTagName(styleTag) ? node->treeScope() : m_document;
- ASSERT(node->hasTagName(styleTag) || treeScope == m_document);
+ TreeScope& treeScope = isHTMLStyleElement(*node) ? node->treeScope() : m_document;
+ ASSERT(isHTMLStyleElement(node) || treeScope == m_document);
markTreeScopeDirty(treeScope);
}

Powered by Google App Engine
This is Rietveld 408576698