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

Unified Diff: Source/core/dom/ContainerNodeAlgorithms.h

Issue 305603003: Merge ChildNodeInsertionNotifier and ChildNodeRemovalNotifier into ContainerNode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Don't mess with RefPtr protects yet Created 6 years, 7 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 | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/ContainerNodeAlgorithms.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ContainerNodeAlgorithms.h
diff --git a/Source/core/dom/ContainerNodeAlgorithms.h b/Source/core/dom/ContainerNodeAlgorithms.h
index 7e76b691d0dc4521f942374c596a3b848d91d0ad..3ee6facf84e7faee318b88aaa1b2ecc1759b52df 100644
--- a/Source/core/dom/ContainerNodeAlgorithms.h
+++ b/Source/core/dom/ContainerNodeAlgorithms.h
@@ -23,72 +23,10 @@
#define ContainerNodeAlgorithms_h
#include "core/dom/Document.h"
-#include "core/dom/ScriptForbiddenScope.h"
-#include "core/inspector/InspectorInstrumentation.h"
#include "wtf/Assertions.h"
namespace WebCore {
-class ChildNodeInsertionNotifier {
-public:
- explicit ChildNodeInsertionNotifier(ContainerNode& insertionPoint)
- : m_insertionPoint(insertionPoint)
- {
- }
-
- void notify(Node&);
-
-private:
- void notifyNodeInserted(Node&);
-
- ContainerNode& m_insertionPoint;
- Vector< RefPtr<Node> > m_postInsertionNotificationTargets;
-};
-
-inline void ChildNodeInsertionNotifier::notify(Node& node)
-{
- ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
-
- InspectorInstrumentation::didInsertDOMNode(&node);
-
- RefPtr<Document> protectDocument(node.document());
- RefPtr<Node> protectNode(node);
-
- {
- NoEventDispatchAssertion assertNoEventDispatch;
- ScriptForbiddenScope forbidScript;
- notifyNodeInserted(node);
- }
-
- for (size_t i = 0; i < m_postInsertionNotificationTargets.size(); ++i) {
- Node* targetNode = m_postInsertionNotificationTargets[i].get();
- if (targetNode->inDocument())
- targetNode->didNotifySubtreeInsertionsToDocument();
- }
-}
-
-class ChildNodeRemovalNotifier {
-public:
- explicit ChildNodeRemovalNotifier(ContainerNode& insertionPoint)
- : m_insertionPoint(insertionPoint)
- {
- }
-
- void notify(Node&);
-
-private:
- void notifyNodeRemoved(Node&);
-
- ContainerNode& m_insertionPoint;
-};
-
-inline void ChildNodeRemovalNotifier::notify(Node& node)
-{
- ScriptForbiddenScope forbidScript;
- NoEventDispatchAssertion assertNoEventDispatch;
- notifyNodeRemoved(node);
-}
-
namespace Private {
template<class GenericNode, class GenericNodeContainer>
@@ -161,7 +99,7 @@ namespace Private {
{
container.document().adoptIfNeeded(node);
if (node.inDocument())
- ChildNodeRemovalNotifier(container).notify(node);
+ container.notifyNodeRemoved(node);
}
};
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/ContainerNodeAlgorithms.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698