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

Unified Diff: third_party/WebKit/Source/core/dom/ContainerNode.cpp

Issue 2774753003: Merge "CSS Selector: Fix a regression of :first-child and :last-child invalidation" to M58. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContainerNode.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cfe0428c4d1150b125568ba6936061c3c3ebea3b..00422e14e2eb82e111f910c46119c1aebca2570a 100644
--- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp
+++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
@@ -229,9 +229,12 @@ void ContainerNode::insertNodeVector(const NodeVector& targets,
notifyNodeInsertedInternal(child, postInsertionNotificationTargets);
}
}
- for (const auto& targetNode : targets)
- childrenChanged(
- ChildrenChange::forInsertion(*targetNode, ChildrenChangeSourceAPI));
+ Node* unchangedPrevious =
+ targets.size() > 0 ? targets[0]->previousSibling() : nullptr;
+ for (const auto& targetNode : targets) {
+ childrenChanged(ChildrenChange::forInsertion(
+ *targetNode, unchangedPrevious, next, ChildrenChangeSourceAPI));
+ }
for (const auto& descendant : postInsertionNotificationTargets) {
if (descendant->isConnected())
descendant->didNotifySubtreeInsertionsToDocument();
@@ -714,7 +717,8 @@ void ContainerNode::notifyNodeInserted(Node& root,
NodeVector postInsertionNotificationTargets;
notifyNodeInsertedInternal(root, postInsertionNotificationTargets);
- childrenChanged(ChildrenChange::forInsertion(root, source));
+ childrenChanged(ChildrenChange::forInsertion(root, root.previousSibling(),
+ root.nextSibling(), source));
for (const auto& targetNode : postInsertionNotificationTargets) {
if (targetNode->isConnected())
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContainerNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698