Index: Source/core/testing/Internals.cpp |
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp |
index e9924031defc0d5b15614b1367dc9b26e53b37ff..b9309caa253bfc1a37acd8dfb9de0f446bd2e5c9 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" |
@@ -1278,6 +1279,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 = 0; |
+ 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) { |
@@ -1288,6 +1301,16 @@ unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionState& e |
return WheelController::from(*document)->wheelEventHandlerCount(); |
} |
+unsigned Internals::scrollEventHandlerCount(Document* document, ExceptionState& exceptionState) |
+{ |
+ if (!document) { |
+ exceptionState.throwDOMException(InvalidAccessError, "No context document is available."); |
+ return 0; |
+ } |
+ |
+ return eventHandlerCount(*document, EventHandlerRegistry::ScrollEvent); |
+} |
+ |
unsigned Internals::touchEventHandlerCount(Document* document, ExceptionState& exceptionState) |
{ |
if (!document) { |