Chromium Code Reviews| 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..d0f0a453dd7b2919cbef70da7cc33220dba3aa23 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,7 +59,9 @@ 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)) { |
| + } else if (eventType == EventTypeNames::touchend || eventType == EventTypeNames::touchcancel) { |
| + *result = options.passive() ? TouchEndOrCancelEventPassive : TouchEndOrCancelEventBlocking; |
| + } else if (eventType == EventTypeNames::touchstart || eventType == EventTypeNames::touchmove) { |
| *result = options.passive() ? TouchEventPassive : TouchEventBlocking; |
| } else if (isPointerEventType(eventType)) { |
| // The EventHandlerClass is TouchEventPassive since the pointer events |
| @@ -213,7 +207,7 @@ void EventHandlerRegistry::notifyHasHandlersChanged(EventHandlerClass handlerCla |
| { |
| switch (handlerClass) { |
| case ScrollEvent: |
| - m_frameHost->chromeClient().setHaveScrollEventHandlers(hasActiveHandlers); |
| + m_frameHost->chromeClient().setHasScrollEventHandlers(hasActiveHandlers); |
| break; |
| case WheelEventBlocking: |
| case WheelEventPassive: |
| @@ -222,6 +216,12 @@ void EventHandlerRegistry::notifyHasHandlersChanged(EventHandlerClass handlerCla |
| case TouchEventBlocking: |
| case TouchEventPassive: |
| m_frameHost->chromeClient().setEventListenerProperties(WebEventListenerClass::Touch, webEventListenerProperties(hasEventHandlers(TouchEventBlocking), hasEventHandlers(TouchEventPassive))); |
| + updateHasTouchEventListeners(); |
| + break; |
| + case TouchEndOrCancelEventBlocking: |
| + case TouchEndOrCancelEventPassive: |
| + m_frameHost->chromeClient().setEventListenerProperties(WebEventListenerClass::TouchEndOrCancel, webEventListenerProperties(hasEventHandlers(TouchEndOrCancelEventBlocking), hasEventHandlers(TouchEndOrCancelEventPassive))); |
| + updateHasTouchEventListeners(); |
| break; |
| #if ENABLE(ASSERT) |
| case EventsForTesting: |
| @@ -233,6 +233,11 @@ void EventHandlerRegistry::notifyHasHandlersChanged(EventHandlerClass handlerCla |
| } |
| } |
| +void EventHandlerRegistry::updateHasTouchEventListeners() |
|
Rick Byers
2016/04/14 01:41:40
Why put this logic here instead of ChromeClientImp
dtapuska
2016/04/14 01:49:10
There are only two callers to the setEventListener
|
| +{ |
| + m_frameHost->chromeClient().setHasTouchEventListeners(hasEventHandlers(TouchEventBlocking) || hasEventHandlers(TouchEventPassive) || hasEventHandlers(TouchEndOrCancelEventBlocking) || hasEventHandlers(TouchEndOrCancelEventPassive)); |
| +} |
| + |
| void EventHandlerRegistry::notifyDidAddOrRemoveEventHandlerTarget(EventHandlerClass handlerClass) |
| { |
| ScrollingCoordinator* scrollingCoordinator = m_frameHost->page().scrollingCoordinator(); |