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

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

Issue 171953002: Get rid of inefficient uses of childNodeCount() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Small clean up Created 6 years, 10 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/Range.cpp
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index 9c9ac3466ca2d477fbb7498f479c7d8c5a8071f1..458e7924d7a51f5e07133c5435916d894e547802 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -657,9 +657,10 @@ static inline unsigned lengthOfContentsInNode(Node* node)
case Node::ELEMENT_NODE:
case Node::ATTRIBUTE_NODE:
case Node::DOCUMENT_NODE:
- case Node::DOCUMENT_TYPE_NODE:
case Node::DOCUMENT_FRAGMENT_NODE:
- return node->childNodeCount();
+ return toContainerNode(node)->childNodeCount();
Inactive 2014/02/19 04:13:33 Those are all ContainerNodes so we can cast and by
+ case Node::DOCUMENT_TYPE_NODE:
Inactive 2014/02/19 04:13:33 DocumentType is not a ContainerNode and thus canno
+ return 0;
}
ASSERT_NOT_REACHED();
return 0;

Powered by Google App Engine
This is Rietveld 408576698