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

Side by Side Diff: Source/core/dom/ContainerNode.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/ContainerNode.h ('k') | Source/core/dom/ContainerNodeAlgorithms.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 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 // Removing a node from a selection can cause widget updates. 530 // Removing a node from a selection can cause widget updates.
531 document().nodeChildrenWillBeRemoved(this); 531 document().nodeChildrenWillBeRemoved(this);
532 } 532 }
533 533
534 534
535 NodeVector removedChildren; 535 NodeVector removedChildren;
536 { 536 {
537 RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates; 537 RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates;
538 { 538 {
539 NoEventDispatchAssertion assertNoEventDispatch; 539 NoEventDispatchAssertion assertNoEventDispatch;
540 removedChildren.reserveInitialCapacity(childNodeCount()); 540 removedChildren.reserveInitialCapacity(countChildren());
541 while (m_firstChild) { 541 while (m_firstChild) {
542 removedChildren.append(m_firstChild); 542 removedChildren.append(m_firstChild);
543 removeBetween(0, m_firstChild->nextSibling(), *m_firstChild); 543 removeBetween(0, m_firstChild->nextSibling(), *m_firstChild);
544 } 544 }
545 } 545 }
546 546
547 childrenChanged(false, 0, 0, -static_cast<int>(removedChildren.size())); 547 childrenChanged(false, 0, 0, -static_cast<int>(removedChildren.size()));
548 548
549 for (size_t i = 0; i < removedChildren.size(); ++i) 549 for (size_t i = 0; i < removedChildren.size(); ++i)
550 ChildNodeRemovalNotifier(*this).notify(*removedChildren[i]); 550 ChildNodeRemovalNotifier(*this).notify(*removedChildren[i]);
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 873
874 if (renderer()->style()->hasAppearance()) 874 if (renderer()->style()->hasAppearance())
875 RenderTheme::theme().stateChanged(renderer(), HoverState); 875 RenderTheme::theme().stateChanged(renderer(), HoverState);
876 } 876 }
877 877
878 PassRefPtr<HTMLCollection> ContainerNode::children() 878 PassRefPtr<HTMLCollection> ContainerNode::children()
879 { 879 {
880 return ensureRareData().ensureNodeLists().addCache<HTMLCollection>(this, Nod eChildren); 880 return ensureRareData().ensureNodeLists().addCache<HTMLCollection>(this, Nod eChildren);
881 } 881 }
882 882
883 unsigned ContainerNode::childNodeCount() const 883 unsigned ContainerNode::countChildren() const
884 { 884 {
885 unsigned count = 0; 885 unsigned count = 0;
886 Node *n; 886 Node *n;
887 for (n = firstChild(); n; n = n->nextSibling()) 887 for (n = firstChild(); n; n = n->nextSibling())
888 count++; 888 count++;
889 return count; 889 return count;
890 } 890 }
891 891
892 Node *ContainerNode::childNode(unsigned index) const 892 Node* ContainerNode::traverseToChildAt(unsigned index) const
893 { 893 {
894 unsigned i; 894 unsigned i;
895 Node *n = firstChild(); 895 Node *n = firstChild();
896 for (i = 0; n != 0 && i < index; i++) 896 for (i = 0; n != 0 && i < index; i++)
897 n = n->nextSibling(); 897 n = n->nextSibling();
898 return n; 898 return n;
899 } 899 }
900 900
901 PassRefPtr<Element> ContainerNode::querySelector(const AtomicString& selectors, ExceptionState& exceptionState) 901 PassRefPtr<Element> ContainerNode::querySelector(const AtomicString& selectors, ExceptionState& exceptionState)
902 { 902 {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 return true; 1038 return true;
1039 1039
1040 if (node->isElementNode() && toElement(node)->shadow()) 1040 if (node->isElementNode() && toElement(node)->shadow())
1041 return true; 1041 return true;
1042 1042
1043 return false; 1043 return false;
1044 } 1044 }
1045 #endif 1045 #endif
1046 1046
1047 } // namespace WebCore 1047 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/ContainerNode.h ('k') | Source/core/dom/ContainerNodeAlgorithms.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698