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

Side by Side 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, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 case Node::ELEMENT_NODE: 1478 case Node::ELEMENT_NODE:
1479 if (isHTMLBRElement(*node) && convertBRsToNewlines) { 1479 if (isHTMLBRElement(*node) && convertBRsToNewlines) {
1480 isNullString = false; 1480 isNullString = false;
1481 content.append('\n'); 1481 content.append('\n');
1482 break; 1482 break;
1483 } 1483 }
1484 // Fall through. 1484 // Fall through.
1485 case Node::ATTRIBUTE_NODE: 1485 case Node::ATTRIBUTE_NODE:
1486 case Node::DOCUMENT_FRAGMENT_NODE: 1486 case Node::DOCUMENT_FRAGMENT_NODE:
1487 isNullString = false; 1487 isNullString = false;
1488 for (Node* child = node->firstChild(); child; child = child->nextSibling ()) { 1488 for (Node* child = toContainerNode(node)->firstChild(); child; child = c hild->nextSibling()) {
1489 if (child->nodeType() == Node::COMMENT_NODE || child->nodeType() == Node::PROCESSING_INSTRUCTION_NODE) 1489 if (child->nodeType() == Node::COMMENT_NODE || child->nodeType() == Node::PROCESSING_INSTRUCTION_NODE)
1490 continue; 1490 continue;
1491 appendTextContent(child, convertBRsToNewlines, isNullString, content ); 1491 appendTextContent(child, convertBRsToNewlines, isNullString, content );
1492 } 1492 }
1493 break; 1493 break;
1494 1494
1495 case Node::DOCUMENT_NODE: 1495 case Node::DOCUMENT_NODE:
1496 case Node::DOCUMENT_TYPE_NODE: 1496 case Node::DOCUMENT_TYPE_NODE:
1497 break; 1497 break;
1498 } 1498 }
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 node->showTreeForThis(); 2596 node->showTreeForThis();
2597 } 2597 }
2598 2598
2599 void showNodePath(const WebCore::Node* node) 2599 void showNodePath(const WebCore::Node* node)
2600 { 2600 {
2601 if (node) 2601 if (node)
2602 node->showNodePathForThis(); 2602 node->showNodePathForThis();
2603 } 2603 }
2604 2604
2605 #endif 2605 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698