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

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

Issue 237963014: Track scroll event handlers in nested documents (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed unneeded function definition. 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 f7594b0770ea741ed1556cde05f78eba663f0848..eea724ab928135ab593780d672eab0d4ae9c2bed 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -42,7 +42,6 @@
#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"
@@ -80,6 +79,7 @@
#include "core/html/HTMLStyleElement.h"
#include "core/page/ContextMenuController.h"
#include "core/page/EventHandler.h"
+#include "core/page/EventHandlerRegistry.h"
#include "core/page/Page.h"
#include "core/frame/Settings.h"
#include "core/rendering/FlowThreadController.h"
@@ -292,7 +292,8 @@ void Node::willBeDeletedFromDocument()
if (hasEventTargetData()) {
clearEventTargetData();
document.didClearTouchEventHandlers(this);
- EventHandlerRegistry::from(document)->didRemoveAllEventHandlers(*this);
+ if (document.page())
+ EventHandlerRegistry::from(*document.page())->didRemoveAllEventHandlers(*this);
}
if (AXObjectCache* cache = document.existingAXObjectCache())
@@ -1943,7 +1944,8 @@ void Node::didMoveToNewDocument(Document& oldDocument)
document().didAddTouchEventHandler(this);
}
}
- EventHandlerRegistry::from(document())->didMoveFromOtherDocument(*this, oldDocument);
+ if (document().page())
Rick Byers 2014/04/24 21:30:12 In what cases does a Document not have a Page? It
Sami 2014/04/25 19:51:15 After a document is detached it will no longer hav
+ EventHandlerRegistry::from(*document().page())->didMoveFromOtherDocument(*this, oldDocument);
if (Vector<OwnPtr<MutationObserverRegistration> >* registry = mutationObserverRegistry()) {
for (size_t i = 0; i < registry->size(); ++i) {
@@ -1969,7 +1971,8 @@ 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);
+ if (document.page())
+ EventHandlerRegistry::from(*document.page())->didAddEventHandler(*targetNode, eventType);
return true;
}
@@ -1991,7 +1994,8 @@ 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);
+ if (document.page())
+ EventHandlerRegistry::from(*document.page())->didRemoveEventHandler(*targetNode, eventType);
return true;
}
@@ -2003,8 +2007,8 @@ bool Node::removeEventListener(const AtomicString& eventType, EventListener* lis
void Node::removeAllEventListeners()
{
- if (hasEventListeners())
- EventHandlerRegistry::from(document())->didRemoveAllEventHandlers(*this);
+ if (hasEventListeners() && document().page())
+ EventHandlerRegistry::from(*document().page())->didRemoveAllEventHandlers(*this);
EventTarget::removeAllEventListeners();
document().didClearTouchEventHandlers(this);
}

Powered by Google App Engine
This is Rietveld 408576698