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

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

Issue 171953002: Get rid of inefficient uses of childNodeCount() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Small clean up 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 | « no previous file | Source/core/dom/Range.cpp » ('j') | Source/core/dom/Range.cpp » ('J')
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());
Inactive 2014/02/19 04:13:33 I don't think this one is worth it as we end up tr
eseidel 2014/02/19 05:39:54 I expect walking the child list twice may be cheap
Inactive 2014/02/19 14:28:15 Ok then. I prefer to keep this change out of the C
541 while (m_firstChild) { 540 while (m_firstChild) {
542 removedChildren.append(m_firstChild); 541 removedChildren.append(m_firstChild);
543 removeBetween(0, m_firstChild->nextSibling(), *m_firstChild); 542 removeBetween(0, m_firstChild->nextSibling(), *m_firstChild);
544 } 543 }
545 } 544 }
546 545
547 childrenChanged(false, 0, 0, -static_cast<int>(removedChildren.size())); 546 childrenChanged(false, 0, 0, -static_cast<int>(removedChildren.size()));
548 547
549 for (size_t i = 0; i < removedChildren.size(); ++i) 548 for (size_t i = 0; i < removedChildren.size(); ++i)
550 ChildNodeRemovalNotifier(*this).notify(*removedChildren[i]); 549 ChildNodeRemovalNotifier(*this).notify(*removedChildren[i]);
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 return true; 1037 return true;
1039 1038
1040 if (node->isElementNode() && toElement(node)->shadow()) 1039 if (node->isElementNode() && toElement(node)->shadow())
1041 return true; 1040 return true;
1042 1041
1043 return false; 1042 return false;
1044 } 1043 }
1045 #endif 1044 #endif
1046 1045
1047 } // namespace WebCore 1046 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/Range.cpp » ('j') | Source/core/dom/Range.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698