summaryrefslogtreecommitdiffstats
path: root/chromium/cc/input/page_scale_animation.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/cc/input/page_scale_animation.h')
-rw-r--r--chromium/cc/input/page_scale_animation.h38
1 files changed, 20 insertions, 18 deletions
diff --git a/chromium/cc/input/page_scale_animation.h b/chromium/cc/input/page_scale_animation.h
index 4c30cdcbc52..c997c567754 100644
--- a/chromium/cc/input/page_scale_animation.h
+++ b/chromium/cc/input/page_scale_animation.h
@@ -7,10 +7,12 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "base/time/time.h"
#include "ui/gfx/size.h"
#include "ui/gfx/vector2d_f.h"
namespace cc {
+
class TimingFunction;
// A small helper class that does the math for zoom animations, primarily for
@@ -25,10 +27,10 @@ class PageScaleAnimation {
public:
// Construct with the state at the beginning of the animation.
static scoped_ptr<PageScaleAnimation> Create(
- gfx::Vector2dF start_scroll_offset,
+ const gfx::Vector2dF& start_scroll_offset,
float start_page_scale_factor,
- gfx::SizeF viewport_size,
- gfx::SizeF root_layer_size,
+ const gfx::SizeF& viewport_size,
+ const gfx::SizeF& root_layer_size,
scoped_ptr<TimingFunction> timing_function);
~PageScaleAnimation();
@@ -37,7 +39,7 @@ class PageScaleAnimation {
// immediately after construction to set the final scroll and page scale.
// Zoom while explicitly specifying the top-left scroll position.
- void ZoomTo(gfx::Vector2dF target_scroll_offset,
+ void ZoomTo(const gfx::Vector2dF& target_scroll_offset,
float target_page_scale_factor,
double duration);
@@ -45,34 +47,34 @@ class PageScaleAnimation {
// at the same position on the physical display throughout the animation,
// unless the edges of the root layer are hit. The anchor is specified
// as an offset from the content layer.
- void ZoomWithAnchor(gfx::Vector2dF anchor,
+ void ZoomWithAnchor(const gfx::Vector2dF& anchor,
float target_page_scale_factor,
double duration);
// These should be called before the first frame of animation to initialize
// the start time. StartAnimation should only be called once after creation.
bool IsAnimationStarted() const;
- void StartAnimation(double time);
+ void StartAnimation(base::TimeTicks time);
// Call these functions while the animation is in progress to output the
// current state.
- gfx::Vector2dF ScrollOffsetAtTime(double time) const;
- float PageScaleFactorAtTime(double time) const;
- bool IsAnimationCompleteAtTime(double time) const;
+ gfx::Vector2dF ScrollOffsetAtTime(base::TimeTicks time) const;
+ float PageScaleFactorAtTime(base::TimeTicks time) const;
+ bool IsAnimationCompleteAtTime(base::TimeTicks time) const;
// The following methods return state which is invariant throughout the
// course of the animation.
- double start_time() const { return start_time_; }
- double duration() const { return duration_; }
- double end_time() const { return start_time_ + duration_; }
+ base::TimeTicks start_time() const { return start_time_; }
+ base::TimeDelta duration() const { return duration_; }
+ base::TimeTicks end_time() const { return start_time_ + duration_; }
gfx::Vector2dF target_scroll_offset() const { return target_scroll_offset_; }
float target_page_scale_factor() const { return target_page_scale_factor_; }
protected:
- PageScaleAnimation(gfx::Vector2dF start_scroll_offset,
+ PageScaleAnimation(const gfx::Vector2dF& start_scroll_offset,
float start_page_scale_factor,
- gfx::SizeF viewport_size,
- gfx::SizeF root_layer_size,
+ const gfx::SizeF& viewport_size,
+ const gfx::SizeF& root_layer_size,
scoped_ptr<TimingFunction> timing_function);
private:
@@ -82,7 +84,7 @@ class PageScaleAnimation {
gfx::SizeF StartViewportSize() const;
gfx::SizeF TargetViewportSize() const;
- float InterpAtTime(double time) const;
+ float InterpAtTime(base::TimeTicks time) const;
gfx::SizeF ViewportSizeAt(float interp) const;
gfx::Vector2dF ScrollOffsetAt(float interp) const;
gfx::Vector2dF AnchorAt(float interp) const;
@@ -100,8 +102,8 @@ class PageScaleAnimation {
gfx::SizeF viewport_size_;
gfx::SizeF root_layer_size_;
- double start_time_;
- double duration_;
+ base::TimeTicks start_time_;
+ base::TimeDelta duration_;
scoped_ptr<TimingFunction> timing_function_;