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

Side by Side Diff: Source/core/events/GestureEvent.cpp

Issue 1308313005: Modify gesture event types for WebView-tag scroll bubbling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add comment to explain |resendingPluginId|. Created 5 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/events/GestureEvent.h ('k') | Source/core/events/WheelEvent.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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 17 matching lines...) Expand all
28 #include "core/events/GestureEvent.h" 28 #include "core/events/GestureEvent.h"
29 #include "wtf/text/AtomicString.h" 29 #include "wtf/text/AtomicString.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 PassRefPtrWillBeRawPtr<GestureEvent> GestureEvent::create(PassRefPtrWillBeRawPtr <AbstractView> view, const PlatformGestureEvent& event) 33 PassRefPtrWillBeRawPtr<GestureEvent> GestureEvent::create(PassRefPtrWillBeRawPtr <AbstractView> view, const PlatformGestureEvent& event)
34 { 34 {
35 AtomicString eventType; 35 AtomicString eventType;
36 float deltaX = 0; 36 float deltaX = 0;
37 float deltaY = 0; 37 float deltaY = 0;
38 float velocityX = 0;
39 float velocityY = 0;
40 bool inertial = false;
38 switch (event.type()) { 41 switch (event.type()) {
39 case PlatformEvent::GestureScrollBegin: 42 case PlatformEvent::GestureScrollBegin:
40 eventType = EventTypeNames::gesturescrollstart; break; 43 eventType = EventTypeNames::gesturescrollstart; break;
41 case PlatformEvent::GestureScrollEnd: 44 case PlatformEvent::GestureScrollEnd:
42 eventType = EventTypeNames::gesturescrollend; break; 45 eventType = EventTypeNames::gesturescrollend; break;
43 case PlatformEvent::GestureScrollUpdate: 46 case PlatformEvent::GestureScrollUpdate:
44 // Only deltaX/Y are used when converting this 47 // Only deltaX/Y are used when converting this
45 // back to a PlatformGestureEvent. 48 // back to a PlatformGestureEvent.
46 eventType = EventTypeNames::gesturescrollupdate; 49 eventType = EventTypeNames::gesturescrollupdate;
47 deltaX = event.deltaX(); 50 deltaX = event.deltaX();
48 deltaY = event.deltaY(); 51 deltaY = event.deltaY();
52 inertial = event.inertial();
49 break; 53 break;
50 case PlatformEvent::GestureTap: 54 case PlatformEvent::GestureTap:
51 eventType = EventTypeNames::gesturetap; break; 55 eventType = EventTypeNames::gesturetap; break;
52 case PlatformEvent::GestureTapUnconfirmed: 56 case PlatformEvent::GestureTapUnconfirmed:
53 eventType = EventTypeNames::gesturetapunconfirmed; break; 57 eventType = EventTypeNames::gesturetapunconfirmed; break;
54 case PlatformEvent::GestureTapDown: 58 case PlatformEvent::GestureTapDown:
55 eventType = EventTypeNames::gesturetapdown; break; 59 eventType = EventTypeNames::gesturetapdown; break;
56 case PlatformEvent::GestureShowPress: 60 case PlatformEvent::GestureShowPress:
57 eventType = EventTypeNames::gestureshowpress; break; 61 eventType = EventTypeNames::gestureshowpress; break;
58 case PlatformEvent::GestureLongPress: 62 case PlatformEvent::GestureLongPress:
59 eventType = EventTypeNames::gesturelongpress; break; 63 eventType = EventTypeNames::gesturelongpress; break;
64 case PlatformEvent::GestureFlingStart:
65 eventType = EventTypeNames::gestureflingstart;
66 velocityX = event.velocityX();
67 velocityY = event.velocityY();
68 break;
60 case PlatformEvent::GestureTwoFingerTap: 69 case PlatformEvent::GestureTwoFingerTap:
61 case PlatformEvent::GesturePinchBegin: 70 case PlatformEvent::GesturePinchBegin:
62 case PlatformEvent::GesturePinchEnd: 71 case PlatformEvent::GesturePinchEnd:
63 case PlatformEvent::GesturePinchUpdate: 72 case PlatformEvent::GesturePinchUpdate:
64 case PlatformEvent::GestureTapDownCancel: 73 case PlatformEvent::GestureTapDownCancel:
65 default: 74 default:
66 return nullptr; 75 return nullptr;
67 } 76 }
68 return adoptRefWillBeNoop(new GestureEvent(eventType, view, event.globalPosi tion().x(), event.globalPosition().y(), event.position().x(), event.position().y (), event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), deltaX, deltaY, event.timestamp())); 77 return adoptRefWillBeNoop(new GestureEvent(eventType, view, event.globalPosi tion().x(), event.globalPosition().y(), event.position().x(), event.position().y (), event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(), deltaX, deltaY, velocityX, velocityY, inertial, event.timestamp(), event.resendingPlugin Id()));
69 } 78 }
70 79
71 const AtomicString& GestureEvent::interfaceName() const 80 const AtomicString& GestureEvent::interfaceName() const
72 { 81 {
73 // FIXME: when a GestureEvent.idl interface is defined, return the string "G estureEvent". 82 // FIXME: when a GestureEvent.idl interface is defined, return the string "G estureEvent".
74 // Until that happens, do not advertise an interface that does not exist, si nce it will 83 // Until that happens, do not advertise an interface that does not exist, si nce it will
75 // trip up the bindings integrity checks. 84 // trip up the bindings integrity checks.
76 return UIEvent::interfaceName(); 85 return UIEvent::interfaceName();
77 } 86 }
78 87
79 bool GestureEvent::isGestureEvent() const 88 bool GestureEvent::isGestureEvent() const
80 { 89 {
81 return true; 90 return true;
82 } 91 }
83 92
84 GestureEvent::GestureEvent() 93 GestureEvent::GestureEvent()
85 : m_deltaX(0) 94 : m_deltaX(0)
86 , m_deltaY(0) 95 , m_deltaY(0)
96 , m_velocityX(0)
97 , m_velocityY(0)
98 , m_inertial(false)
99 , m_resendingPluginId(-1)
87 { 100 {
88 } 101 }
89 102
90 GestureEvent::GestureEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<Abst ractView> view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey , bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY, double u iTimestamp) 103 GestureEvent::GestureEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<Abst ractView> view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey , bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY, float ve locityX, float velocityY, bool inertial, double uiTimestamp, int resendingPlugin Id)
91 : MouseRelatedEvent(type, true, true, view, 0, IntPoint(screenX, screenY), I ntPoint(clientX, clientY), IntPoint(0, 0), ctrlKey, altKey, shiftKey, metaKey, P ositionType::Position) 104 : MouseRelatedEvent(type, true, true, view, 0, IntPoint(screenX, screenY), I ntPoint(clientX, clientY), IntPoint(0, 0), ctrlKey, altKey, shiftKey, metaKey, P ositionType::Position)
92 , m_deltaX(deltaX) 105 , m_deltaX(deltaX)
93 , m_deltaY(deltaY) 106 , m_deltaY(deltaY)
107 , m_velocityX(velocityX)
108 , m_velocityY(velocityY)
109 , m_inertial(inertial)
110 , m_resendingPluginId(resendingPluginId)
94 { 111 {
95 setUICreateTime(uiTimestamp); 112 setUICreateTime(uiTimestamp);
96 } 113 }
97 114
98 PassRefPtrWillBeRawPtr<EventDispatchMediator> GestureEvent::createMediator() 115 PassRefPtrWillBeRawPtr<EventDispatchMediator> GestureEvent::createMediator()
99 { 116 {
100 return GestureEventDispatchMediator::create(this); 117 return GestureEventDispatchMediator::create(this);
101 } 118 }
102 119
103 DEFINE_TRACE(GestureEvent) 120 DEFINE_TRACE(GestureEvent)
(...skipping 12 matching lines...) Expand all
116 } 133 }
117 134
118 bool GestureEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) co nst 135 bool GestureEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) co nst
119 { 136 {
120 dispatcher.dispatch(); 137 dispatcher.dispatch();
121 ASSERT(!event().defaultPrevented()); 138 ASSERT(!event().defaultPrevented());
122 return event().defaultHandled() || event().defaultPrevented(); 139 return event().defaultHandled() || event().defaultPrevented();
123 } 140 }
124 141
125 } // namespace blink 142 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/events/GestureEvent.h ('k') | Source/core/events/WheelEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698