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

Unified Diff: Source/core/dom/Node.cpp

Issue 206603002: Add EventHandlerRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Start with the bare minimum. Created 6 years, 8 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: Source/core/dom/Node.cpp
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index 2ad38745cf739ae33a5705e7ee45c0ecfad27365..24c5f6daf4dfd1672e5586e47f7a6893ac155a84 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -42,6 +42,7 @@
#include "core/dom/Element.h"
#include "core/dom/ElementRareData.h"
#include "core/dom/ElementTraversal.h"
+#include "core/dom/EventHandlerRegistry.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/LiveNodeList.h"
#include "core/dom/NodeRareData.h"
@@ -291,6 +292,7 @@ void Node::willBeDeletedFromDocument()
if (hasEventTargetData()) {
clearEventTargetData();
document.didClearTouchEventHandlers(this);
+ EventHandlerRegistry::from(document)->didRemoveAllEventHandlers(*this);
}
if (AXObjectCache* cache = document.existingAXObjectCache())
@@ -1941,6 +1943,7 @@ void Node::didMoveToNewDocument(Document& oldDocument)
document().didAddTouchEventHandler(this);
}
}
+ EventHandlerRegistry::from(document())->didMoveFromOtherDocument(*this, oldDocument);
if (Vector<OwnPtr<MutationObserverRegistration> >* registry = mutationObserverRegistry()) {
for (size_t i = 0; i < registry->size(); ++i) {
@@ -1966,6 +1969,7 @@ static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve
WheelController::from(document)->didAddWheelEventHandler(document);
else if (isTouchEventType(eventType))
document.didAddTouchEventHandler(targetNode);
+ EventHandlerRegistry::from(document)->didAddEventHandler(*targetNode, eventType);
return true;
}
@@ -1987,6 +1991,7 @@ static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString&
WheelController::from(document)->didRemoveWheelEventHandler(document);
else if (isTouchEventType(eventType))
document.didRemoveTouchEventHandler(targetNode);
+ EventHandlerRegistry::from(document)->didRemoveEventHandler(*targetNode, eventType);
return true;
}
@@ -2000,6 +2005,7 @@ void Node::removeAllEventListeners()
{
EventTarget::removeAllEventListeners();
document().didClearTouchEventHandlers(this);
+ EventHandlerRegistry::from(document())->didRemoveAllEventHandlers(*this);
abarth-chromium 2014/04/17 18:05:12 It's kind of lame that we'll create the EventHandl
Sami 2014/04/17 18:40:53 I think I can guard this with hasEventListeners()
}
void Node::removeAllEventListenersRecursively()

Powered by Google App Engine
This is Rietveld 408576698