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

Side by Side Diff: content/browser/renderer_host/ui_events_helper.cc

Issue 755403006: Added experimental Touch.tilt, Touch.tiltDirection support for Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/ui_events_helper.h" 5 #include "content/browser/renderer_host/ui_events_helper.h"
6 6
7 #include "content/browser/renderer_host/input/web_input_event_util.h" 7 #include "content/browser/renderer_host/input/web_input_event_util.h"
8 #include "content/common/input/web_touch_event_traits.h" 8 #include "content/common/input/web_touch_event_traits.h"
9 #include "third_party/WebKit/public/web/WebInputEvent.h" 9 #include "third_party/WebKit/public/web/WebInputEvent.h"
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 else 106 else
107 location = point.screenPosition; 107 location = point.screenPosition;
108 ui::TouchEvent* uievent = new ui::TouchEvent(type, 108 ui::TouchEvent* uievent = new ui::TouchEvent(type,
109 location, 109 location,
110 flags, 110 flags,
111 point.id, 111 point.id,
112 timestamp, 112 timestamp,
113 point.radiusX, 113 point.radiusX,
114 point.radiusY, 114 point.radiusY,
115 point.rotationAngle, 115 point.rotationAngle,
116 point.tilt,
116 point.force); 117 point.force);
117 uievent->set_latency(touch_with_latency.latency); 118 uievent->set_latency(touch_with_latency.latency);
118 list->push_back(uievent); 119 list->push_back(uievent);
119 } 120 }
120 return true; 121 return true;
121 } 122 }
122 123
123 blink::WebGestureEvent MakeWebGestureEventFromUIEvent( 124 blink::WebGestureEvent MakeWebGestureEventFromUIEvent(
124 const ui::GestureEvent& event) { 125 const ui::GestureEvent& event) {
125 return CreateWebGestureEvent(event.details(), 126 return CreateWebGestureEvent(event.details(),
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 break; 162 break;
162 } 163 }
163 164
164 if (!point) 165 if (!point)
165 return NULL; 166 return NULL;
166 167
167 // The spec requires the radii values to be positive (and 1 when unknown). 168 // The spec requires the radii values to be positive (and 1 when unknown).
168 point->radiusX = std::max(1.f, event.radius_x()); 169 point->radiusX = std::max(1.f, event.radius_x());
169 point->radiusY = std::max(1.f, event.radius_y()); 170 point->radiusY = std::max(1.f, event.radius_y());
170 point->rotationAngle = event.rotation_angle(); 171 point->rotationAngle = event.rotation_angle();
172 point->tilt = event.tilt();
171 point->force = event.force(); 173 point->force = event.force();
172 174
173 // Update the location and state of the point. 175 // Update the location and state of the point.
174 point->state = TouchPointStateFromEvent(event); 176 point->state = TouchPointStateFromEvent(event);
175 point->position.x = event.x(); 177 point->position.x = event.x();
176 point->position.y = event.y(); 178 point->position.y = event.y();
177 179
178 const gfx::PointF& root_point = event.root_location_f(); 180 const gfx::PointF& root_point = event.root_location_f();
179 point->screenPosition.x = root_point.x(); 181 point->screenPosition.x = root_point.x();
180 point->screenPosition.y = root_point.y(); 182 point->screenPosition.y = root_point.y();
181 183
182 // Mark the rest of the points as stationary. 184 // Mark the rest of the points as stationary.
183 for (unsigned i = 0; i < web_event->touchesLength; ++i) { 185 for (unsigned i = 0; i < web_event->touchesLength; ++i) {
184 blink::WebTouchPoint* iter = web_event->touches + i; 186 blink::WebTouchPoint* iter = web_event->touches + i;
185 if (iter != point) 187 if (iter != point)
186 iter->state = blink::WebTouchPoint::StateStationary; 188 iter->state = blink::WebTouchPoint::StateStationary;
187 } 189 }
188 190
189 // Update the type of the touch event. 191 // Update the type of the touch event.
190 WebTouchEventTraits::ResetType(TouchEventTypeFromEvent(event), 192 WebTouchEventTraits::ResetType(TouchEventTypeFromEvent(event),
191 event.time_stamp().InSecondsF(), 193 event.time_stamp().InSecondsF(),
192 web_event); 194 web_event);
193 web_event->modifiers = EventFlagsToWebEventModifiers(event.flags()); 195 web_event->modifiers = EventFlagsToWebEventModifiers(event.flags());
194 196
195 return point; 197 return point;
196 } 198 }
197 199
198 } // namespace content 200 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698