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 "config.h" | 5 #include "config.h" |
6 #include "core/frame/EventHandlerRegistry.h" | 6 #include "core/frame/EventHandlerRegistry.h" |
7 | 7 |
8 #include "core/frame/LocalDOMWindow.h" | 8 #include "core/frame/LocalDOMWindow.h" |
9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
10 #include "core/html/HTMLFrameOwnerElement.h" | 10 #include "core/html/HTMLFrameOwnerElement.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 { | 49 { |
50 checkConsistency(); | 50 checkConsistency(); |
51 } | 51 } |
52 | 52 |
53 bool EventHandlerRegistry::eventTypeToClass(const AtomicString& eventType, Event
HandlerClass* result) | 53 bool EventHandlerRegistry::eventTypeToClass(const AtomicString& eventType, Event
HandlerClass* result) |
54 { | 54 { |
55 if (eventType == EventTypeNames::scroll) { | 55 if (eventType == EventTypeNames::scroll) { |
56 *result = ScrollEvent; | 56 *result = ScrollEvent; |
57 } else if (eventType == EventTypeNames::wheel || eventType == EventTypeNames
::mousewheel) { | 57 } else if (eventType == EventTypeNames::wheel || eventType == EventTypeNames
::mousewheel) { |
58 *result = WheelEvent; | 58 *result = WheelEvent; |
| 59 } else if (eventType == EventTypeNames::touchmove || eventType == EventTypeN
ames::pointermove) { |
| 60 *result = TouchMoveEvent; |
59 } else if (isTouchEventType(eventType)) { | 61 } else if (isTouchEventType(eventType)) { |
60 *result = TouchEvent; | 62 *result = TouchEvent; |
61 } else if (isPointerEventType(eventType)) { | 63 } else if (isPointerEventType(eventType)) { |
62 // The EventHandlerClass is still TouchEvent below since we are firing P
ointerEvents only from | 64 // The EventHandlerClass is still TouchEvent below since we are firing P
ointerEvents only from |
63 // EventHandler::handleTouchEvent for now. See crbug.com/476565. | 65 // EventHandler::handleTouchEvent for now. See crbug.com/476565. |
64 *result = TouchEvent; | 66 *result = TouchEvent; |
65 #if ENABLE(ASSERT) | 67 #if ENABLE(ASSERT) |
66 } else if (eventType == EventTypeNames::load || eventType == EventTypeNames:
:mousemove || eventType == EventTypeNames::touchstart) { | 68 } else if (eventType == EventTypeNames::load || eventType == EventTypeNames:
:mousemove || eventType == EventTypeNames::touchstart) { |
67 *result = EventsForTesting; | 69 *result = EventsForTesting; |
68 #endif | 70 #endif |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 if (scrollingCoordinator) | 205 if (scrollingCoordinator) |
204 scrollingCoordinator->updateHaveScrollEventHandlers(); | 206 scrollingCoordinator->updateHaveScrollEventHandlers(); |
205 break; | 207 break; |
206 case WheelEvent: | 208 case WheelEvent: |
207 if (scrollingCoordinator) | 209 if (scrollingCoordinator) |
208 scrollingCoordinator->updateHaveWheelEventHandlers(); | 210 scrollingCoordinator->updateHaveWheelEventHandlers(); |
209 break; | 211 break; |
210 case TouchEvent: | 212 case TouchEvent: |
211 m_frameHost->chromeClient().needTouchEvents(hasActiveHandlers); | 213 m_frameHost->chromeClient().needTouchEvents(hasActiveHandlers); |
212 break; | 214 break; |
| 215 case TouchMoveEvent: |
| 216 m_frameHost->chromeClient().needTouchMoveEvents(hasActiveHandlers); |
| 217 break; |
213 #if ENABLE(ASSERT) | 218 #if ENABLE(ASSERT) |
214 case EventsForTesting: | 219 case EventsForTesting: |
215 break; | 220 break; |
216 #endif | 221 #endif |
217 default: | 222 default: |
218 ASSERT_NOT_REACHED(); | 223 ASSERT_NOT_REACHED(); |
219 break; | 224 break; |
220 } | 225 } |
221 } | 226 } |
222 | 227 |
223 void EventHandlerRegistry::notifyDidAddOrRemoveEventHandlerTarget(EventHandlerCl
ass handlerClass) | 228 void EventHandlerRegistry::notifyDidAddOrRemoveEventHandlerTarget(EventHandlerCl
ass handlerClass) |
224 { | 229 { |
225 ScrollingCoordinator* scrollingCoordinator = m_frameHost->page().scrollingCo
ordinator(); | 230 ScrollingCoordinator* scrollingCoordinator = m_frameHost->page().scrollingCo
ordinator(); |
226 if (scrollingCoordinator && handlerClass == TouchEvent) | 231 if (scrollingCoordinator && (handlerClass == TouchEvent || handlerClass == T
ouchMoveEvent)) |
227 scrollingCoordinator->touchEventTargetRectsDidChange(); | 232 scrollingCoordinator->touchEventTargetRectsDidChange(); |
228 } | 233 } |
229 | 234 |
230 DEFINE_TRACE(EventHandlerRegistry) | 235 DEFINE_TRACE(EventHandlerRegistry) |
231 { | 236 { |
232 visitor->trace(m_frameHost); | 237 visitor->trace(m_frameHost); |
233 visitor->template registerWeakMembers<EventHandlerRegistry, &EventHandlerReg
istry::clearWeakMembers>(this); | 238 visitor->template registerWeakMembers<EventHandlerRegistry, &EventHandlerReg
istry::clearWeakMembers>(this); |
234 } | 239 } |
235 | 240 |
236 void EventHandlerRegistry::clearWeakMembers(Visitor* visitor) | 241 void EventHandlerRegistry::clearWeakMembers(Visitor* visitor) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 ASSERT(window->frame()); | 302 ASSERT(window->frame()); |
298 ASSERT(window->frame()->host()); | 303 ASSERT(window->frame()->host()); |
299 ASSERT(window->frame()->host() == m_frameHost); | 304 ASSERT(window->frame()->host() == m_frameHost); |
300 } | 305 } |
301 } | 306 } |
302 } | 307 } |
303 #endif // ENABLE(ASSERT) | 308 #endif // ENABLE(ASSERT) |
304 } | 309 } |
305 | 310 |
306 } // namespace blink | 311 } // namespace blink |
OLD | NEW |