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

Side by Side Diff: webkit/compositor_bindings/WebAnimationImpl.cpp

Issue 11086053: Revert 161133 - [cc] Use base ptr types for cc's CSS animation classes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 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 "config.h" 5 #include "config.h"
6 6
7 #include "WebAnimationImpl.h" 7 #include "WebAnimationImpl.h"
8 8
9 #include "CCActiveAnimation.h" 9 #include "CCActiveAnimation.h"
10 #include "CCAnimationCurve.h" 10 #include "CCAnimationCurve.h"
11 #include "WebFloatAnimationCurveImpl.h" 11 #include "WebFloatAnimationCurveImpl.h"
12 #include "WebTransformAnimationCurveImpl.h" 12 #include "WebTransformAnimationCurveImpl.h"
13 #include <public/WebAnimation.h> 13 #include <public/WebAnimation.h>
14 #include <public/WebAnimationCurve.h> 14 #include <public/WebAnimationCurve.h>
15 #include <wtf/OwnPtr.h> 15 #include <wtf/OwnPtr.h>
16 #include <wtf/PassOwnPtr.h>
16 17
17 using cc::CCActiveAnimation; 18 using cc::CCActiveAnimation;
18 19
19 namespace WebKit { 20 namespace WebKit {
20 21
21 WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, TargetPropert y targetProperty, int animationId) 22 WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, TargetPropert y targetProperty, int animationId)
22 { 23 {
23 return new WebAnimationImpl(curve, targetProperty, animationId, 0); 24 return new WebAnimationImpl(curve, targetProperty, animationId, 0);
24 } 25 }
25 26
26 WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, TargetProp erty targetProperty, int animationId, int groupId) 27 WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, TargetProp erty targetProperty, int animationId, int groupId)
27 { 28 {
28 static int nextAnimationId = 1; 29 static int nextAnimationId = 1;
29 static int nextGroupId = 1; 30 static int nextGroupId = 1;
30 if (!animationId) 31 if (!animationId)
31 animationId = nextAnimationId++; 32 animationId = nextAnimationId++;
32 if (!groupId) 33 if (!groupId)
33 groupId = nextGroupId++; 34 groupId = nextGroupId++;
34 35
35 WebAnimationCurve::AnimationCurveType curveType = webCurve.type(); 36 WebAnimationCurve::AnimationCurveType curveType = webCurve.type();
36 scoped_ptr<cc::CCAnimationCurve> curve; 37 OwnPtr<cc::CCAnimationCurve> curve;
37 switch (curveType) { 38 switch (curveType) {
38 case WebAnimationCurve::AnimationCurveTypeFloat: { 39 case WebAnimationCurve::AnimationCurveTypeFloat: {
39 const WebFloatAnimationCurveImpl* floatCurveImpl = static_cast<const Web FloatAnimationCurveImpl*>(&webCurve); 40 const WebFloatAnimationCurveImpl* floatCurveImpl = static_cast<const Web FloatAnimationCurveImpl*>(&webCurve);
40 curve = floatCurveImpl->cloneToCCAnimationCurve(); 41 curve = floatCurveImpl->cloneToCCAnimationCurve();
41 break; 42 break;
42 } 43 }
43 case WebAnimationCurve::AnimationCurveTypeTransform: { 44 case WebAnimationCurve::AnimationCurveTypeTransform: {
44 const WebTransformAnimationCurveImpl* transformCurveImpl = static_cast<c onst WebTransformAnimationCurveImpl*>(&webCurve); 45 const WebTransformAnimationCurveImpl* transformCurveImpl = static_cast<c onst WebTransformAnimationCurveImpl*>(&webCurve);
45 curve = transformCurveImpl->cloneToCCAnimationCurve(); 46 curve = transformCurveImpl->cloneToCCAnimationCurve();
46 break; 47 break;
47 } 48 }
48 } 49 }
49 m_animation = CCActiveAnimation::create(curve.Pass(), animationId, groupId, static_cast<cc::CCActiveAnimation::TargetProperty>(targetProperty)); 50 m_animation = CCActiveAnimation::create(curve.release(), animationId, groupI d, static_cast<cc::CCActiveAnimation::TargetProperty>(targetProperty));
50 } 51 }
51 52
52 WebAnimationImpl::~WebAnimationImpl() 53 WebAnimationImpl::~WebAnimationImpl()
53 { 54 {
54 } 55 }
55 56
56 int WebAnimationImpl::id() 57 int WebAnimationImpl::id()
57 { 58 {
58 return m_animation->id(); 59 return m_animation->id();
59 } 60 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 bool WebAnimationImpl::alternatesDirection() const 97 bool WebAnimationImpl::alternatesDirection() const
97 { 98 {
98 return m_animation->alternatesDirection(); 99 return m_animation->alternatesDirection();
99 } 100 }
100 101
101 void WebAnimationImpl::setAlternatesDirection(bool alternates) 102 void WebAnimationImpl::setAlternatesDirection(bool alternates)
102 { 103 {
103 m_animation->setAlternatesDirection(alternates); 104 m_animation->setAlternatesDirection(alternates);
104 } 105 }
105 106
106 scoped_ptr<cc::CCActiveAnimation> WebAnimationImpl::cloneToCCAnimation() 107 PassOwnPtr<cc::CCActiveAnimation> WebAnimationImpl::cloneToCCAnimation()
107 { 108 {
108 scoped_ptr<cc::CCActiveAnimation> toReturn(m_animation->clone(cc::CCActiveAn imation::NonControllingInstance)); 109 OwnPtr<cc::CCActiveAnimation> toReturn(m_animation->clone(cc::CCActiveAnimat ion::NonControllingInstance));
109 toReturn->setNeedsSynchronizedStartTime(true); 110 toReturn->setNeedsSynchronizedStartTime(true);
110 return toReturn.Pass(); 111 return toReturn.release();
111 } 112 }
112 113
113 } // namespace WebKit 114 } // namespace WebKit
OLDNEW
« no previous file with comments | « webkit/compositor_bindings/WebAnimationImpl.h ('k') | webkit/compositor_bindings/WebFloatAnimationCurveImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698