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

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

Issue 1829743003: Fix missing fields in GestureScrollBegin/Update/End event conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tdresser's comments in patch set 1 Created 4 years, 9 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
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 20 matching lines...) Expand all
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; 38 float velocityX = 0;
39 float velocityY = 0; 39 float velocityY = 0;
40 bool inertial = false; 40 bool inertial = false;
41 bool synthetic = false;
42 ScrollGranularity deltaUnits = ScrollGranularity::ScrollByPrecisePixel;
41 43
42 GestureSource source = GestureSourceUninitialized; 44 GestureSource source = GestureSourceUninitialized;
43 switch (event.source()) { 45 switch (event.source()) {
44 case PlatformGestureSourceTouchpad: 46 case PlatformGestureSourceTouchpad:
45 source = GestureSourceTouchpad; 47 source = GestureSourceTouchpad;
46 break; 48 break;
47 case PlatformGestureSourceTouchscreen: 49 case PlatformGestureSourceTouchscreen:
48 source = GestureSourceTouchscreen; 50 source = GestureSourceTouchscreen;
49 break; 51 break;
50 default: 52 default:
51 ASSERT_NOT_REACHED(); 53 ASSERT_NOT_REACHED();
52 } 54 }
53 55
54 switch (event.type()) { 56 switch (event.type()) {
55 case PlatformEvent::GestureScrollBegin: 57 case PlatformEvent::GestureScrollBegin:
56 eventType = EventTypeNames::gesturescrollstart; break; 58 eventType = EventTypeNames::gesturescrollstart;
59 synthetic = event.synthetic();
60 deltaUnits = event.deltaUnits();
61 inertial = event.inertial();
62 break;
57 case PlatformEvent::GestureScrollEnd: 63 case PlatformEvent::GestureScrollEnd:
58 eventType = EventTypeNames::gesturescrollend; break; 64 eventType = EventTypeNames::gesturescrollend;
65 synthetic = event.synthetic();
66 deltaUnits = event.deltaUnits();
67 inertial = event.inertial();
68 break;
59 case PlatformEvent::GestureScrollUpdate: 69 case PlatformEvent::GestureScrollUpdate:
60 // Only deltaX/Y are used when converting this 70 // Only deltaX/Y are used when converting this
61 // back to a PlatformGestureEvent. 71 // back to a PlatformGestureEvent.
62 eventType = EventTypeNames::gesturescrollupdate; 72 eventType = EventTypeNames::gesturescrollupdate;
63 deltaX = event.deltaX(); 73 deltaX = event.deltaX();
64 deltaY = event.deltaY(); 74 deltaY = event.deltaY();
65 inertial = event.inertial(); 75 inertial = event.inertial();
76 deltaUnits = event.deltaUnits();
66 break; 77 break;
67 case PlatformEvent::GestureTap: 78 case PlatformEvent::GestureTap:
68 eventType = EventTypeNames::gesturetap; break; 79 eventType = EventTypeNames::gesturetap; break;
69 case PlatformEvent::GestureTapUnconfirmed: 80 case PlatformEvent::GestureTapUnconfirmed:
70 eventType = EventTypeNames::gesturetapunconfirmed; break; 81 eventType = EventTypeNames::gesturetapunconfirmed; break;
71 case PlatformEvent::GestureTapDown: 82 case PlatformEvent::GestureTapDown:
72 eventType = EventTypeNames::gesturetapdown; break; 83 eventType = EventTypeNames::gesturetapdown; break;
73 case PlatformEvent::GestureShowPress: 84 case PlatformEvent::GestureShowPress:
74 eventType = EventTypeNames::gestureshowpress; break; 85 eventType = EventTypeNames::gestureshowpress; break;
75 case PlatformEvent::GestureLongPress: 86 case PlatformEvent::GestureLongPress:
76 eventType = EventTypeNames::gesturelongpress; break; 87 eventType = EventTypeNames::gesturelongpress; break;
77 case PlatformEvent::GestureFlingStart: 88 case PlatformEvent::GestureFlingStart:
78 eventType = EventTypeNames::gestureflingstart; 89 eventType = EventTypeNames::gestureflingstart;
79 velocityX = event.velocityX(); 90 velocityX = event.velocityX();
80 velocityY = event.velocityY(); 91 velocityY = event.velocityY();
81 break; 92 break;
82 case PlatformEvent::GestureTwoFingerTap: 93 case PlatformEvent::GestureTwoFingerTap:
83 case PlatformEvent::GesturePinchBegin: 94 case PlatformEvent::GesturePinchBegin:
84 case PlatformEvent::GesturePinchEnd: 95 case PlatformEvent::GesturePinchEnd:
85 case PlatformEvent::GesturePinchUpdate: 96 case PlatformEvent::GesturePinchUpdate:
86 case PlatformEvent::GestureTapDownCancel: 97 case PlatformEvent::GestureTapDownCancel:
87 default: 98 default:
88 return nullptr; 99 return nullptr;
89 } 100 }
90 return adoptRefWillBeNoop(new GestureEvent(eventType, view, event.globalPosi tion().x(), event.globalPosition().y(), event.position().x(), event.position().y (), event.getModifiers(), deltaX, deltaY, velocityX, velocityY, inertial, event. timestamp(), event.resendingPluginId(), source)); 101 return adoptRefWillBeNoop(new GestureEvent(eventType, view, event.globalPosi tion().x(), event.globalPosition().y(), event.position().x(), event.position().y (), event.getModifiers(), deltaX, deltaY, velocityX, velocityY, inertial, synthe tic, deltaUnits, event.timestamp(), event.resendingPluginId(), source));
91 } 102 }
92 103
93 const AtomicString& GestureEvent::interfaceName() const 104 const AtomicString& GestureEvent::interfaceName() const
94 { 105 {
95 // FIXME: when a GestureEvent.idl interface is defined, return the string "G estureEvent". 106 // FIXME: when a GestureEvent.idl interface is defined, return the string "G estureEvent".
96 // Until that happens, do not advertise an interface that does not exist, si nce it will 107 // Until that happens, do not advertise an interface that does not exist, si nce it will
97 // trip up the bindings integrity checks. 108 // trip up the bindings integrity checks.
98 return UIEvent::interfaceName(); 109 return UIEvent::interfaceName();
99 } 110 }
100 111
101 bool GestureEvent::isGestureEvent() const 112 bool GestureEvent::isGestureEvent() const
102 { 113 {
103 return true; 114 return true;
104 } 115 }
105 116
106 GestureEvent::GestureEvent() 117 GestureEvent::GestureEvent()
107 : m_deltaX(0) 118 : m_deltaX(0)
108 , m_deltaY(0) 119 , m_deltaY(0)
109 , m_velocityX(0) 120 , m_velocityX(0)
110 , m_velocityY(0) 121 , m_velocityY(0)
111 , m_inertial(false) 122 , m_inertial(false)
123 , m_synthetic(false)
124 , m_deltaUnits(ScrollGranularity::ScrollByPrecisePixel)
112 , m_source(GestureSourceUninitialized) 125 , m_source(GestureSourceUninitialized)
113 , m_resendingPluginId(-1) 126 , m_resendingPluginId(-1)
114 { 127 {
115 } 128 }
116 129
117 GestureEvent::GestureEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<Abst ractView> view, int screenX, int screenY, int clientX, int clientY, PlatformEven t::Modifiers modifiers, float deltaX, float deltaY, float velocityX, float veloc ityY, bool inertial, double platformTimeStamp, int resendingPluginId, GestureSou rce source) 130 GestureEvent::GestureEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<Abst ractView> view, int screenX, int screenY, int clientX, int clientY, PlatformEven t::Modifiers modifiers, float deltaX, float deltaY, float velocityX, float veloc ityY, bool inertial, bool synthetic, ScrollGranularity deltaUnits, double platfo rmTimeStamp, int resendingPluginId, GestureSource source)
118 : MouseRelatedEvent(type, true, true, nullptr, view, 0, IntPoint(screenX, sc reenY), IntPoint(clientX, clientY), IntPoint(0, 0), modifiers, platformTimeStamp , PositionType::Position) 131 : MouseRelatedEvent(type, true, true, nullptr, view, 0, IntPoint(screenX, sc reenY), IntPoint(clientX, clientY), IntPoint(0, 0), modifiers, platformTimeStamp , PositionType::Position)
119 , m_deltaX(deltaX) 132 , m_deltaX(deltaX)
120 , m_deltaY(deltaY) 133 , m_deltaY(deltaY)
121 , m_velocityX(velocityX) 134 , m_velocityX(velocityX)
122 , m_velocityY(velocityY) 135 , m_velocityY(velocityY)
123 , m_inertial(inertial) 136 , m_inertial(inertial)
137 , m_synthetic(synthetic)
138 , m_deltaUnits(deltaUnits)
124 , m_source(source) 139 , m_source(source)
125 , m_resendingPluginId(resendingPluginId) 140 , m_resendingPluginId(resendingPluginId)
126 { 141 {
127 } 142 }
128 143
129 DEFINE_TRACE(GestureEvent) 144 DEFINE_TRACE(GestureEvent)
130 { 145 {
131 MouseRelatedEvent::trace(visitor); 146 MouseRelatedEvent::trace(visitor);
132 } 147 }
133 148
134 } // namespace blink 149 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/GestureEvent.h ('k') | third_party/WebKit/Source/platform/PlatformGestureEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698