| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/frame/EventHandlerRegistry.h" | 5 #include "core/frame/EventHandlerRegistry.h" |
| 6 | 6 |
| 7 #include "core/events/EventListenerOptions.h" | 7 #include "core/events/EventListenerOptions.h" |
| 8 #include "core/events/EventUtil.h" |
| 8 #include "core/frame/LocalDOMWindow.h" | 9 #include "core/frame/LocalDOMWindow.h" |
| 9 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| 10 #include "core/html/HTMLFrameOwnerElement.h" | 11 #include "core/html/HTMLFrameOwnerElement.h" |
| 11 #include "core/page/ChromeClient.h" | 12 #include "core/page/ChromeClient.h" |
| 12 #include "core/page/Page.h" | 13 #include "core/page/Page.h" |
| 13 #include "core/page/scrolling/ScrollingCoordinator.h" | 14 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 inline bool isPointerEventType(const AtomicString& eventType) | |
| 20 { | |
| 21 return eventType == EventTypeNames::gotpointercapture | |
| 22 || eventType == EventTypeNames::lostpointercapture | |
| 23 || eventType == EventTypeNames::pointercancel | |
| 24 || eventType == EventTypeNames::pointerdown | |
| 25 || eventType == EventTypeNames::pointerenter | |
| 26 || eventType == EventTypeNames::pointerleave | |
| 27 || eventType == EventTypeNames::pointermove | |
| 28 || eventType == EventTypeNames::pointerout | |
| 29 || eventType == EventTypeNames::pointerover | |
| 30 || eventType == EventTypeNames::pointerup; | |
| 31 } | |
| 32 | |
| 33 WebEventListenerProperties webEventListenerProperties(bool hasBlocking, bool has
Passive) | 20 WebEventListenerProperties webEventListenerProperties(bool hasBlocking, bool has
Passive) |
| 34 { | 21 { |
| 35 if (hasBlocking && hasPassive) | 22 if (hasBlocking && hasPassive) |
| 36 return WebEventListenerProperties::BlockingAndPassive; | 23 return WebEventListenerProperties::BlockingAndPassive; |
| 37 if (hasBlocking) | 24 if (hasBlocking) |
| 38 return WebEventListenerProperties::Blocking; | 25 return WebEventListenerProperties::Blocking; |
| 39 if (hasPassive) | 26 if (hasPassive) |
| 40 return WebEventListenerProperties::Passive; | 27 return WebEventListenerProperties::Passive; |
| 41 return WebEventListenerProperties::Nothing; | 28 return WebEventListenerProperties::Nothing; |
| 42 } | 29 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 56 bool EventHandlerRegistry::eventTypeToClass(const AtomicString& eventType, const
AddEventListenerOptions& options, EventHandlerClass* result) | 43 bool EventHandlerRegistry::eventTypeToClass(const AtomicString& eventType, const
AddEventListenerOptions& options, EventHandlerClass* result) |
| 57 { | 44 { |
| 58 if (eventType == EventTypeNames::scroll) { | 45 if (eventType == EventTypeNames::scroll) { |
| 59 *result = ScrollEvent; | 46 *result = ScrollEvent; |
| 60 } else if (eventType == EventTypeNames::wheel || eventType == EventTypeNames
::mousewheel) { | 47 } else if (eventType == EventTypeNames::wheel || eventType == EventTypeNames
::mousewheel) { |
| 61 *result = options.passive() ? WheelEventPassive : WheelEventBlocking; | 48 *result = options.passive() ? WheelEventPassive : WheelEventBlocking; |
| 62 } else if (eventType == EventTypeNames::touchend || eventType == EventTypeNa
mes::touchcancel) { | 49 } else if (eventType == EventTypeNames::touchend || eventType == EventTypeNa
mes::touchcancel) { |
| 63 *result = options.passive() ? TouchEndOrCancelEventPassive : TouchEndOrC
ancelEventBlocking; | 50 *result = options.passive() ? TouchEndOrCancelEventPassive : TouchEndOrC
ancelEventBlocking; |
| 64 } else if (eventType == EventTypeNames::touchstart || eventType == EventType
Names::touchmove) { | 51 } else if (eventType == EventTypeNames::touchstart || eventType == EventType
Names::touchmove) { |
| 65 *result = options.passive() ? TouchStartOrMoveEventPassive : TouchStartO
rMoveEventBlocking; | 52 *result = options.passive() ? TouchStartOrMoveEventPassive : TouchStartO
rMoveEventBlocking; |
| 66 } else if (isPointerEventType(eventType)) { | 53 } else if (EventUtil::isPointerEventType(eventType)) { |
| 67 // The EventHandlerClass is TouchStartOrMoveEventPassive since | 54 // The EventHandlerClass is TouchStartOrMoveEventPassive since |
| 68 // the pointer events never block scrolling and the compositor | 55 // the pointer events never block scrolling and the compositor |
| 69 // only needs to know about the touch listeners. | 56 // only needs to know about the touch listeners. |
| 70 *result = TouchStartOrMoveEventPassive; | 57 *result = TouchStartOrMoveEventPassive; |
| 71 #if ENABLE(ASSERT) | 58 #if ENABLE(ASSERT) |
| 72 } else if (eventType == EventTypeNames::load || eventType == EventTypeNames:
:mousemove || eventType == EventTypeNames::touchstart) { | 59 } else if (eventType == EventTypeNames::load || eventType == EventTypeNames:
:mousemove || eventType == EventTypeNames::touchstart) { |
| 73 *result = EventsForTesting; | 60 *result = EventsForTesting; |
| 74 #endif | 61 #endif |
| 75 } else { | 62 } else { |
| 76 return false; | 63 return false; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 ASSERT(window->frame()); | 295 ASSERT(window->frame()); |
| 309 ASSERT(window->frame()->host()); | 296 ASSERT(window->frame()->host()); |
| 310 ASSERT(window->frame()->host() == m_frameHost); | 297 ASSERT(window->frame()->host() == m_frameHost); |
| 311 } | 298 } |
| 312 } | 299 } |
| 313 } | 300 } |
| 314 #endif // ENABLE(ASSERT) | 301 #endif // ENABLE(ASSERT) |
| 315 } | 302 } |
| 316 | 303 |
| 317 } // namespace blink | 304 } // namespace blink |
| OLD | NEW |