<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[189896] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/189896">189896</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2015-09-16 20:27:11 -0700 (Wed, 16 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Turn ChildNodeInsertion/RemovalNotifier classes into functions
https://bugs.webkit.org/show_bug.cgi?id=149236

Reviewed by Ryosuke Niwa.

Less architecture, more readability.

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::notifyChildInserted):
(WebCore::ContainerNode::notifyChildRemoved):
(WebCore::ContainerNode::removeChildren):
* dom/ContainerNodeAlgorithms.cpp:
(WebCore::notifyDescendantInsertedIntoDocument):
(WebCore::notifyDescendantInsertedIntoTree):
(WebCore::notifyNodeInsertedIntoDocument):
(WebCore::notifyNodeInsertedIntoTree):
(WebCore::notifyChildNodeInserted):
(WebCore::notifyNodeRemovedFromDocument):
(WebCore::notifyNodeRemovedFromTree):
(WebCore::notifyChildNodeRemoved):
(WebCore::ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument): Deleted.
(WebCore::ChildNodeInsertionNotifier::notifyDescendantInsertedIntoTree): Deleted.
(WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument): Deleted.
(WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromTree): Deleted.
* dom/ContainerNodeAlgorithms.h:
(WebCore::ChildNodeInsertionNotifier::ChildNodeInsertionNotifier): Deleted.
(WebCore::ChildNodeRemovalNotifier::ChildNodeRemovalNotifier): Deleted.
(WebCore::ChildNodeInsertionNotifier::notifyNodeInsertedIntoDocument): Deleted.
(WebCore::ChildNodeInsertionNotifier::notifyNodeInsertedIntoTree): Deleted.
(WebCore::ChildNodeInsertionNotifier::notify): Deleted.
(WebCore::ChildNodeRemovalNotifier::notifyNodeRemovedFromDocument): Deleted.
(WebCore::ChildNodeRemovalNotifier::notifyNodeRemovedFromTree): Deleted.
(WebCore::ChildNodeRemovalNotifier::notify): Deleted.
* dom/Element.cpp:
(WebCore::Element::addShadowRoot):
(WebCore::Element::removeShadowRoot):
(WebCore::Element::createShadowRoot):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodecpp">trunk/Source/WebCore/dom/ContainerNode.cpp</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodeAlgorithmscpp">trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodeAlgorithmsh">trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (189895 => 189896)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-09-17 03:00:30 UTC (rev 189895)
+++ trunk/Source/WebCore/ChangeLog        2015-09-17 03:27:11 UTC (rev 189896)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2015-09-16  Antti Koivisto  &lt;antti@apple.com&gt;
+
+        Turn ChildNodeInsertion/RemovalNotifier classes into functions
+        https://bugs.webkit.org/show_bug.cgi?id=149236
+
+        Reviewed by Ryosuke Niwa.
+
+        Less architecture, more readability.
+
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::notifyChildInserted):
+        (WebCore::ContainerNode::notifyChildRemoved):
+        (WebCore::ContainerNode::removeChildren):
+        * dom/ContainerNodeAlgorithms.cpp:
+        (WebCore::notifyDescendantInsertedIntoDocument):
+        (WebCore::notifyDescendantInsertedIntoTree):
+        (WebCore::notifyNodeInsertedIntoDocument):
+        (WebCore::notifyNodeInsertedIntoTree):
+        (WebCore::notifyChildNodeInserted):
+        (WebCore::notifyNodeRemovedFromDocument):
+        (WebCore::notifyNodeRemovedFromTree):
+        (WebCore::notifyChildNodeRemoved):
+        (WebCore::ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument): Deleted.
+        (WebCore::ChildNodeInsertionNotifier::notifyDescendantInsertedIntoTree): Deleted.
+        (WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument): Deleted.
+        (WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromTree): Deleted.
+        * dom/ContainerNodeAlgorithms.h:
+        (WebCore::ChildNodeInsertionNotifier::ChildNodeInsertionNotifier): Deleted.
+        (WebCore::ChildNodeRemovalNotifier::ChildNodeRemovalNotifier): Deleted.
+        (WebCore::ChildNodeInsertionNotifier::notifyNodeInsertedIntoDocument): Deleted.
+        (WebCore::ChildNodeInsertionNotifier::notifyNodeInsertedIntoTree): Deleted.
+        (WebCore::ChildNodeInsertionNotifier::notify): Deleted.
+        (WebCore::ChildNodeRemovalNotifier::notifyNodeRemovedFromDocument): Deleted.
+        (WebCore::ChildNodeRemovalNotifier::notifyNodeRemovedFromTree): Deleted.
+        (WebCore::ChildNodeRemovalNotifier::notify): Deleted.
+        * dom/Element.cpp:
+        (WebCore::Element::addShadowRoot):
+        (WebCore::Element::removeShadowRoot):
+        (WebCore::Element::createShadowRoot):
+
</ins><span class="cx"> 2015-09-16  Gyuyoung Kim  &lt;gyuyoung.kim@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove all uses of PassRefPtr in WebCore/bindings
</span></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (189895 => 189896)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNode.cpp        2015-09-17 03:00:30 UTC (rev 189895)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp        2015-09-17 03:27:11 UTC (rev 189896)
</span><span class="lines">@@ -328,7 +328,7 @@
</span><span class="cx">     ChildListMutationScope(*this).childAdded(child);
</span><span class="cx"> 
</span><span class="cx">     NodeVector postInsertionNotificationTargets;
</span><del>-    ChildNodeInsertionNotifier(*this).notify(child, postInsertionNotificationTargets);
</del><ins>+    notifyChildNodeInserted(*this, child, postInsertionNotificationTargets);
</ins><span class="cx"> 
</span><span class="cx">     ChildChange change;
</span><span class="cx">     change.type = child.isElementNode() ? ElementInserted : child.isTextNode() ? TextInserted : NonContentsChildChanged;
</span><span class="lines">@@ -344,7 +344,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ContainerNode::notifyChildRemoved(Node&amp; child, Node* previousSibling, Node* nextSibling, ChildChangeSource source)
</span><span class="cx"> {
</span><del>-    ChildNodeRemovalNotifier(*this).notify(child);
</del><ins>+    notifyChildNodeRemoved(*this, child);
</ins><span class="cx"> 
</span><span class="cx">     ChildChange change;
</span><span class="cx">     change.type = is&lt;Element&gt;(child) ? ElementRemoved : is&lt;Text&gt;(child) ? TextRemoved : NonContentsChildChanged;
</span><span class="lines">@@ -636,9 +636,9 @@
</span><span class="cx">         WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
</span><span class="cx">         {
</span><span class="cx">             NoEventDispatchAssertion assertNoEventDispatch;
</span><del>-            while (RefPtr&lt;Node&gt; n = m_firstChild) {
-                removeBetween(0, m_firstChild-&gt;nextSibling(), *m_firstChild);
-                ChildNodeRemovalNotifier(*this).notify(*n);
</del><ins>+            while (RefPtr&lt;Node&gt; child = m_firstChild) {
+                removeBetween(0, child-&gt;nextSibling(), *child);
+                notifyChildNodeRemoved(*this, *child);
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodeAlgorithmscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp (189895 => 189896)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp        2015-09-17 03:00:30 UTC (rev 189895)
+++ trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp        2015-09-17 03:27:11 UTC (rev 189896)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx">  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
</span><span class="cx">  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
</span><span class="cx">  *           (C) 2001 Dirk Mueller (mueller@kde.org)
</span><del>- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2015 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
</span><span class="cx">  * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
</span><span class="cx">  * Copyright (C) 2012 Google Inc. All rights reserved.
</span><span class="lines">@@ -29,7 +29,12 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-void ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument(ContainerNode&amp; node, NodeVector&amp; postInsertionNotificationTargets)
</del><ins>+void notifyNodeInsertedIntoTree(ContainerNode&amp; insertionPoint, ContainerNode&amp;, NodeVector&amp; postInsertionNotificationTargets);
+void notifyNodeInsertedIntoDocument(ContainerNode&amp; insertionPoint, Node&amp;, NodeVector&amp; postInsertionNotificationTargets);
+void notifyNodeRemovedFromTree(ContainerNode&amp; insertionPoint, ContainerNode&amp;);
+void notifyNodeRemovedFromDocument(ContainerNode&amp; insertionPoint, Node&amp;);
+
+static void notifyDescendantInsertedIntoDocument(ContainerNode&amp; insertionPoint, ContainerNode&amp; node, NodeVector&amp; postInsertionNotificationTargets)
</ins><span class="cx"> {
</span><span class="cx">     ChildNodesLazySnapshot snapshot(node);
</span><span class="cx">     while (RefPtr&lt;Node&gt; child = snapshot.nextNode()) {
</span><span class="lines">@@ -37,7 +42,7 @@
</span><span class="cx">         // we don't want to tell the rest of our children that they've been
</span><span class="cx">         // inserted into the document because they haven't.
</span><span class="cx">         if (node.inDocument() &amp;&amp; child-&gt;parentNode() == &amp;node)
</span><del>-            notifyNodeInsertedIntoDocument(*child, postInsertionNotificationTargets);
</del><ins>+            notifyNodeInsertedIntoDocument(insertionPoint, *child, postInsertionNotificationTargets);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!is&lt;Element&gt;(node))
</span><span class="lines">@@ -45,30 +50,69 @@
</span><span class="cx"> 
</span><span class="cx">     if (RefPtr&lt;ShadowRoot&gt; root = downcast&lt;Element&gt;(node).shadowRoot()) {
</span><span class="cx">         if (node.inDocument() &amp;&amp; root-&gt;host() == &amp;node)
</span><del>-            notifyNodeInsertedIntoDocument(*root, postInsertionNotificationTargets);
</del><ins>+            notifyNodeInsertedIntoDocument(insertionPoint, *root, postInsertionNotificationTargets);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ChildNodeInsertionNotifier::notifyDescendantInsertedIntoTree(ContainerNode&amp; node, NodeVector&amp; postInsertionNotificationTargets)
</del><ins>+static void notifyDescendantInsertedIntoTree(ContainerNode&amp; insertionPoint, ContainerNode&amp; node, NodeVector&amp; postInsertionNotificationTargets)
</ins><span class="cx"> {
</span><span class="cx">     for (Node* child = node.firstChild(); child; child = child-&gt;nextSibling()) {
</span><span class="cx">         if (is&lt;ContainerNode&gt;(*child))
</span><del>-            notifyNodeInsertedIntoTree(downcast&lt;ContainerNode&gt;(*child), postInsertionNotificationTargets);
</del><ins>+            notifyNodeInsertedIntoTree(insertionPoint, downcast&lt;ContainerNode&gt;(*child), postInsertionNotificationTargets);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (ShadowRoot* root = node.shadowRoot())
</span><del>-        notifyNodeInsertedIntoTree(*root, postInsertionNotificationTargets);
</del><ins>+        notifyNodeInsertedIntoTree(insertionPoint, *root, postInsertionNotificationTargets);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument(ContainerNode&amp; node)
</del><ins>+void notifyNodeInsertedIntoDocument(ContainerNode&amp; insertionPoint, Node&amp; node, NodeVector&amp; postInsertionNotificationTargets)
</ins><span class="cx"> {
</span><ins>+    ASSERT(insertionPoint.inDocument());
+    if (node.insertedInto(insertionPoint) == Node::InsertionShouldCallFinishedInsertingSubtree)
+        postInsertionNotificationTargets.append(node);
+    if (is&lt;ContainerNode&gt;(node))
+        notifyDescendantInsertedIntoDocument(insertionPoint, downcast&lt;ContainerNode&gt;(node), postInsertionNotificationTargets);
+}
+
+void notifyNodeInsertedIntoTree(ContainerNode&amp; insertionPoint, ContainerNode&amp; node, NodeVector&amp; postInsertionNotificationTargets)
+{
+    NoEventDispatchAssertion assertNoEventDispatch;
+    ASSERT(!insertionPoint.inDocument());
+
+    if (node.insertedInto(insertionPoint) == Node::InsertionShouldCallFinishedInsertingSubtree)
+        postInsertionNotificationTargets.append(node);
+    notifyDescendantInsertedIntoTree(insertionPoint, node, postInsertionNotificationTargets);
+}
+
+void notifyChildNodeInserted(ContainerNode&amp; insertionPoint, Node&amp; node, NodeVector&amp; postInsertionNotificationTargets)
+{
+    ASSERT_WITH_SECURITY_IMPLICATION(!NoEventDispatchAssertion::isEventDispatchForbidden());
+
+    InspectorInstrumentation::didInsertDOMNode(node.document(), node);
+
+    Ref&lt;Document&gt; protectDocument(node.document());
+    Ref&lt;Node&gt; protectNode(node);
+
+    if (insertionPoint.inDocument())
+        notifyNodeInsertedIntoDocument(insertionPoint, node, postInsertionNotificationTargets);
+    else if (is&lt;ContainerNode&gt;(node))
+        notifyNodeInsertedIntoTree(insertionPoint, downcast&lt;ContainerNode&gt;(node), postInsertionNotificationTargets);
+}
+
+void notifyNodeRemovedFromDocument(ContainerNode&amp; insertionPoint, Node&amp; node)
+{
+    ASSERT(insertionPoint.inDocument());
+    node.removedFrom(insertionPoint);
+
+    if (!is&lt;ContainerNode&gt;(node))
+        return;
</ins><span class="cx">     ChildNodesLazySnapshot snapshot(node);
</span><span class="cx">     while (RefPtr&lt;Node&gt; child = snapshot.nextNode()) {
</span><span class="cx">         // If we have been added to the document during this loop, then we
</span><span class="cx">         // don't want to tell the rest of our children that they've been
</span><span class="cx">         // removed from the document because they haven't.
</span><span class="cx">         if (!node.inDocument() &amp;&amp; child-&gt;parentNode() == &amp;node)
</span><del>-            notifyNodeRemovedFromDocument(*child.get());
</del><ins>+            notifyNodeRemovedFromDocument(insertionPoint, *child.get());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!is&lt;Element&gt;(node))
</span><span class="lines">@@ -79,24 +123,40 @@
</span><span class="cx"> 
</span><span class="cx">     if (RefPtr&lt;ShadowRoot&gt; root = downcast&lt;Element&gt;(node).shadowRoot()) {
</span><span class="cx">         if (!node.inDocument() &amp;&amp; root-&gt;host() == &amp;node)
</span><del>-            notifyNodeRemovedFromDocument(*root.get());
</del><ins>+            notifyNodeRemovedFromDocument(insertionPoint, *root.get());
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ChildNodeRemovalNotifier::notifyDescendantRemovedFromTree(ContainerNode&amp; node)
</del><ins>+void notifyNodeRemovedFromTree(ContainerNode&amp; insertionPoint, ContainerNode&amp; node)
</ins><span class="cx"> {
</span><ins>+    NoEventDispatchAssertion assertNoEventDispatch;
+    ASSERT(!insertionPoint.inDocument());
+
+    node.removedFrom(insertionPoint);
+
</ins><span class="cx">     for (Node* child = node.firstChild(); child; child = child-&gt;nextSibling()) {
</span><span class="cx">         if (is&lt;ContainerNode&gt;(*child))
</span><del>-            notifyNodeRemovedFromTree(downcast&lt;ContainerNode&gt;(*child));
</del><ins>+            notifyNodeRemovedFromTree(insertionPoint, downcast&lt;ContainerNode&gt;(*child));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!is&lt;Element&gt;(node))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (RefPtr&lt;ShadowRoot&gt; root = downcast&lt;Element&gt;(node).shadowRoot())
</span><del>-        notifyNodeRemovedFromTree(*root.get());
</del><ins>+        notifyNodeRemovedFromTree(insertionPoint, *root.get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void notifyChildNodeRemoved(ContainerNode&amp; insertionPoint, Node&amp; child)
+{
+    if (!child.inDocument()) {
+        if (is&lt;ContainerNode&gt;(child))
+            notifyNodeRemovedFromTree(insertionPoint, downcast&lt;ContainerNode&gt;(child));
+        return;
+    }
+    notifyNodeRemovedFromDocument(insertionPoint, child);
+    child.document().notifyRemovePendingSheetIfNeeded();
+}
+
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> static unsigned assertConnectedSubrameCountIsConsistent(ContainerNode&amp; node)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodeAlgorithmsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h (189895 => 189896)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h        2015-09-17 03:00:30 UTC (rev 189895)
+++ trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h        2015-09-17 03:27:11 UTC (rev 189896)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2007 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2007, 2015 Apple Inc. All rights reserved.
</ins><span class="cx">  *           (C) 2008 Nikolas Zimmermann &lt;zimmermann@kde.org&gt;
</span><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="lines">@@ -34,44 +34,10 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class ChildNodeInsertionNotifier {
-public:
-    explicit ChildNodeInsertionNotifier(ContainerNode&amp; insertionPoint)
-        : m_insertionPoint(insertionPoint)
-    {
-    }
</del><ins>+void notifyChildNodeInserted(ContainerNode&amp; insertionPoint, Node&amp;, NodeVector&amp; postInsertionNotificationTargets);
+void notifyChildNodeRemoved(ContainerNode&amp; insertionPoint, Node&amp;);
</ins><span class="cx"> 
</span><del>-    void notify(Node&amp;, NodeVector&amp; postInsertionNotificationTargets);
-
-private:
-    void notifyDescendantInsertedIntoDocument(ContainerNode&amp;, NodeVector&amp; postInsertionNotificationTargets);
-    void notifyDescendantInsertedIntoTree(ContainerNode&amp;, NodeVector&amp; postInsertionNotificationTargets);
-    void notifyNodeInsertedIntoDocument(Node&amp;, NodeVector&amp; postInsertionNotificationTargets);
-    void notifyNodeInsertedIntoTree(ContainerNode&amp;, NodeVector&amp; postInsertionNotificationTargets);
-
-    ContainerNode&amp; m_insertionPoint;
-};
-
-class ChildNodeRemovalNotifier {
-public:
-    explicit ChildNodeRemovalNotifier(ContainerNode&amp; removalPoint)
-        : m_removalPoint(removalPoint)
-    {
-    }
-
-    void notify(Node&amp;);
-
-private:
-    void notifyDescendantRemovedFromDocument(ContainerNode&amp;);
-    void notifyDescendantRemovedFromTree(ContainerNode&amp;);
-    void notifyNodeRemovedFromDocument(Node&amp;);
-    void notifyNodeRemovedFromTree(ContainerNode&amp;);
-
-    ContainerNode&amp; m_removalPoint;
-};
-
</del><span class="cx"> namespace Private {
</span><del>-
</del><span class="cx">     template&lt;class GenericNode, class GenericNodeContainer&gt;
</span><span class="cx">     void addChildNodesToDeletionQueue(GenericNode*&amp; head, GenericNode*&amp; tail, GenericNodeContainer&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -140,7 +106,7 @@
</span><span class="cx">             if (Document* containerDocument = container.ownerDocument())
</span><span class="cx">                 containerDocument-&gt;adoptIfNeeded(&amp;node);
</span><span class="cx">             if (node.inDocument())
</span><del>-                ChildNodeRemovalNotifier(container).notify(node);
</del><ins>+                notifyChildNodeRemoved(container, node);
</ins><span class="cx">         }
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="lines">@@ -192,68 +158,6 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace Private
</span><span class="cx"> 
</span><del>-inline void ChildNodeInsertionNotifier::notifyNodeInsertedIntoDocument(Node&amp; node, NodeVector&amp; postInsertionNotificationTargets)
-{
-    ASSERT(m_insertionPoint.inDocument());
-    if (Node::InsertionShouldCallFinishedInsertingSubtree == node.insertedInto(m_insertionPoint))
-        postInsertionNotificationTargets.append(node);
-    if (is&lt;ContainerNode&gt;(node))
-        notifyDescendantInsertedIntoDocument(downcast&lt;ContainerNode&gt;(node), postInsertionNotificationTargets);
-}
-
-inline void ChildNodeInsertionNotifier::notifyNodeInsertedIntoTree(ContainerNode&amp; node, NodeVector&amp; postInsertionNotificationTargets)
-{
-    NoEventDispatchAssertion assertNoEventDispatch;
-    ASSERT(!m_insertionPoint.inDocument());
-
-    if (Node::InsertionShouldCallFinishedInsertingSubtree == node.insertedInto(m_insertionPoint))
-        postInsertionNotificationTargets.append(node);
-    notifyDescendantInsertedIntoTree(node, postInsertionNotificationTargets);
-}
-
-inline void ChildNodeInsertionNotifier::notify(Node&amp; node, NodeVector&amp; postInsertionNotificationTargets)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!NoEventDispatchAssertion::isEventDispatchForbidden());
-
-    InspectorInstrumentation::didInsertDOMNode(node.document(), node);
-
-    Ref&lt;Document&gt; protectDocument(node.document());
-    Ref&lt;Node&gt; protectNode(node);
-
-    if (m_insertionPoint.inDocument())
-        notifyNodeInsertedIntoDocument(node, postInsertionNotificationTargets);
-    else if (is&lt;ContainerNode&gt;(node))
-        notifyNodeInsertedIntoTree(downcast&lt;ContainerNode&gt;(node), postInsertionNotificationTargets);
-}
-
-
-inline void ChildNodeRemovalNotifier::notifyNodeRemovedFromDocument(Node&amp; node)
-{
-    ASSERT(m_removalPoint.inDocument());
-    node.removedFrom(m_removalPoint);
-
-    if (is&lt;ContainerNode&gt;(node))
-        notifyDescendantRemovedFromDocument(downcast&lt;ContainerNode&gt;(node));
-}
-
-inline void ChildNodeRemovalNotifier::notifyNodeRemovedFromTree(ContainerNode&amp; node)
-{
-    NoEventDispatchAssertion assertNoEventDispatch;
-    ASSERT(!m_removalPoint.inDocument());
-
-    node.removedFrom(m_removalPoint);
-    notifyDescendantRemovedFromTree(node);
-}
-
-inline void ChildNodeRemovalNotifier::notify(Node&amp; node)
-{
-    if (node.inDocument()) {
-        notifyNodeRemovedFromDocument(node);
-        node.document().notifyRemovePendingSheetIfNeeded();
-    } else if (is&lt;ContainerNode&gt;(node))
-        notifyNodeRemovedFromTree(downcast&lt;ContainerNode&gt;(node));
-}
-
</del><span class="cx"> enum SubframeDisconnectPolicy {
</span><span class="cx">     RootAndDescendants,
</span><span class="cx">     DescendantsOnly
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (189895 => 189896)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2015-09-17 03:00:30 UTC (rev 189895)
+++ trunk/Source/WebCore/dom/Element.cpp        2015-09-17 03:27:11 UTC (rev 189896)
</span><span class="lines">@@ -1616,7 +1616,7 @@
</span><span class="cx">     shadowRoot.setParentTreeScope(&amp;treeScope());
</span><span class="cx"> 
</span><span class="cx">     NodeVector postInsertionNotificationTargets;
</span><del>-    ChildNodeInsertionNotifier(*this).notify(shadowRoot, postInsertionNotificationTargets);
</del><ins>+    notifyChildNodeInserted(*this, shadowRoot, postInsertionNotificationTargets);
</ins><span class="cx"> 
</span><span class="cx">     for (auto&amp; target : postInsertionNotificationTargets)
</span><span class="cx">         target-&gt;finishedInsertingSubtree();
</span><span class="lines">@@ -1646,7 +1646,7 @@
</span><span class="cx">     oldRoot-&gt;setHost(nullptr);
</span><span class="cx">     oldRoot-&gt;setParentTreeScope(&amp;document());
</span><span class="cx"> 
</span><del>-    ChildNodeRemovalNotifier(*this).notify(*oldRoot);
</del><ins>+    notifyChildNodeRemoved(*this, *oldRoot);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;ShadowRoot&gt; Element::createShadowRoot(ExceptionCode&amp; ec)
</span></span></pre>
</div>
</div>

</body>
</html>