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

Unified Diff: third_party/WebKit/Source/core/input/PointerEventManager.cpp

Issue 2916893003: Bookkeep the pointer event listeners added to page (Closed)
Patch Set: fix rebase error Created 3 years, 6 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: third_party/WebKit/Source/core/input/PointerEventManager.cpp
diff --git a/third_party/WebKit/Source/core/input/PointerEventManager.cpp b/third_party/WebKit/Source/core/input/PointerEventManager.cpp
index 5fa4ebd155681c1366870b4e749c3a9fcfc4cce4..2a2c776babdd4e1848a40cdbf7cb69305496cff6 100644
--- a/third_party/WebKit/Source/core/input/PointerEventManager.cpp
+++ b/third_party/WebKit/Source/core/input/PointerEventManager.cpp
@@ -8,6 +8,7 @@
#include "core/dom/UserGestureIndicator.h"
#include "core/dom/shadow/FlatTreeTraversal.h"
#include "core/events/MouseEvent.h"
+#include "core/frame/EventHandlerRegistry.h"
#include "core/frame/LocalFrameView.h"
#include "core/frame/UseCounter.h"
#include "core/html/HTMLCanvasElement.h"
@@ -28,6 +29,9 @@ namespace {
size_t ToPointerTypeIndex(WebPointerProperties::PointerType t) {
return static_cast<size_t>(t);
}
+bool HasPointerEventListener(const EventHandlerRegistry& registry) {
+ return registry.HasEventHandlers(EventHandlerRegistry::kPointerEvent);
+}
Vector<std::pair<WebTouchPoint, TimeTicks>> GetCoalescedPoints(
const Vector<WebTouchEvent>& coalesced_events,
@@ -159,8 +163,11 @@ WebInputEventResult PointerEventManager::DispatchPointerEvent(
}
}
- if (!RuntimeEnabledFeatures::PointerEventEnabled())
+ if (!frame_ || !frame_->GetPage() ||
+ !HasPointerEventListener(frame_->GetPage()->GetEventHandlerRegistry()) ||
+ !RuntimeEnabledFeatures::PointerEventEnabled())
return WebInputEventResult::kNotHandled;
+
if (!check_for_listener || target->HasEventListeners(event_type)) {
UseCounter::Count(frame_, UseCounter::kPointerEventDispatch);
if (event_type == EventTypeNames::pointerdown)
« no previous file with comments | « third_party/WebKit/Source/core/html/forms/SliderThumbElement.cpp ('k') | third_party/WebKit/Source/core/testing/Internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698