blob: 9816df93b48c6657f91251c5a9f9d81661f6105c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/renderer_host/synthetic_gesture_calculator.h"
namespace {
const float kDefaultPositionDelta = 10.0f;
}
namespace content {
SyntheticGestureCalculator::SyntheticGestureCalculator() {
}
SyntheticGestureCalculator::~SyntheticGestureCalculator() {
}
float SyntheticGestureCalculator::GetDelta(
base::TimeTicks now, base::TimeDelta desired_interval) {
float position_delta = kDefaultPositionDelta;
if (!last_tick_time_.is_null()) {
float velocity = kDefaultPositionDelta /
(float)desired_interval.InMillisecondsF();
float time_delta = (now - last_tick_time_).InMillisecondsF();
position_delta = velocity * time_delta;
}
last_tick_time_ = now;
return position_delta;
}
} // namespace content
|