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

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

Issue 1218663006: Use new WebTouchPoint field names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 touchesLength = point; 168 touchesLength = point;
169 type = WebInputEvent::Undefined; 169 type = WebInputEvent::Undefined;
170 causesScrollingIfUncanceled = false; 170 causesScrollingIfUncanceled = false;
171 uniqueTouchEventId = ui::GetNextTouchEventId(); 171 uniqueTouchEventId = ui::GetNextTouchEventId();
172 } 172 }
173 173
174 int SyntheticWebTouchEvent::PressPoint(float x, float y) { 174 int SyntheticWebTouchEvent::PressPoint(float x, float y) {
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.pointerId = 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.width = point.height = 1.f;
183 point.rotationAngle = 1.f; 183 point.rotationAngle = 1.f;
184 point.force = 1.f; 184 point.pressure = 1.f;
185 ++touchesLength; 185 ++touchesLength;
186 WebTouchEventTraits::ResetType( 186 WebTouchEventTraits::ResetType(
187 WebInputEvent::TouchStart, timeStampSeconds, this); 187 WebInputEvent::TouchStart, timeStampSeconds, this);
188 return point.id; 188 return point.pointerId;
189 } 189 }
190 190
191 void SyntheticWebTouchEvent::MovePoint(int index, float x, float y) { 191 void SyntheticWebTouchEvent::MovePoint(int index, float x, float y) {
192 CHECK_GE(index, 0); 192 CHECK_GE(index, 0);
193 CHECK_LT(index, touchesLengthCap); 193 CHECK_LT(index, touchesLengthCap);
194 // Always set this bit to avoid otherwise unexpected touchmove suppression. 194 // Always set this bit to avoid otherwise unexpected touchmove suppression.
195 // The caller can opt-out explicitly, if necessary. 195 // The caller can opt-out explicitly, if necessary.
196 causesScrollingIfUncanceled = true; 196 causesScrollingIfUncanceled = true;
197 WebTouchPoint& point = touches[index]; 197 WebTouchPoint& point = touches[index];
198 point.position.x = point.screenPosition.x = x; 198 point.position.x = point.screenPosition.x = x;
(...skipping 17 matching lines...) Expand all
216 touches[index].state = WebTouchPoint::StateCancelled; 216 touches[index].state = WebTouchPoint::StateCancelled;
217 WebTouchEventTraits::ResetType( 217 WebTouchEventTraits::ResetType(
218 WebInputEvent::TouchCancel, timeStampSeconds, this); 218 WebInputEvent::TouchCancel, timeStampSeconds, this);
219 } 219 }
220 220
221 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { 221 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) {
222 timeStampSeconds = timestamp.InSecondsF(); 222 timeStampSeconds = timestamp.InSecondsF();
223 } 223 }
224 224
225 } // namespace content 225 } // namespace content
OLDNEW
« no previous file with comments | « content/common/input/input_param_traits_unittest.cc ('k') | content/common/input/touch_event_stream_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698