| OLD | NEW |
| 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 #include <wtf/PassOwnPtr.h> |
| 17 | 17 |
| 18 using WebCore::CCActiveAnimation; | 18 using WebCore::CCActiveAnimation; |
| 19 | 19 |
| 20 namespace WebKit { | 20 namespace WebKit { |
| 21 | 21 |
| 22 WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, TargetPropert
y targetProperty, int animationId) | 22 WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, TargetPropert
y targetProperty, int animationId) |
| 23 { | 23 { |
| 24 static int nextGroupId = 1; | 24 return new WebAnimationImpl(curve, targetProperty, animationId, 0); |
| 25 static int nextAnimationId = 1; | |
| 26 return new WebAnimationImpl(curve, targetProperty, animationId ? animationId
: nextAnimationId++, nextGroupId++); | |
| 27 } | 25 } |
| 28 | 26 |
| 29 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) |
| 30 { | 28 { |
| 29 static int nextAnimationId = 1; |
| 30 static int nextGroupId = 1; |
| 31 if (!animationId) |
| 32 animationId = nextAnimationId++; |
| 33 if (!groupId) |
| 34 groupId = nextGroupId++; |
| 35 |
| 31 WebAnimationCurve::AnimationCurveType curveType = webCurve.type(); | 36 WebAnimationCurve::AnimationCurveType curveType = webCurve.type(); |
| 32 OwnPtr<WebCore::CCAnimationCurve> curve; | 37 OwnPtr<WebCore::CCAnimationCurve> curve; |
| 33 switch (curveType) { | 38 switch (curveType) { |
| 34 case WebAnimationCurve::AnimationCurveTypeFloat: { | 39 case WebAnimationCurve::AnimationCurveTypeFloat: { |
| 35 const WebFloatAnimationCurveImpl* floatCurveImpl = static_cast<const Web
FloatAnimationCurveImpl*>(&webCurve); | 40 const WebFloatAnimationCurveImpl* floatCurveImpl = static_cast<const Web
FloatAnimationCurveImpl*>(&webCurve); |
| 36 curve = floatCurveImpl->cloneToCCAnimationCurve(); | 41 curve = floatCurveImpl->cloneToCCAnimationCurve(); |
| 37 break; | 42 break; |
| 38 } | 43 } |
| 39 case WebAnimationCurve::AnimationCurveTypeTransform: { | 44 case WebAnimationCurve::AnimationCurveTypeTransform: { |
| 40 const WebTransformAnimationCurveImpl* transformCurveImpl = static_cast<c
onst WebTransformAnimationCurveImpl*>(&webCurve); | 45 const WebTransformAnimationCurveImpl* transformCurveImpl = static_cast<c
onst WebTransformAnimationCurveImpl*>(&webCurve); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 105 } |
| 101 | 106 |
| 102 PassOwnPtr<WebCore::CCActiveAnimation> WebAnimationImpl::cloneToCCAnimation() | 107 PassOwnPtr<WebCore::CCActiveAnimation> WebAnimationImpl::cloneToCCAnimation() |
| 103 { | 108 { |
| 104 OwnPtr<WebCore::CCActiveAnimation> toReturn(m_animation->clone(WebCore::CCAc
tiveAnimation::NonControllingInstance)); | 109 OwnPtr<WebCore::CCActiveAnimation> toReturn(m_animation->clone(WebCore::CCAc
tiveAnimation::NonControllingInstance)); |
| 105 toReturn->setNeedsSynchronizedStartTime(true); | 110 toReturn->setNeedsSynchronizedStartTime(true); |
| 106 return toReturn.release(); | 111 return toReturn.release(); |
| 107 } | 112 } |
| 108 | 113 |
| 109 } // namespace WebKit | 114 } // namespace WebKit |
| OLD | NEW |