| 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_scroll_gesture_ne
w.h" | 5 #include "content/browser/renderer_host/input/synthetic_smooth_scroll_gesture_ne
w.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "content/common/input/input_event.h" | 9 #include "content/common/input/input_event.h" |
| 10 #include "ui/events/latency_info.h" | 10 #include "ui/events/latency_info.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 void SyntheticSmoothScrollGestureNew::ForwardTouchEvent( | 91 void SyntheticSmoothScrollGestureNew::ForwardTouchEvent( |
| 92 SyntheticGestureTarget* target) { | 92 SyntheticGestureTarget* target) { |
| 93 target->QueueInputEventToPlatform( | 93 target->QueueInputEventToPlatform( |
| 94 InputEvent(touch_event_, ui::LatencyInfo(), false)); | 94 InputEvent(touch_event_, ui::LatencyInfo(), false)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void SyntheticSmoothScrollGestureNew::ForwardMouseWheelEvent( | 97 void SyntheticSmoothScrollGestureNew::ForwardMouseWheelEvent( |
| 98 SyntheticGestureTarget* target, | 98 SyntheticGestureTarget* target, |
| 99 float delta) { | 99 float delta) { |
| 100 WebKit::WebMouseWheelEvent mouse_wheel_event = | 100 blink::WebMouseWheelEvent mouse_wheel_event = |
| 101 SyntheticWebMouseWheelEventBuilder::Build(0, delta, 0, false); | 101 SyntheticWebMouseWheelEventBuilder::Build(0, delta, 0, false); |
| 102 | 102 |
| 103 target->QueueInputEventToPlatform( | 103 target->QueueInputEventToPlatform( |
| 104 InputEvent(mouse_wheel_event, ui::LatencyInfo(), false)); | 104 InputEvent(mouse_wheel_event, ui::LatencyInfo(), false)); |
| 105 } | 105 } |
| 106 | 106 |
| 107 float SyntheticSmoothScrollGestureNew::GetPositionDelta( | 107 float SyntheticSmoothScrollGestureNew::GetPositionDelta( |
| 108 const base::TimeDelta& interval) { | 108 const base::TimeDelta& interval) { |
| 109 float delta = kDeltaInPixelsPerMs * interval.InMillisecondsF(); | 109 float delta = kDeltaInPixelsPerMs * interval.InMillisecondsF(); |
| 110 return (params_.distance > 0) ? delta : -delta; | 110 return (params_.distance > 0) ? delta : -delta; |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool SyntheticSmoothScrollGestureNew::HasFinished() { | 113 bool SyntheticSmoothScrollGestureNew::HasFinished() { |
| 114 return abs(current_y_ - params_.anchor_y) >= abs(params_.distance); | 114 return abs(current_y_ - params_.anchor_y) >= abs(params_.distance); |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace content | 117 } // namespace content |
| OLD | NEW |