OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basic_mouse_wheel_smooth_scroll_gesture.
h" | 5 #include "content/browser/renderer_host/basic_mouse_wheel_smooth_scroll_gesture.
h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "content/browser/renderer_host/render_widget_host_impl.h" | 8 #include "content/browser/renderer_host/render_widget_host_impl.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 13 matching lines...) Expand all Loading... |
24 base::TimeTicks now, RenderWidgetHost* host) { | 24 base::TimeTicks now, RenderWidgetHost* host) { |
25 | 25 |
26 if (pixels_scrolled_ >= pixels_to_scroll_) | 26 if (pixels_scrolled_ >= pixels_to_scroll_) |
27 return false; | 27 return false; |
28 | 28 |
29 float position_delta = synthetic_gesture_calculator_.GetDelta( | 29 float position_delta = synthetic_gesture_calculator_.GetDelta( |
30 now, | 30 now, |
31 RenderWidgetHostImpl::From(host)->GetSyntheticGestureMessageInterval()); | 31 RenderWidgetHostImpl::From(host)->GetSyntheticGestureMessageInterval()); |
32 | 32 |
33 | 33 |
34 WebKit::WebMouseWheelEvent event; | 34 blink::WebMouseWheelEvent event; |
35 event.type = WebKit::WebInputEvent::MouseWheel; | 35 event.type = blink::WebInputEvent::MouseWheel; |
36 event.hasPreciseScrollingDeltas = 0; | 36 event.hasPreciseScrollingDeltas = 0; |
37 event.deltaY = scroll_down_ ? -position_delta : position_delta; | 37 event.deltaY = scroll_down_ ? -position_delta : position_delta; |
38 // TODO(vollick): find a proper way to access | 38 // TODO(vollick): find a proper way to access |
39 // WebCore::WheelEvent::tickMultiplier. | 39 // WebCore::WheelEvent::tickMultiplier. |
40 event.wheelTicksY = event.deltaY / 120; | 40 event.wheelTicksY = event.deltaY / 120; |
41 event.modifiers = 0; | 41 event.modifiers = 0; |
42 | 42 |
43 // TODO(nduca): Figure out plausible x and y values. | 43 // TODO(nduca): Figure out plausible x and y values. |
44 event.globalX = 0; | 44 event.globalX = 0; |
45 event.globalY = 0; | 45 event.globalY = 0; |
46 event.x = mouse_event_x_; | 46 event.x = mouse_event_x_; |
47 event.y = mouse_event_y_; | 47 event.y = mouse_event_y_; |
48 event.windowX = event.x; | 48 event.windowX = event.x; |
49 event.windowY = event.y; | 49 event.windowY = event.y; |
50 host->ForwardWheelEvent(event); | 50 host->ForwardWheelEvent(event); |
51 | 51 |
52 pixels_scrolled_ += abs(event.deltaY); | 52 pixels_scrolled_ += abs(event.deltaY); |
53 | 53 |
54 TRACE_COUNTER_ID1( | 54 TRACE_COUNTER_ID1( |
55 "gpu", "smooth_scroll_by_pixels_scrolled", this, pixels_scrolled_); | 55 "gpu", "smooth_scroll_by_pixels_scrolled", this, pixels_scrolled_); |
56 | 56 |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 } // content | 60 } // content |
61 | 61 |
OLD | NEW |