Index: Source/core/dom/Node.cpp |
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp |
index 439fef932015e5530f27f07b7a22f2d4cfdcc86e..3c19f461a08e62e2e605b466ff243a4358d5386c 100644 |
--- a/Source/core/dom/Node.cpp |
+++ b/Source/core/dom/Node.cpp |
@@ -2151,7 +2151,13 @@ void Node::didMoveToNewDocument(Document* oldDocument) |
if (AXObjectCache* cache = oldDocument->existingAXObjectCache()) |
cache->remove(this); |
- const EventListenerVector& wheelListeners = getEventListeners(eventNames().mousewheelEvent); |
+ const EventListenerVector& mousewheelListeners = getEventListeners(eventNames().mousewheelEvent); |
+ for (size_t i = 0; i < mousewheelListeners.size(); ++i) { |
+ oldDocument->didRemoveWheelEventHandler(); |
+ document()->didAddWheelEventHandler(); |
+ } |
+ |
+ const EventListenerVector& wheelListeners = getEventListeners(eventNames().wheelEvent); |
for (size_t i = 0; i < wheelListeners.size(); ++i) { |
oldDocument->didRemoveWheelEventHandler(); |
document()->didAddWheelEventHandler(); |
@@ -2184,7 +2190,7 @@ static inline bool tryAddEventListener(Node* targetNode, const AtomicString& eve |
if (Document* document = targetNode->document()) { |
document->addListenerTypeIfNeeded(eventType); |
- if (eventType == eventNames().mousewheelEvent) |
+ if (eventType == eventNames().wheelEvent || eventType == eventNames().mousewheelEvent) |
document->didAddWheelEventHandler(); |
else if (eventNames().isTouchEventType(eventType)) |
document->didAddTouchEventHandler(targetNode); |
@@ -2206,7 +2212,7 @@ static inline bool tryRemoveEventListener(Node* targetNode, const AtomicString& |
// FIXME: Notify Document that the listener has vanished. We need to keep track of a number of |
// listeners for each type, not just a bool - see https://bugs.webkit.org/show_bug.cgi?id=33861 |
if (Document* document = targetNode->document()) { |
- if (eventType == eventNames().mousewheelEvent) |
+ if (eventType == eventNames().wheelEvent || eventType == eventNames().mousewheelEvent) |
document->didRemoveWheelEventHandler(); |
else if (eventNames().isTouchEventType(eventType)) |
document->didRemoveTouchEventHandler(targetNode); |
@@ -2513,7 +2519,7 @@ void Node::defaultEventHandler(Event* event) |
} |
} |
#endif |
- } else if (eventType == eventNames().mousewheelEvent && event->hasInterface(eventNames().interfaceForWheelEvent)) { |
+ } else if ((eventType == eventNames().wheelEvent || eventType == eventNames().mousewheelEvent) && event->hasInterface(eventNames().interfaceForWheelEvent)) { |
WheelEvent* wheelEvent = static_cast<WheelEvent*>(event); |
// If we don't have a renderer, send the wheel event to the first node we find with a renderer. |