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

Side by Side Diff: content/common/input/synthetic_web_input_event_builders.cc

Issue 1187273004: Pass MotionEvent tilt angles to Blink on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/input/synthetic_web_input_event_builders.h" 5 #include "content/common/input/synthetic_web_input_event_builders.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/common/input/web_touch_event_traits.h" 8 #include "content/common/input/web_touch_event_traits.h"
9 #include "ui/events/base_event_utils.h" 9 #include "ui/events/base_event_utils.h"
10 #include "ui/events/keycodes/keyboard_codes.h" 10 #include "ui/events/keycodes/keyboard_codes.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 if (touchesLength == touchesLengthCap) 175 if (touchesLength == touchesLengthCap)
176 return -1; 176 return -1;
177 WebTouchPoint& point = touches[touchesLength]; 177 WebTouchPoint& point = touches[touchesLength];
178 point.id = touchesLength; 178 point.id = touchesLength;
179 point.position.x = point.screenPosition.x = x; 179 point.position.x = point.screenPosition.x = x;
180 point.position.y = point.screenPosition.y = y; 180 point.position.y = point.screenPosition.y = y;
181 point.state = WebTouchPoint::StatePressed; 181 point.state = WebTouchPoint::StatePressed;
182 point.radiusX = point.radiusY = 1.f; 182 point.radiusX = point.radiusY = 1.f;
183 point.rotationAngle = 1.f; 183 point.rotationAngle = 1.f;
184 point.force = 1.f; 184 point.force = 1.f;
185 point.tiltX = point.tiltY = 0;
185 ++touchesLength; 186 ++touchesLength;
186 WebTouchEventTraits::ResetType( 187 WebTouchEventTraits::ResetType(
187 WebInputEvent::TouchStart, timeStampSeconds, this); 188 WebInputEvent::TouchStart, timeStampSeconds, this);
188 return point.id; 189 return point.id;
189 } 190 }
190 191
191 void SyntheticWebTouchEvent::MovePoint(int index, float x, float y) { 192 void SyntheticWebTouchEvent::MovePoint(int index, float x, float y) {
192 CHECK_GE(index, 0); 193 CHECK_GE(index, 0);
193 CHECK_LT(index, touchesLengthCap); 194 CHECK_LT(index, touchesLengthCap);
194 // Always set this bit to avoid otherwise unexpected touchmove suppression. 195 // Always set this bit to avoid otherwise unexpected touchmove suppression.
(...skipping 21 matching lines...) Expand all
216 touches[index].state = WebTouchPoint::StateCancelled; 217 touches[index].state = WebTouchPoint::StateCancelled;
217 WebTouchEventTraits::ResetType( 218 WebTouchEventTraits::ResetType(
218 WebInputEvent::TouchCancel, timeStampSeconds, this); 219 WebInputEvent::TouchCancel, timeStampSeconds, this);
219 } 220 }
220 221
221 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { 222 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) {
222 timeStampSeconds = timestamp.InSecondsF(); 223 timeStampSeconds = timestamp.InSecondsF();
223 } 224 }
224 225
225 } // namespace content 226 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698