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

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

Issue 171773008: Rename childNodeCount() / childNode() methods for clarity (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Further renaming for consistency 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/dom/Node.idl » ('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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 } 876 }
877 877
878 void Node::clearNodeLists() 878 void Node::clearNodeLists()
879 { 879 {
880 rareData()->clearNodeLists(); 880 rareData()->clearNodeLists();
881 } 881 }
882 882
883 bool Node::isDescendantOf(const Node *other) const 883 bool Node::isDescendantOf(const Node *other) const
884 { 884 {
885 // Return true if other is an ancestor of this, otherwise false 885 // Return true if other is an ancestor of this, otherwise false
886 if (!other || !other->hasChildNodes() || inDocument() != other->inDocument() ) 886 if (!other || !other->hasChildren() || inDocument() != other->inDocument())
887 return false; 887 return false;
888 if (other->treeScope() != treeScope()) 888 if (other->treeScope() != treeScope())
889 return false; 889 return false;
890 if (other->isTreeScope()) 890 if (other->isTreeScope())
891 return !isTreeScope(); 891 return !isTreeScope();
892 for (const ContainerNode* n = parentNode(); n; n = n->parentNode()) { 892 for (const ContainerNode* n = parentNode(); n; n = n->parentNode()) {
893 if (n == other) 893 if (n == other)
894 return true; 894 return true;
895 } 895 }
896 return false; 896 return false;
(...skipping 13 matching lines...) Expand all
910 910
911 if (this == node) 911 if (this == node)
912 return true; 912 return true;
913 913
914 if (document() != node->document()) 914 if (document() != node->document())
915 return false; 915 return false;
916 916
917 if (inDocument() != node->inDocument()) 917 if (inDocument() != node->inDocument())
918 return false; 918 return false;
919 919
920 bool hasChildren = isContainerNode() && toContainerNode(this)->hasChildNodes (); 920 bool hasChildren = isContainerNode() && toContainerNode(this)->hasChildren() ;
921 bool hasShadow = isElementNode() && toElement(this)->shadow(); 921 bool hasShadow = isElementNode() && toElement(this)->shadow();
922 if (!hasChildren && !hasShadow) 922 if (!hasChildren && !hasShadow)
923 return false; 923 return false;
924 924
925 for (; node; node = node->shadowHost()) { 925 for (; node; node = node->shadowHost()) {
926 if (treeScope() == node->treeScope()) 926 if (treeScope() == node->treeScope())
927 return contains(node); 927 return contains(node);
928 } 928 }
929 929
930 return false; 930 return false;
(...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after
2554 node->showTreeForThis(); 2554 node->showTreeForThis();
2555 } 2555 }
2556 2556
2557 void showNodePath(const WebCore::Node* node) 2557 void showNodePath(const WebCore::Node* node)
2558 { 2558 {
2559 if (node) 2559 if (node)
2560 node->showNodePathForThis(); 2560 node->showNodePathForThis();
2561 } 2561 }
2562 2562
2563 #endif 2563 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/dom/Node.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698