| Index: Source/core/dom/Node.cpp
|
| diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
|
| index edcac04a7e802c3106b53453088b9128102e179e..c0e7f8f6d244266a7ddda362e4565e2b26e351d2 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"
|
| @@ -81,6 +80,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"
|
| @@ -298,7 +298,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())
|
| @@ -1954,7 +1955,12 @@ void Node::didMoveToNewDocument(Document& oldDocument)
|
| document().didAddTouchEventHandler(this);
|
| }
|
| }
|
| - EventHandlerRegistry::from(document())->didMoveFromOtherDocument(*this, oldDocument);
|
| + if (oldDocument.page() != document().page()) {
|
| + if (oldDocument.page())
|
| + EventHandlerRegistry::from(*oldDocument.page())->didMoveOutOfPage(*this);
|
| + if (document().page())
|
| + EventHandlerRegistry::from(*document().page())->didMoveIntoPage(*this);
|
| + }
|
|
|
| if (WillBeHeapVector<OwnPtrWillBeMember<MutationObserverRegistration> >* registry = mutationObserverRegistry()) {
|
| for (size_t i = 0; i < registry->size(); ++i) {
|
| @@ -1980,7 +1986,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;
|
| }
|
| @@ -2002,7 +2009,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;
|
| }
|
| @@ -2014,8 +2022,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);
|
| }
|
|
|