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

Side by Side Diff: Source/core/frame/EventHandlerRegistry.cpp

Issue 1144313003: Added PointerEvent firing on touch events. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased. TODO fixes. Created 5 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 unified diff | Download patch
« no previous file with comments | « Source/core/events/ThreadLocalEventNames.h ('k') | Source/core/input/EventHandler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/events/ThreadLocalEventNames.h"
9 #include "core/frame/LocalDOMWindow.h" 8 #include "core/frame/LocalDOMWindow.h"
10 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
11 #include "core/html/HTMLFrameOwnerElement.h" 10 #include "core/html/HTMLFrameOwnerElement.h"
12 #include "core/page/ChromeClient.h" 11 #include "core/page/ChromeClient.h"
13 #include "core/page/Page.h" 12 #include "core/page/Page.h"
14 #include "core/page/scrolling/ScrollingCoordinator.h" 13 #include "core/page/scrolling/ScrollingCoordinator.h"
15 14
16 namespace blink { 15 namespace blink {
17 16
17 namespace {
18
19 inline bool isTouchEventType(const AtomicString& eventType)
20 {
21 return eventType == EventTypeNames::touchstart
22 || eventType == EventTypeNames::touchmove
23 || eventType == EventTypeNames::touchend
24 || eventType == EventTypeNames::touchcancel;
25 }
26
27 inline bool isPointerEventType(const AtomicString& eventType)
28 {
29 return eventType == EventTypeNames::gotpointercapture
30 || eventType == EventTypeNames::lostpointercapture
31 || eventType == EventTypeNames::pointercancel
32 || eventType == EventTypeNames::pointerdown
33 || eventType == EventTypeNames::pointerenter
34 || eventType == EventTypeNames::pointerleave
35 || eventType == EventTypeNames::pointermove
36 || eventType == EventTypeNames::pointerout
37 || eventType == EventTypeNames::pointerover
38 || eventType == EventTypeNames::pointerup;
39 }
40
41 } // namespace
42
18 EventHandlerRegistry::EventHandlerRegistry(FrameHost& frameHost) 43 EventHandlerRegistry::EventHandlerRegistry(FrameHost& frameHost)
19 : m_frameHost(frameHost) 44 : m_frameHost(frameHost)
20 { 45 {
21 } 46 }
22 47
23 EventHandlerRegistry::~EventHandlerRegistry() 48 EventHandlerRegistry::~EventHandlerRegistry()
24 { 49 {
25 checkConsistency(); 50 checkConsistency();
26 } 51 }
27 52
28 bool EventHandlerRegistry::eventTypeToClass(const AtomicString& eventType, Event HandlerClass* result) 53 bool EventHandlerRegistry::eventTypeToClass(const AtomicString& eventType, Event HandlerClass* result)
29 { 54 {
30 if (eventType == EventTypeNames::scroll) { 55 if (eventType == EventTypeNames::scroll) {
31 *result = ScrollEvent; 56 *result = ScrollEvent;
32 } else if (eventType == EventTypeNames::wheel || eventType == EventTypeNames ::mousewheel) { 57 } else if (eventType == EventTypeNames::wheel || eventType == EventTypeNames ::mousewheel) {
33 *result = WheelEvent; 58 *result = WheelEvent;
34 } else if (isTouchEventType(eventType)) { 59 } else if (isTouchEventType(eventType)) {
35 *result = TouchEvent; 60 *result = TouchEvent;
61 } else if (isPointerEventType(eventType)) {
62 // The EventHandlerClass is still TouchEvent below since we are firing P ointerEvents only from
63 // EventHandler::handleTouchEvent for now. See crbug.com/476565.
64 *result = TouchEvent;
36 #if ENABLE(ASSERT) 65 #if ENABLE(ASSERT)
37 } else if (eventType == EventTypeNames::load || eventType == EventTypeNames: :mousemove || eventType == EventTypeNames::touchstart) { 66 } else if (eventType == EventTypeNames::load || eventType == EventTypeNames: :mousemove || eventType == EventTypeNames::touchstart) {
38 *result = EventsForTesting; 67 *result = EventsForTesting;
39 #endif 68 #endif
40 } else { 69 } else {
41 return false; 70 return false;
42 } 71 }
43 return true; 72 return true;
44 } 73 }
45 74
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 ASSERT(window->frame()); 293 ASSERT(window->frame());
265 ASSERT(window->frame()->host()); 294 ASSERT(window->frame()->host());
266 ASSERT(window->frame()->host() == &m_frameHost); 295 ASSERT(window->frame()->host() == &m_frameHost);
267 } 296 }
268 } 297 }
269 } 298 }
270 #endif // ENABLE(ASSERT) 299 #endif // ENABLE(ASSERT)
271 } 300 }
272 301
273 } // namespace blink 302 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/events/ThreadLocalEventNames.h ('k') | Source/core/input/EventHandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698