<!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 <antti@apple.com>
+
+ 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 <gyuyoung.kim@webkit.org>
</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& 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<Element>(child) ? ElementRemoved : is<Text>(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<Node> n = m_firstChild) {
- removeBetween(0, m_firstChild->nextSibling(), *m_firstChild);
- ChildNodeRemovalNotifier(*this).notify(*n);
</del><ins>+ while (RefPtr<Node> child = m_firstChild) {
+ removeBetween(0, child->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& node, NodeVector& postInsertionNotificationTargets)
</del><ins>+void notifyNodeInsertedIntoTree(ContainerNode& insertionPoint, ContainerNode&, NodeVector& postInsertionNotificationTargets);
+void notifyNodeInsertedIntoDocument(ContainerNode& insertionPoint, Node&, NodeVector& postInsertionNotificationTargets);
+void notifyNodeRemovedFromTree(ContainerNode& insertionPoint, ContainerNode&);
+void notifyNodeRemovedFromDocument(ContainerNode& insertionPoint, Node&);
+
+static void notifyDescendantInsertedIntoDocument(ContainerNode& insertionPoint, ContainerNode& node, NodeVector& postInsertionNotificationTargets)
</ins><span class="cx"> {
</span><span class="cx"> ChildNodesLazySnapshot snapshot(node);
</span><span class="cx"> while (RefPtr<Node> 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() && child->parentNode() == &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<Element>(node))
</span><span class="lines">@@ -45,30 +50,69 @@
</span><span class="cx">
</span><span class="cx"> if (RefPtr<ShadowRoot> root = downcast<Element>(node).shadowRoot()) {
</span><span class="cx"> if (node.inDocument() && root->host() == &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& node, NodeVector& postInsertionNotificationTargets)
</del><ins>+static void notifyDescendantInsertedIntoTree(ContainerNode& insertionPoint, ContainerNode& node, NodeVector& postInsertionNotificationTargets)
</ins><span class="cx"> {
</span><span class="cx"> for (Node* child = node.firstChild(); child; child = child->nextSibling()) {
</span><span class="cx"> if (is<ContainerNode>(*child))
</span><del>- notifyNodeInsertedIntoTree(downcast<ContainerNode>(*child), postInsertionNotificationTargets);
</del><ins>+ notifyNodeInsertedIntoTree(insertionPoint, downcast<ContainerNode>(*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& node)
</del><ins>+void notifyNodeInsertedIntoDocument(ContainerNode& insertionPoint, Node& node, NodeVector& postInsertionNotificationTargets)
</ins><span class="cx"> {
</span><ins>+ ASSERT(insertionPoint.inDocument());
+ if (node.insertedInto(insertionPoint) == Node::InsertionShouldCallFinishedInsertingSubtree)
+ postInsertionNotificationTargets.append(node);
+ if (is<ContainerNode>(node))
+ notifyDescendantInsertedIntoDocument(insertionPoint, downcast<ContainerNode>(node), postInsertionNotificationTargets);
+}
+
+void notifyNodeInsertedIntoTree(ContainerNode& insertionPoint, ContainerNode& node, NodeVector& postInsertionNotificationTargets)
+{
+ NoEventDispatchAssertion assertNoEventDispatch;
+ ASSERT(!insertionPoint.inDocument());
+
+ if (node.insertedInto(insertionPoint) == Node::InsertionShouldCallFinishedInsertingSubtree)
+ postInsertionNotificationTargets.append(node);
+ notifyDescendantInsertedIntoTree(insertionPoint, node, postInsertionNotificationTargets);
+}
+
+void notifyChildNodeInserted(ContainerNode& insertionPoint, Node& node, NodeVector& postInsertionNotificationTargets)
+{
+ ASSERT_WITH_SECURITY_IMPLICATION(!NoEventDispatchAssertion::isEventDispatchForbidden());
+
+ InspectorInstrumentation::didInsertDOMNode(node.document(), node);
+
+ Ref<Document> protectDocument(node.document());
+ Ref<Node> protectNode(node);
+
+ if (insertionPoint.inDocument())
+ notifyNodeInsertedIntoDocument(insertionPoint, node, postInsertionNotificationTargets);
+ else if (is<ContainerNode>(node))
+ notifyNodeInsertedIntoTree(insertionPoint, downcast<ContainerNode>(node), postInsertionNotificationTargets);
+}
+
+void notifyNodeRemovedFromDocument(ContainerNode& insertionPoint, Node& node)
+{
+ ASSERT(insertionPoint.inDocument());
+ node.removedFrom(insertionPoint);
+
+ if (!is<ContainerNode>(node))
+ return;
</ins><span class="cx"> ChildNodesLazySnapshot snapshot(node);
</span><span class="cx"> while (RefPtr<Node> 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() && child->parentNode() == &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<Element>(node))
</span><span class="lines">@@ -79,24 +123,40 @@
</span><span class="cx">
</span><span class="cx"> if (RefPtr<ShadowRoot> root = downcast<Element>(node).shadowRoot()) {
</span><span class="cx"> if (!node.inDocument() && root->host() == &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& node)
</del><ins>+void notifyNodeRemovedFromTree(ContainerNode& insertionPoint, ContainerNode& 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->nextSibling()) {
</span><span class="cx"> if (is<ContainerNode>(*child))
</span><del>- notifyNodeRemovedFromTree(downcast<ContainerNode>(*child));
</del><ins>+ notifyNodeRemovedFromTree(insertionPoint, downcast<ContainerNode>(*child));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!is<Element>(node))
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (RefPtr<ShadowRoot> root = downcast<Element>(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& insertionPoint, Node& child)
+{
+ if (!child.inDocument()) {
+ if (is<ContainerNode>(child))
+ notifyNodeRemovedFromTree(insertionPoint, downcast<ContainerNode>(child));
+ return;
+ }
+ notifyNodeRemovedFromDocument(insertionPoint, child);
+ child.document().notifyRemovePendingSheetIfNeeded();
+}
+
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> static unsigned assertConnectedSubrameCountIsConsistent(ContainerNode& 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 <zimmermann@kde.org>
</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& insertionPoint)
- : m_insertionPoint(insertionPoint)
- {
- }
</del><ins>+void notifyChildNodeInserted(ContainerNode& insertionPoint, Node&, NodeVector& postInsertionNotificationTargets);
+void notifyChildNodeRemoved(ContainerNode& insertionPoint, Node&);
</ins><span class="cx">
</span><del>- void notify(Node&, NodeVector& postInsertionNotificationTargets);
-
-private:
- void notifyDescendantInsertedIntoDocument(ContainerNode&, NodeVector& postInsertionNotificationTargets);
- void notifyDescendantInsertedIntoTree(ContainerNode&, NodeVector& postInsertionNotificationTargets);
- void notifyNodeInsertedIntoDocument(Node&, NodeVector& postInsertionNotificationTargets);
- void notifyNodeInsertedIntoTree(ContainerNode&, NodeVector& postInsertionNotificationTargets);
-
- ContainerNode& m_insertionPoint;
-};
-
-class ChildNodeRemovalNotifier {
-public:
- explicit ChildNodeRemovalNotifier(ContainerNode& removalPoint)
- : m_removalPoint(removalPoint)
- {
- }
-
- void notify(Node&);
-
-private:
- void notifyDescendantRemovedFromDocument(ContainerNode&);
- void notifyDescendantRemovedFromTree(ContainerNode&);
- void notifyNodeRemovedFromDocument(Node&);
- void notifyNodeRemovedFromTree(ContainerNode&);
-
- ContainerNode& m_removalPoint;
-};
-
</del><span class="cx"> namespace Private {
</span><del>-
</del><span class="cx"> template<class GenericNode, class GenericNodeContainer>
</span><span class="cx"> void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer&);
</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->adoptIfNeeded(&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& node, NodeVector& postInsertionNotificationTargets)
-{
- ASSERT(m_insertionPoint.inDocument());
- if (Node::InsertionShouldCallFinishedInsertingSubtree == node.insertedInto(m_insertionPoint))
- postInsertionNotificationTargets.append(node);
- if (is<ContainerNode>(node))
- notifyDescendantInsertedIntoDocument(downcast<ContainerNode>(node), postInsertionNotificationTargets);
-}
-
-inline void ChildNodeInsertionNotifier::notifyNodeInsertedIntoTree(ContainerNode& node, NodeVector& 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& node, NodeVector& postInsertionNotificationTargets)
-{
- ASSERT_WITH_SECURITY_IMPLICATION(!NoEventDispatchAssertion::isEventDispatchForbidden());
-
- InspectorInstrumentation::didInsertDOMNode(node.document(), node);
-
- Ref<Document> protectDocument(node.document());
- Ref<Node> protectNode(node);
-
- if (m_insertionPoint.inDocument())
- notifyNodeInsertedIntoDocument(node, postInsertionNotificationTargets);
- else if (is<ContainerNode>(node))
- notifyNodeInsertedIntoTree(downcast<ContainerNode>(node), postInsertionNotificationTargets);
-}
-
-
-inline void ChildNodeRemovalNotifier::notifyNodeRemovedFromDocument(Node& node)
-{
- ASSERT(m_removalPoint.inDocument());
- node.removedFrom(m_removalPoint);
-
- if (is<ContainerNode>(node))
- notifyDescendantRemovedFromDocument(downcast<ContainerNode>(node));
-}
-
-inline void ChildNodeRemovalNotifier::notifyNodeRemovedFromTree(ContainerNode& node)
-{
- NoEventDispatchAssertion assertNoEventDispatch;
- ASSERT(!m_removalPoint.inDocument());
-
- node.removedFrom(m_removalPoint);
- notifyDescendantRemovedFromTree(node);
-}
-
-inline void ChildNodeRemovalNotifier::notify(Node& node)
-{
- if (node.inDocument()) {
- notifyNodeRemovedFromDocument(node);
- node.document().notifyRemovePendingSheetIfNeeded();
- } else if (is<ContainerNode>(node))
- notifyNodeRemovedFromTree(downcast<ContainerNode>(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(&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& target : postInsertionNotificationTargets)
</span><span class="cx"> target->finishedInsertingSubtree();
</span><span class="lines">@@ -1646,7 +1646,7 @@
</span><span class="cx"> oldRoot->setHost(nullptr);
</span><span class="cx"> oldRoot->setParentTreeScope(&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<ShadowRoot> Element::createShadowRoot(ExceptionCode& ec)
</span></span></pre>
</div>
</div>
</body>
</html>