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

Unified Diff: Source/core/testing/Internals.cpp

Issue 206603002: Add EventHandlerRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tests now seem to pass. Created 6 years, 9 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
Index: Source/core/testing/Internals.cpp
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index c00c6a96e351f1e19d7339e058e0815e568b09d2..016cdcd2e2afeb5641ce5e3956cb16b772a2a709 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"
@@ -1284,24 +1284,27 @@ unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionState& e
return 0;
}
- return WheelController::from(*document)->wheelEventHandlerCount();
+ return EventHandlerRegistry::from(*document)->eventHandlerCount(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 EventHandlerRegistry::from(*document)->eventHandlerCount(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 EventHandlerRegistry::from(*document)->eventHandlerCount(EventHandlerRegistry::TouchEvent);
}
static RenderLayer* findRenderLayerForGraphicsLayer(RenderLayer* searchRoot, GraphicsLayer* graphicsLayer, String* layerType)

Powered by Google App Engine
This is Rietveld 408576698