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

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

Issue 22859012: Add support for DOM Level 3 WheelEvent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename prefixedType() to legacyType() Created 7 years, 4 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/EventTarget.cpp ('k') | Source/core/dom/WheelEvent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « Source/core/dom/EventTarget.cpp ('k') | Source/core/dom/WheelEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698