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

Unified 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-03T18:48:37 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/ContainerNode.cpp
diff --git a/third_party/WebKit/Source/core/dom/ContainerNode.cpp b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
index d7f3ac0c07bc72120e077f48712cfacdb70a4443..03c3eb32bb32468a932fc03f670199f86c6765e8 100644
--- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp
+++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
@@ -772,10 +772,18 @@ void ContainerNode::detach(const AttachContext& context)
Node::detach(context);
}
+bool ContainerNode::shouldUpdateRangesAfterChildrenChanged(const ChildrenChange& change)
+{
+ return !change.byParser
+ && change.type != TextChanged
keishi 2016/06/04 07:02:45 nit: would the code be easier to understand if it
yosin_UTC9 2016/06/06 05:21:26 Done.
+ && change.type != ElementInserted
+ && change.type != NonElementInserted;
+}
+
void ContainerNode::childrenChanged(const ChildrenChange& change)
{
document().incDOMTreeVersion();
- if (!change.byParser && change.type != TextChanged)
+ if (shouldUpdateRangesAfterChildrenChanged(change))
document().updateRangesAfterChildrenChanged(this);
invalidateNodeListCachesInAncestors();
if (change.isChildInsertion() && !childNeedsStyleRecalc()) {

Powered by Google App Engine
This is Rietveld 408576698