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/browser/renderer_host/input/touch_event_queue.h" | 5 #include "content/browser/renderer_host/input/touch_event_queue.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 int index1, | 182 int index1, |
183 float x1, | 183 float x1, |
184 float y1) { | 184 float y1) { |
185 touch_event_.MovePoint(index0, x0, y0); | 185 touch_event_.MovePoint(index0, x0, y0); |
186 touch_event_.MovePoint(index1, x1, y1); | 186 touch_event_.MovePoint(index1, x1, y1); |
187 SendTouchEvent(); | 187 SendTouchEvent(); |
188 } | 188 } |
189 | 189 |
190 void ChangeTouchPointRadius(int index, float radius_x, float radius_y) { | 190 void ChangeTouchPointRadius(int index, float radius_x, float radius_y) { |
191 CHECK_GE(index, 0); | 191 CHECK_GE(index, 0); |
192 CHECK_LT(index, touch_event_.touchesLengthCap); | 192 CHECK_LT(index, touch_event_.kTouchesLengthCap); |
193 WebTouchPoint& point = touch_event_.touches[index]; | 193 WebTouchPoint& point = touch_event_.touches[index]; |
194 point.radiusX = radius_x; | 194 point.radiusX = radius_x; |
195 point.radiusY = radius_y; | 195 point.radiusY = radius_y; |
196 touch_event_.touches[index].state = WebTouchPoint::StateMoved; | 196 touch_event_.touches[index].state = WebTouchPoint::StateMoved; |
197 touch_event_.movedBeyondSlopRegion = true; | 197 touch_event_.movedBeyondSlopRegion = true; |
198 WebTouchEventTraits::ResetType(WebInputEvent::TouchMove, | 198 WebTouchEventTraits::ResetType(WebInputEvent::TouchMove, |
199 touch_event_.timeStampSeconds, | 199 touch_event_.timeStampSeconds, |
200 &touch_event_); | 200 &touch_event_); |
201 SendTouchEvent(); | 201 SendTouchEvent(); |
202 } | 202 } |
203 | 203 |
204 void ChangeTouchPointRotationAngle(int index, float rotation_angle) { | 204 void ChangeTouchPointRotationAngle(int index, float rotation_angle) { |
205 CHECK_GE(index, 0); | 205 CHECK_GE(index, 0); |
206 CHECK_LT(index, touch_event_.touchesLengthCap); | 206 CHECK_LT(index, touch_event_.kTouchesLengthCap); |
207 WebTouchPoint& point = touch_event_.touches[index]; | 207 WebTouchPoint& point = touch_event_.touches[index]; |
208 point.rotationAngle = rotation_angle; | 208 point.rotationAngle = rotation_angle; |
209 touch_event_.touches[index].state = WebTouchPoint::StateMoved; | 209 touch_event_.touches[index].state = WebTouchPoint::StateMoved; |
210 touch_event_.movedBeyondSlopRegion = true; | 210 touch_event_.movedBeyondSlopRegion = true; |
211 WebTouchEventTraits::ResetType(WebInputEvent::TouchMove, | 211 WebTouchEventTraits::ResetType(WebInputEvent::TouchMove, |
212 touch_event_.timeStampSeconds, | 212 touch_event_.timeStampSeconds, |
213 &touch_event_); | 213 &touch_event_); |
214 SendTouchEvent(); | 214 SendTouchEvent(); |
215 } | 215 } |
216 | 216 |
217 void ChangeTouchPointForce(int index, float force) { | 217 void ChangeTouchPointForce(int index, float force) { |
218 CHECK_GE(index, 0); | 218 CHECK_GE(index, 0); |
219 CHECK_LT(index, touch_event_.touchesLengthCap); | 219 CHECK_LT(index, touch_event_.kTouchesLengthCap); |
220 WebTouchPoint& point = touch_event_.touches[index]; | 220 WebTouchPoint& point = touch_event_.touches[index]; |
221 point.force = force; | 221 point.force = force; |
222 touch_event_.touches[index].state = WebTouchPoint::StateMoved; | 222 touch_event_.touches[index].state = WebTouchPoint::StateMoved; |
223 touch_event_.movedBeyondSlopRegion = true; | 223 touch_event_.movedBeyondSlopRegion = true; |
224 WebTouchEventTraits::ResetType(WebInputEvent::TouchMove, | 224 WebTouchEventTraits::ResetType(WebInputEvent::TouchMove, |
225 touch_event_.timeStampSeconds, | 225 touch_event_.timeStampSeconds, |
226 &touch_event_); | 226 &touch_event_); |
227 SendTouchEvent(); | 227 SendTouchEvent(); |
228 } | 228 } |
229 | 229 |
(...skipping 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2708 EXPECT_EQ(0U, queued_event_count()); | 2708 EXPECT_EQ(0U, queued_event_count()); |
2709 | 2709 |
2710 EXPECT_EQ(WebInputEvent::TouchStart, all_sent_events()[0].type); | 2710 EXPECT_EQ(WebInputEvent::TouchStart, all_sent_events()[0].type); |
2711 EXPECT_EQ(WebInputEvent::TouchScrollStarted, all_sent_events()[1].type); | 2711 EXPECT_EQ(WebInputEvent::TouchScrollStarted, all_sent_events()[1].type); |
2712 EXPECT_EQ(WebInputEvent::TouchMove, all_sent_events()[2].type); | 2712 EXPECT_EQ(WebInputEvent::TouchMove, all_sent_events()[2].type); |
2713 EXPECT_EQ(WebInputEvent::TouchEnd, all_sent_events()[3].type); | 2713 EXPECT_EQ(WebInputEvent::TouchEnd, all_sent_events()[3].type); |
2714 EXPECT_EQ(4U, GetAndResetSentEventCount()); | 2714 EXPECT_EQ(4U, GetAndResetSentEventCount()); |
2715 } | 2715 } |
2716 | 2716 |
2717 } // namespace content | 2717 } // namespace content |
OLD | NEW |