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

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

Issue 2039113003: Make removeChild faster with active ranges (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-06T16:21:06 Created 4 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
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, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 childrenContext.resolvedStyle = nullptr; 765 childrenContext.resolvedStyle = nullptr;
766 childrenContext.clearInvalidation = true; 766 childrenContext.clearInvalidation = true;
767 767
768 for (Node* child = firstChild(); child; child = child->nextSibling()) 768 for (Node* child = firstChild(); child; child = child->nextSibling())
769 child->detach(childrenContext); 769 child->detach(childrenContext);
770 770
771 setChildNeedsStyleRecalc(); 771 setChildNeedsStyleRecalc();
772 Node::detach(context); 772 Node::detach(context);
773 } 773 }
774 774
775 bool ContainerNode::shouldNotUpdateRangesAfterChildrenChanged(const ChildrenChan ge& change)
776 {
777 return change.byParser
778 || change.type == TextChanged
779 || change.type == ElementInserted
780 || change.type == NonElementInserted;
781 }
782
783 void ContainerNode::childrenChanged(const ChildrenChange& change) 775 void ContainerNode::childrenChanged(const ChildrenChange& change)
784 { 776 {
785 document().incDOMTreeVersion(); 777 document().incDOMTreeVersion();
786 if (!shouldNotUpdateRangesAfterChildrenChanged(change))
787 document().updateRangesAfterChildrenChanged(this);
788 invalidateNodeListCachesInAncestors(); 778 invalidateNodeListCachesInAncestors();
789 if (change.isChildInsertion() && !childNeedsStyleRecalc()) { 779 if (change.isChildInsertion() && !childNeedsStyleRecalc()) {
790 setChildNeedsStyleRecalc(); 780 setChildNeedsStyleRecalc();
791 markAncestorsWithChildNeedsStyleRecalc(); 781 markAncestorsWithChildNeedsStyleRecalc();
792 } 782 }
793 } 783 }
794 784
795 void ContainerNode::cloneChildNodes(ContainerNode *clone) 785 void ContainerNode::cloneChildNodes(ContainerNode *clone)
796 { 786 {
797 TrackExceptionState exceptionState; 787 TrackExceptionState exceptionState;
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 return true; 1385 return true;
1396 1386
1397 if (node->isElementNode() && toElement(node)->shadow()) 1387 if (node->isElementNode() && toElement(node)->shadow())
1398 return true; 1388 return true;
1399 1389
1400 return false; 1390 return false;
1401 } 1391 }
1402 #endif 1392 #endif
1403 1393
1404 } // namespace blink 1394 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContainerNode.h ('k') | third_party/WebKit/Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698