| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/child/web_gesture_curve_impl.h" | 5 #include "content/child/web_gesture_curve_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "third_party/WebKit/public/platform/WebFloatSize.h" | 8 #include "third_party/WebKit/public/platform/WebFloatSize.h" |
| 9 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" | 9 #include "third_party/WebKit/public/platform/WebGestureCurveTarget.h" |
| 10 #include "ui/events/gestures/fling_curve.h" | 10 #include "ui/events/gestures/fling_curve.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 auto scroller = make_scoped_ptr(new ui::Scroller(ui::Scroller::Config())); | 26 auto scroller = make_scoped_ptr(new ui::Scroller(ui::Scroller::Config())); |
| 27 scroller->Fling(0, | 27 scroller->Fling(0, |
| 28 0, | 28 0, |
| 29 initial_velocity.x(), | 29 initial_velocity.x(), |
| 30 initial_velocity.y(), | 30 initial_velocity.y(), |
| 31 INT_MIN, | 31 INT_MIN, |
| 32 INT_MAX, | 32 INT_MAX, |
| 33 INT_MIN, | 33 INT_MIN, |
| 34 INT_MAX, | 34 INT_MAX, |
| 35 base::TimeTicks()); | 35 base::TimeTicks()); |
| 36 return scroller.PassAs<ui::GestureCurve>(); | 36 return scroller.Pass(); |
| 37 #else | 37 #else |
| 38 return scoped_ptr<ui::GestureCurve>( | 38 return make_scoped_ptr( |
| 39 new ui::FlingCurve(initial_velocity, base::TimeTicks())); | 39 new ui::FlingCurve(initial_velocity, base::TimeTicks())); |
| 40 #endif | 40 #endif |
| 41 } | 41 } |
| 42 | 42 |
| 43 } // namespace | 43 } // namespace |
| 44 | 44 |
| 45 // static | 45 // static |
| 46 scoped_ptr<WebGestureCurve> WebGestureCurveImpl::CreateFromDefaultPlatformCurve( | 46 scoped_ptr<WebGestureCurve> WebGestureCurveImpl::CreateFromDefaultPlatformCurve( |
| 47 const gfx::Vector2dF& initial_velocity, | 47 const gfx::Vector2dF& initial_velocity, |
| 48 const gfx::Vector2dF& initial_offset) { | 48 const gfx::Vector2dF& initial_offset) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return still_active; | 88 return still_active; |
| 89 | 89 |
| 90 // scrollBy() could delete this curve if the animation is over, so don't touch | 90 // scrollBy() could delete this curve if the animation is over, so don't touch |
| 91 // any member variables after making that call. | 91 // any member variables after making that call. |
| 92 bool did_scroll = target->scrollBy(blink::WebFloatSize(delta), | 92 bool did_scroll = target->scrollBy(blink::WebFloatSize(delta), |
| 93 blink::WebFloatSize(velocity)); | 93 blink::WebFloatSize(velocity)); |
| 94 return did_scroll && still_active; | 94 return did_scroll && still_active; |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace content | 97 } // namespace content |
| OLD | NEW |