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

Side by Side Diff: Source/core/dom/Node.cpp

Issue 428533006: Use ContainerNode::hasChildren() instead of firstChild() in conditionals (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: build fix Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/accessibility/AXRenderObject.cpp ('k') | Source/core/dom/NodeTraversal.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 if (!isBeforePseudoElement()) 425 if (!isBeforePseudoElement())
426 return parent->pseudoElement(BEFORE); 426 return parent->pseudoElement(BEFORE);
427 } 427 }
428 return previousSibling(); 428 return previousSibling();
429 } 429 }
430 430
431 Node* Node::pseudoAwareNextSibling() const 431 Node* Node::pseudoAwareNextSibling() const
432 { 432 {
433 if (parentElement() && !nextSibling()) { 433 if (parentElement() && !nextSibling()) {
434 Element* parent = parentElement(); 434 Element* parent = parentElement();
435 if (isBeforePseudoElement() && parent->firstChild()) 435 if (isBeforePseudoElement() && parent->hasChildren())
436 return parent->firstChild(); 436 return parent->firstChild();
437 if (!isAfterPseudoElement()) 437 if (!isAfterPseudoElement())
438 return parent->pseudoElement(AFTER); 438 return parent->pseudoElement(AFTER);
439 } 439 }
440 return nextSibling(); 440 return nextSibling();
441 } 441 }
442 442
443 Node* Node::pseudoAwareFirstChild() const 443 Node* Node::pseudoAwareFirstChild() const
444 { 444 {
445 if (isElementNode()) { 445 if (isElementNode()) {
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 else if (parentNode()) { 1050 else if (parentNode()) {
1051 return parentNode(); 1051 return parentNode();
1052 } 1052 }
1053 else { 1053 else {
1054 return 0; 1054 return 0;
1055 } 1055 }
1056 } 1056 }
1057 1057
1058 Node *Node::nextNodeConsideringAtomicNodes() const 1058 Node *Node::nextNodeConsideringAtomicNodes() const
1059 { 1059 {
1060 if (!isAtomicNode(this) && firstChild()) 1060 if (!isAtomicNode(this) && hasChildren())
1061 return firstChild(); 1061 return firstChild();
1062 if (nextSibling()) 1062 if (nextSibling())
1063 return nextSibling(); 1063 return nextSibling();
1064 const Node *n = this; 1064 const Node *n = this;
1065 while (n && !n->nextSibling()) 1065 while (n && !n->nextSibling())
1066 n = n->parentNode(); 1066 n = n->parentNode();
1067 if (n) 1067 if (n)
1068 return n->nextSibling(); 1068 return n->nextSibling();
1069 return 0; 1069 return 0;
1070 } 1070 }
(...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after
2550 node->showTreeForThis(); 2550 node->showTreeForThis();
2551 } 2551 }
2552 2552
2553 void showNodePath(const blink::Node* node) 2553 void showNodePath(const blink::Node* node)
2554 { 2554 {
2555 if (node) 2555 if (node)
2556 node->showNodePathForThis(); 2556 node->showNodePathForThis();
2557 } 2557 }
2558 2558
2559 #endif 2559 #endif
OLDNEW
« no previous file with comments | « Source/core/accessibility/AXRenderObject.cpp ('k') | Source/core/dom/NodeTraversal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698