Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(529)

Side by Side Diff: webkit/compositor_bindings/web_animation_impl.cc

Issue 14651027: Move webkit/compositor_bindings into webkit/renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2012 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 "webkit/compositor_bindings/web_animation_impl.h"
6
7 #include "cc/animation/animation.h"
8 #include "cc/animation/animation_curve.h"
9 #include "cc/animation/animation_id_provider.h"
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimation.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebAnimationCurve.h "
12 #include "webkit/compositor_bindings/web_float_animation_curve_impl.h"
13 #include "webkit/compositor_bindings/web_transform_animation_curve_impl.h"
14
15 using cc::Animation;
16 using cc::AnimationIdProvider;
17
18 using WebKit::WebAnimationCurve;
19
20 namespace webkit {
21
22 WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& web_curve,
23 TargetProperty target_property,
24 int animation_id,
25 int group_id) {
26 if (!animation_id)
27 animation_id = AnimationIdProvider::NextAnimationId();
28 if (!group_id)
29 group_id = AnimationIdProvider::NextGroupId();
30
31 WebAnimationCurve::AnimationCurveType curve_type = web_curve.type();
32 scoped_ptr<cc::AnimationCurve> curve;
33 switch (curve_type) {
34 case WebAnimationCurve::AnimationCurveTypeFloat: {
35 const WebFloatAnimationCurveImpl* float_curve_impl =
36 static_cast<const WebFloatAnimationCurveImpl*>(&web_curve);
37 curve = float_curve_impl->CloneToAnimationCurve();
38 break;
39 }
40 case WebAnimationCurve::AnimationCurveTypeTransform: {
41 const WebTransformAnimationCurveImpl* transform_curve_impl =
42 static_cast<const WebTransformAnimationCurveImpl*>(&web_curve);
43 curve = transform_curve_impl->CloneToAnimationCurve();
44 break;
45 }
46 }
47 animation_ = Animation::Create(
48 curve.Pass(),
49 animation_id,
50 group_id,
51 static_cast<cc::Animation::TargetProperty>(target_property));
52 }
53
54 WebAnimationImpl::~WebAnimationImpl() {}
55
56 int WebAnimationImpl::id() { return animation_->id(); }
57
58 WebKit::WebAnimation::TargetProperty WebAnimationImpl::targetProperty() const {
59 return static_cast<WebAnimationImpl::TargetProperty>(
60 animation_->target_property());
61 }
62
63 int WebAnimationImpl::iterations() const { return animation_->iterations(); }
64
65 void WebAnimationImpl::setIterations(int n) { animation_->set_iterations(n); }
66
67 double WebAnimationImpl::startTime() const { return animation_->start_time(); }
68
69 void WebAnimationImpl::setStartTime(double monotonic_time) {
70 animation_->set_start_time(monotonic_time);
71 }
72
73 double WebAnimationImpl::timeOffset() const {
74 return animation_->time_offset();
75 }
76
77 void WebAnimationImpl::setTimeOffset(double monotonic_time) {
78 animation_->set_time_offset(monotonic_time);
79 }
80
81 bool WebAnimationImpl::alternatesDirection() const {
82 return animation_->alternates_direction();
83 }
84
85 void WebAnimationImpl::setAlternatesDirection(bool alternates) {
86 animation_->set_alternates_direction(alternates);
87 }
88
89 scoped_ptr<cc::Animation> WebAnimationImpl::CloneToAnimation() {
90 scoped_ptr<cc::Animation> to_return(
91 animation_->Clone(cc::Animation::NonControllingInstance));
92 to_return->set_needs_synchronized_start_time(true);
93 return to_return.Pass();
94 }
95
96 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/compositor_bindings/web_animation_impl.h ('k') | webkit/compositor_bindings/web_animation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698