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

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

Issue 23717008: Remove useless null checks from Node::document() call sites (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/dom/Position.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/NodeIterator.cpp
diff --git a/Source/core/dom/NodeIterator.cpp b/Source/core/dom/NodeIterator.cpp
index 6bb4d9fee81cac9febe2a508fb57058455e022b4..bcf72ee115b1048f89a7535555620ed15e0fb368 100644
--- a/Source/core/dom/NodeIterator.cpp
+++ b/Source/core/dom/NodeIterator.cpp
@@ -78,17 +78,13 @@ NodeIterator::NodeIterator(PassRefPtr<Node> rootNode, unsigned whatToShow, PassR
, m_referenceNode(root(), true)
, m_detached(false)
{
- // Document type nodes may have a null document. But since they can't have children, there is no need to listen for modifications to these.
- ASSERT(root()->document() || root()->nodeType() == Node::DOCUMENT_TYPE_NODE);
ScriptWrappable::init(this);
- if (Document* ownerDocument = root()->document())
- ownerDocument->attachNodeIterator(this);
+ root()->document()->attachNodeIterator(this);
}
NodeIterator::~NodeIterator()
{
- if (Document* ownerDocument = root()->document())
- ownerDocument->detachNodeIterator(this);
+ root()->document()->detachNodeIterator(this);
}
PassRefPtr<Node> NodeIterator::nextNode(ScriptState* state, ExceptionState& es)
@@ -151,8 +147,7 @@ PassRefPtr<Node> NodeIterator::previousNode(ScriptState* state, ExceptionState&
void NodeIterator::detach()
{
- if (Document* ownerDocument = root()->document())
- ownerDocument->detachNodeIterator(this);
+ root()->document()->detachNodeIterator(this);
m_detached = true;
m_referenceNode.node.clear();
}
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/dom/Position.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698