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

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

Issue 2034023003: Make appendChild/insertBefore faster with active ranges (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-06-06T14:17:03 Adopt for review comments 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
775 void ContainerNode::childrenChanged(const ChildrenChange& change) 783 void ContainerNode::childrenChanged(const ChildrenChange& change)
776 { 784 {
777 document().incDOMTreeVersion(); 785 document().incDOMTreeVersion();
778 if (!change.byParser && change.type != TextChanged) 786 if (!shouldNotUpdateRangesAfterChildrenChanged(change))
779 document().updateRangesAfterChildrenChanged(this); 787 document().updateRangesAfterChildrenChanged(this);
780 invalidateNodeListCachesInAncestors(); 788 invalidateNodeListCachesInAncestors();
781 if (change.isChildInsertion() && !childNeedsStyleRecalc()) { 789 if (change.isChildInsertion() && !childNeedsStyleRecalc()) {
782 setChildNeedsStyleRecalc(); 790 setChildNeedsStyleRecalc();
783 markAncestorsWithChildNeedsStyleRecalc(); 791 markAncestorsWithChildNeedsStyleRecalc();
784 } 792 }
785 } 793 }
786 794
787 void ContainerNode::cloneChildNodes(ContainerNode *clone) 795 void ContainerNode::cloneChildNodes(ContainerNode *clone)
788 { 796 {
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 return true; 1395 return true;
1388 1396
1389 if (node->isElementNode() && toElement(node)->shadow()) 1397 if (node->isElementNode() && toElement(node)->shadow())
1390 return true; 1398 return true;
1391 1399
1392 return false; 1400 return false;
1393 } 1401 }
1394 #endif 1402 #endif
1395 1403
1396 } // namespace blink 1404 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContainerNode.h ('k') | third_party/WebKit/Source/core/dom/Range.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698