OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/renderer_host/smooth_scroll_calculator.h" |
| 6 |
| 7 namespace content { |
| 8 |
| 9 SmoothScrollCalculator::SmoothScrollCalculator() { |
| 10 } |
| 11 |
| 12 SmoothScrollCalculator::~SmoothScrollCalculator() { |
| 13 } |
| 14 |
| 15 double SmoothScrollCalculator::GetScrollDelta( |
| 16 base::TimeTicks now, base::TimeDelta desired_interval) { |
| 17 double position_delta = 10; |
| 18 if (!last_tick_time_.is_null()) { |
| 19 double velocity = 10 / desired_interval.InMillisecondsF(); |
| 20 double time_delta = (now - last_tick_time_).InMillisecondsF(); |
| 21 position_delta = velocity * time_delta; |
| 22 } |
| 23 |
| 24 last_tick_time_ = now; |
| 25 return position_delta; |
| 26 } |
| 27 |
| 28 } // namespace content |
OLD | NEW |