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

Unified Diff: third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp

Issue 1895303007: Non passive touch end or touch cancel listeners should not block scroll. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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/frame/EventHandlerRegistry.cpp
diff --git a/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp b/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp
index 5bf13bd26d69f9c1677d217ecbe2cb1c9d4f9acf..952709c3fa9a53f5e172fddd83c65bd713d13e92 100644
--- a/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp
+++ b/third_party/WebKit/Source/core/frame/EventHandlerRegistry.cpp
@@ -16,14 +16,6 @@ namespace blink {
namespace {
-inline bool isTouchEventType(const AtomicString& eventType)
-{
- return eventType == EventTypeNames::touchstart
- || eventType == EventTypeNames::touchmove
- || eventType == EventTypeNames::touchend
- || eventType == EventTypeNames::touchcancel;
-}
-
inline bool isPointerEventType(const AtomicString& eventType)
{
return eventType == EventTypeNames::gotpointercapture
@@ -67,13 +59,15 @@ bool EventHandlerRegistry::eventTypeToClass(const AtomicString& eventType, const
*result = ScrollEvent;
} else if (eventType == EventTypeNames::wheel || eventType == EventTypeNames::mousewheel) {
*result = options.passive() ? WheelEventPassive : WheelEventBlocking;
- } else if (isTouchEventType(eventType)) {
- *result = options.passive() ? TouchEventPassive : TouchEventBlocking;
+ } else if (eventType == EventTypeNames::touchend || eventType == EventTypeNames::touchcancel) {
+ *result = options.passive() ? TouchEndOrCancelEventPassive : TouchEndOrCancelEventBlocking;
+ } else if (eventType == EventTypeNames::touchstart || eventType == EventTypeNames::touchmove) {
+ *result = options.passive() ? TouchStartOrMoveEventPassive : TouchStartOrMoveEventBlocking;
} else if (isPointerEventType(eventType)) {
- // The EventHandlerClass is TouchEventPassive since the pointer events
- // never block scrolling and the compositor only needs to know
- // about the touch listeners.
- *result = TouchEventPassive;
+ // The EventHandlerClass is TouchStartOrMoveEventPassive since
+ // the pointer events never block scrolling and the compositor
+ // only needs to know about the touch listeners.
+ *result = TouchStartOrMoveEventPassive;
#if ENABLE(ASSERT)
} else if (eventType == EventTypeNames::load || eventType == EventTypeNames::mousemove || eventType == EventTypeNames::touchstart) {
*result = EventsForTesting;
@@ -213,15 +207,19 @@ void EventHandlerRegistry::notifyHasHandlersChanged(EventHandlerClass handlerCla
{
switch (handlerClass) {
case ScrollEvent:
- m_frameHost->chromeClient().setHaveScrollEventHandlers(hasActiveHandlers);
+ m_frameHost->chromeClient().setHasScrollEventHandlers(hasActiveHandlers);
break;
case WheelEventBlocking:
case WheelEventPassive:
m_frameHost->chromeClient().setEventListenerProperties(WebEventListenerClass::MouseWheel, webEventListenerProperties(hasEventHandlers(WheelEventBlocking), hasEventHandlers(WheelEventPassive)));
break;
- case TouchEventBlocking:
- case TouchEventPassive:
- m_frameHost->chromeClient().setEventListenerProperties(WebEventListenerClass::Touch, webEventListenerProperties(hasEventHandlers(TouchEventBlocking), hasEventHandlers(TouchEventPassive)));
+ case TouchStartOrMoveEventBlocking:
+ case TouchStartOrMoveEventPassive:
+ m_frameHost->chromeClient().setEventListenerProperties(WebEventListenerClass::TouchStartOrMove, webEventListenerProperties(hasEventHandlers(TouchStartOrMoveEventBlocking), hasEventHandlers(TouchStartOrMoveEventPassive)));
+ break;
+ case TouchEndOrCancelEventBlocking:
+ case TouchEndOrCancelEventPassive:
+ m_frameHost->chromeClient().setEventListenerProperties(WebEventListenerClass::TouchEndOrCancel, webEventListenerProperties(hasEventHandlers(TouchEndOrCancelEventBlocking), hasEventHandlers(TouchEndOrCancelEventPassive)));
break;
#if ENABLE(ASSERT)
case EventsForTesting:
@@ -236,7 +234,7 @@ void EventHandlerRegistry::notifyHasHandlersChanged(EventHandlerClass handlerCla
void EventHandlerRegistry::notifyDidAddOrRemoveEventHandlerTarget(EventHandlerClass handlerClass)
{
ScrollingCoordinator* scrollingCoordinator = m_frameHost->page().scrollingCoordinator();
- if (scrollingCoordinator && handlerClass == TouchEventBlocking)
+ if (scrollingCoordinator && handlerClass == TouchStartOrMoveEventBlocking)
scrollingCoordinator->touchEventTargetRectsDidChange();
}
« no previous file with comments | « third_party/WebKit/Source/core/frame/EventHandlerRegistry.h ('k') | third_party/WebKit/Source/core/html/HTMLInputElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698