| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "core/animation/AnimationEffect.h" |
| 32 #include "core/animation/KeyframeAnimationEffect.h" |
| 33 #include "core/animation/Timing.h" |
| 34 #include "core/platform/animation/TimingFunction.h" |
| 35 #include "public/platform/WebAnimation.h" |
| 36 |
| 31 namespace WebCore { | 37 namespace WebCore { |
| 32 | 38 |
| 33 class CompositorAnimationsKeyframeEffectHelper { | 39 class CompositorAnimationsKeyframeEffectHelper { |
| 34 private: | 40 private: |
| 35 typedef Vector<std::pair<double, const AnimationEffect::CompositableValue*>
> KeyframeValues; | 41 typedef Vector<std::pair<double, const AnimationEffect::CompositableValue*>
> KeyframeValues; |
| 36 | 42 |
| 37 static PassOwnPtr<Vector<CSSPropertyID> > getProperties(const KeyframeAnimat
ionEffect*); | 43 static PassOwnPtr<Vector<CSSPropertyID> > getProperties(const KeyframeAnimat
ionEffect*); |
| 38 static PassOwnPtr<KeyframeValues> getKeyframeValuesForProperty(const Keyfram
eAnimationEffect*, CSSPropertyID, double zero, double scale, bool reverse = fals
e); | 44 static PassOwnPtr<KeyframeValues> getKeyframeValuesForProperty(const Keyfram
eAnimationEffect*, CSSPropertyID, double scale, bool reverse = false); |
| 39 static PassOwnPtr<KeyframeValues> getKeyframeValuesForProperty(const Keyfram
eAnimationEffect::PropertySpecificKeyframeGroup*, double zero, double scale, boo
l reverse); | 45 static PassOwnPtr<KeyframeValues> getKeyframeValuesForProperty(const Keyfram
eAnimationEffect::PropertySpecificKeyframeGroup*, double scale, bool reverse); |
| 40 | 46 |
| 41 friend class CompositorAnimationsImpl; | 47 friend class CompositorAnimationsImpl; |
| 42 }; | 48 }; |
| 43 | 49 |
| 44 class CompositorAnimationsImpl { | 50 class CompositorAnimationsImpl { |
| 45 private: | 51 private: |
| 52 struct CompositorTiming { |
| 53 bool reverse; |
| 54 bool alternate; |
| 55 double scaledDuration; |
| 56 double scaledTimeOffset; |
| 57 int adjustedIterationCount; |
| 58 }; |
| 46 | 59 |
| 60 static bool convertTimingForCompositor(const Timing&, CompositorTiming& out)
; |
| 47 | 61 |
| 48 static bool isCandidateForCompositor(const Keyframe&); | 62 static bool isCandidateForCompositor(const Keyframe&); |
| 49 static bool isCandidateForCompositor(const KeyframeAnimationEffect&); | 63 static bool isCandidateForCompositor(const KeyframeAnimationEffect&); |
| 50 static bool isCandidateForCompositor(const Timing&, const KeyframeAnimationE
ffect::KeyframeVector&); | 64 static bool isCandidateForCompositor(const Timing&, const KeyframeAnimationE
ffect::KeyframeVector&); |
| 51 static bool isCandidateForCompositor(const TimingFunction&, const KeyframeAn
imationEffect::KeyframeVector&, double frameOffset = 0); | 65 static bool isCandidateForCompositor(const TimingFunction&, const KeyframeAn
imationEffect::KeyframeVector*, bool isNestedCall = false); |
| 52 static void getCompositorAnimations(const Timing&, const KeyframeAnimationEf
fect&, Vector<OwnPtr<blink::WebAnimation> >& animations); | 66 static void getCompositorAnimations(const Timing&, const KeyframeAnimationEf
fect&, Vector<OwnPtr<blink::WebAnimation> >& animations); |
| 53 | 67 |
| 54 template<typename PlatformAnimationCurveType, typename PlatformAnimationKeyf
rameType> | 68 template<typename PlatformAnimationCurveType, typename PlatformAnimationKeyf
rameType> |
| 55 static void addKeyframesToCurve(PlatformAnimationCurveType&, const Composito
rAnimationsKeyframeEffectHelper::KeyframeValues&, const TimingFunction&); | 69 static void addKeyframesToCurve(PlatformAnimationCurveType&, const Composito
rAnimationsKeyframeEffectHelper::KeyframeValues&, const TimingFunction&); |
| 56 | 70 |
| 57 friend class CompositorAnimations; | 71 friend class CompositorAnimations; |
| 58 friend class CoreAnimationCompositorAnimationsTest; | 72 friend class CoreAnimationCompositorAnimationsTest; |
| 59 }; | 73 }; |
| 60 | 74 |
| 61 } // WebCore | 75 } // WebCore |
| OLD | NEW |