| OLD | NEW |
| 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/keycodes/keyboard_codes.h" | 9 #include "ui/events/keycodes/keyboard_codes.h" |
| 10 | 10 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 int SyntheticWebTouchEvent::PressPoint(float x, float y) { | 171 int SyntheticWebTouchEvent::PressPoint(float x, float y) { |
| 172 if (touchesLength == touchesLengthCap) | 172 if (touchesLength == touchesLengthCap) |
| 173 return -1; | 173 return -1; |
| 174 WebTouchPoint& point = touches[touchesLength]; | 174 WebTouchPoint& point = touches[touchesLength]; |
| 175 point.id = touchesLength; | 175 point.id = touchesLength; |
| 176 point.position.x = point.screenPosition.x = x; | 176 point.position.x = point.screenPosition.x = x; |
| 177 point.position.y = point.screenPosition.y = y; | 177 point.position.y = point.screenPosition.y = y; |
| 178 point.state = WebTouchPoint::StatePressed; | 178 point.state = WebTouchPoint::StatePressed; |
| 179 point.radiusX = point.radiusY = 1.f; | 179 point.radiusX = point.radiusY = 1.f; |
| 180 point.rotationAngle = 1.f; |
| 181 point.force = 1.f; |
| 180 ++touchesLength; | 182 ++touchesLength; |
| 181 WebTouchEventTraits::ResetType( | 183 WebTouchEventTraits::ResetType( |
| 182 WebInputEvent::TouchStart, timeStampSeconds, this); | 184 WebInputEvent::TouchStart, timeStampSeconds, this); |
| 183 return point.id; | 185 return point.id; |
| 184 } | 186 } |
| 185 | 187 |
| 186 void SyntheticWebTouchEvent::MovePoint(int index, float x, float y) { | 188 void SyntheticWebTouchEvent::MovePoint(int index, float x, float y) { |
| 187 CHECK_GE(index, 0); | 189 CHECK_GE(index, 0); |
| 188 CHECK_LT(index, touchesLengthCap); | 190 CHECK_LT(index, touchesLengthCap); |
| 189 // Always set this bit to avoid otherwise unexpected touchmove suppression. | 191 // Always set this bit to avoid otherwise unexpected touchmove suppression. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 211 touches[index].state = WebTouchPoint::StateCancelled; | 213 touches[index].state = WebTouchPoint::StateCancelled; |
| 212 WebTouchEventTraits::ResetType( | 214 WebTouchEventTraits::ResetType( |
| 213 WebInputEvent::TouchCancel, timeStampSeconds, this); | 215 WebInputEvent::TouchCancel, timeStampSeconds, this); |
| 214 } | 216 } |
| 215 | 217 |
| 216 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { | 218 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { |
| 217 timeStampSeconds = timestamp.InSecondsF(); | 219 timeStampSeconds = timestamp.InSecondsF(); |
| 218 } | 220 } |
| 219 | 221 |
| 220 } // namespace content | 222 } // namespace content |
| OLD | NEW |