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/synthetic_smooth_move_gesture.h" | 5 #include "content/browser/renderer_host/input/synthetic_smooth_move_gesture.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/gfx/geometry/point_f.h" | 10 #include "ui/gfx/geometry/point_f.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 | 239 |
240 void SyntheticSmoothMoveGesture::ForwardMouseWheelEvent( | 240 void SyntheticSmoothMoveGesture::ForwardMouseWheelEvent( |
241 SyntheticGestureTarget* target, | 241 SyntheticGestureTarget* target, |
242 const gfx::Vector2dF& delta, | 242 const gfx::Vector2dF& delta, |
243 const base::TimeTicks& timestamp) const { | 243 const base::TimeTicks& timestamp) const { |
244 blink::WebMouseWheelEvent mouse_wheel_event = | 244 blink::WebMouseWheelEvent mouse_wheel_event = |
245 SyntheticWebMouseWheelEventBuilder::Build(0, 0, delta.x(), delta.y(), 0, | 245 SyntheticWebMouseWheelEventBuilder::Build(0, 0, delta.x(), delta.y(), 0, |
246 false); | 246 false); |
247 | 247 |
248 mouse_wheel_event.x = current_move_segment_start_position_.x(); | 248 mouse_wheel_event.setPositionInWidget( |
249 mouse_wheel_event.y = current_move_segment_start_position_.y(); | 249 current_move_segment_start_position_.x(), |
| 250 current_move_segment_start_position_.y()); |
250 | 251 |
251 mouse_wheel_event.setTimeStampSeconds(ConvertTimestampToSeconds(timestamp)); | 252 mouse_wheel_event.setTimeStampSeconds(ConvertTimestampToSeconds(timestamp)); |
252 | 253 |
253 target->DispatchInputEventToPlatform(mouse_wheel_event); | 254 target->DispatchInputEventToPlatform(mouse_wheel_event); |
254 } | 255 } |
255 | 256 |
256 void SyntheticSmoothMoveGesture::PressPoint(SyntheticGestureTarget* target, | 257 void SyntheticSmoothMoveGesture::PressPoint(SyntheticGestureTarget* target, |
257 const base::TimeTicks& timestamp) { | 258 const base::TimeTicks& timestamp) { |
258 DCHECK_EQ(current_move_segment_, 0); | 259 DCHECK_EQ(current_move_segment_, 0); |
259 synthetic_pointer_driver_->Press(current_move_segment_start_position_.x(), | 260 synthetic_pointer_driver_->Press(current_move_segment_start_position_.x(), |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 DCHECK_LT(current_move_segment_, static_cast<int>(params_.distances.size())); | 337 DCHECK_LT(current_move_segment_, static_cast<int>(params_.distances.size())); |
337 return current_move_segment_ == | 338 return current_move_segment_ == |
338 static_cast<int>(params_.distances.size()) - 1; | 339 static_cast<int>(params_.distances.size()) - 1; |
339 } | 340 } |
340 | 341 |
341 bool SyntheticSmoothMoveGesture::MoveIsNoOp() const { | 342 bool SyntheticSmoothMoveGesture::MoveIsNoOp() const { |
342 return params_.distances.size() == 0 || params_.distances[0].IsZero(); | 343 return params_.distances.size() == 0 || params_.distances[0].IsZero(); |
343 } | 344 } |
344 | 345 |
345 } // namespace content | 346 } // namespace content |
OLD | NEW |