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

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

Issue 307243004: Avoid calling slower Node::firstChild() / Node::lastChild() when possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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/Node.cpp
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index b9980baebe0adb0a7e6d33e94104122ea37304eb..eaf2289d60d8e309e2fdb118bccf2224bfa8a472 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -1485,7 +1485,7 @@ static void appendTextContent(const Node* node, bool convertBRsToNewlines, bool&
case Node::ATTRIBUTE_NODE:
case Node::DOCUMENT_FRAGMENT_NODE:
isNullString = false;
- for (Node* child = node->firstChild(); child; child = child->nextSibling()) {
+ for (Node* child = toContainerNode(node)->firstChild(); child; child = child->nextSibling()) {
if (child->nodeType() == Node::COMMENT_NODE || child->nodeType() == Node::PROCESSING_INSTRUCTION_NODE)
continue;
appendTextContent(child, convertBRsToNewlines, isNullString, content);

Powered by Google App Engine
This is Rietveld 408576698