Index: Source/core/testing/Internals.cpp |
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp |
index 3f88666cfba22a41c3ed8ee49819cb87e86e5e4d..10cc9457a66d443ea014af8922bacfb801ba7113 100644 |
--- a/Source/core/testing/Internals.cpp |
+++ b/Source/core/testing/Internals.cpp |
@@ -57,6 +57,7 @@ |
#include "core/dom/DocumentMarker.h" |
#include "core/dom/DocumentMarkerController.h" |
#include "core/dom/Element.h" |
+#include "core/dom/EventHandlerRegistry.h" |
#include "core/dom/ExceptionCode.h" |
#include "core/dom/FullscreenElementStack.h" |
#include "core/dom/NodeRenderStyle.h" |
@@ -65,7 +66,6 @@ |
#include "core/dom/StaticNodeList.h" |
#include "core/dom/TreeScope.h" |
#include "core/dom/ViewportDescription.h" |
-#include "core/dom/WheelController.h" |
#include "core/dom/shadow/ComposedTreeWalker.h" |
#include "core/dom/shadow/ElementShadow.h" |
#include "core/dom/shadow/SelectRuleFeatureSet.h" |
@@ -1278,6 +1278,18 @@ unsigned Internals::activeDOMObjectCount(Document* document, ExceptionState& exc |
return document->activeDOMObjectCount(); |
} |
+static unsigned eventHandlerCount(Document& document, EventHandlerRegistry::EventHandlerClass handlerClass) |
+{ |
+ EventHandlerRegistry* registry = EventHandlerRegistry::from(document); |
+ unsigned count = registry->externalEventHandlerCount(handlerClass); |
+ const EventTargetSet* targets = registry->eventHandlerTargets(handlerClass); |
+ if (targets) { |
+ for (EventTargetSet::const_iterator iter = targets->begin(); iter != targets->end(); ++iter) |
+ count += iter->value; |
+ } |
+ return count; |
+} |
+ |
unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionState& exceptionState) |
{ |
if (!document) { |
@@ -1285,24 +1297,27 @@ unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionState& e |
return 0; |
} |
- return WheelController::from(*document)->wheelEventHandlerCount(); |
+ return eventHandlerCount(*document, EventHandlerRegistry::WheelEvent); |
} |
-unsigned Internals::touchEventHandlerCount(Document* document, ExceptionState& exceptionState) |
+unsigned Internals::scrollEventHandlerCount(Document* document, ExceptionState& exceptionState) |
{ |
if (!document) { |
exceptionState.throwDOMException(InvalidAccessError, "No context document is available."); |
return 0; |
} |
- const TouchEventTargetSet* touchHandlers = document->touchEventTargets(); |
- if (!touchHandlers) |
+ return eventHandlerCount(*document, EventHandlerRegistry::ScrollEvent); |
+} |
+ |
+unsigned Internals::touchEventHandlerCount(Document* document, ExceptionState& exceptionState) |
+{ |
+ if (!document) { |
+ exceptionState.throwDOMException(InvalidAccessError, "No context document is available."); |
return 0; |
+ } |
- unsigned count = 0; |
- for (TouchEventTargetSet::const_iterator iter = touchHandlers->begin(); iter != touchHandlers->end(); ++iter) |
- count += iter->value; |
- return count; |
+ return eventHandlerCount(*document, EventHandlerRegistry::TouchEvent); |
} |
static RenderLayer* findRenderLayerForGraphicsLayer(RenderLayer* searchRoot, GraphicsLayer* graphicsLayer, String* layerType) |