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

Unified Diff: Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp

Issue 10384167: Merge 116554 - [chromium] Add impl-thread support for fill-mode and direction css animation propert… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp
===================================================================
--- Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp (revision 116999)
+++ Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp (working copy)
@@ -52,20 +52,24 @@
template <class Value, class Keyframe, class Curve>
PassOwnPtr<CCActiveAnimation> createActiveAnimation(const KeyframeValueList& valueList, const Animation* animation, size_t animationId, size_t groupId, double timeOffset, CCActiveAnimation::TargetProperty targetProperty)
{
- // FIXME: add support for different directions.
- if (animation && animation->isDirectionSet() && animation->direction() != Animation::AnimationDirectionNormal)
- return nullptr;
+ bool alternate = false;
+ bool reverse = false;
+ if (animation && animation->isDirectionSet()) {
+ Animation::AnimationDirection direction = animation->direction();
+ if (direction == Animation::AnimationDirectionAlternate || direction == Animation::AnimationDirectionAlternateReverse)
+ alternate = true;
+ if (direction == Animation::AnimationDirectionReverse || direction == Animation::AnimationDirectionAlternateReverse)
+ reverse = true;
+ }
- // FIXME: add support for fills forwards and fills backwards
- if (animation && animation->isFillModeSet() && (animation->fillsForwards() || animation->fillsBackwards()))
- return nullptr;
-
OwnPtr<Curve> curve = Curve::create();
Vector<Keyframe> keyframes;
for (size_t i = 0; i < valueList.size(); i++) {
- const Value* originalValue = static_cast<const Value*>(valueList.at(i));
+ size_t index = reverse ? valueList.size() - i - 1 : i;
+ const Value* originalValue = static_cast<const Value*>(valueList.at(index));
+
OwnPtr<CCTimingFunction> timingFunction;
const TimingFunction* originalTimingFunction = originalValue->timingFunction();
@@ -91,7 +95,10 @@
timingFunction = CCEaseTimingFunction::create();
double duration = (animation && animation->isDurationSet()) ? animation->duration() : 1;
- appendKeyframe<Value, Keyframe, Curve>(*curve, originalValue->keyTime() * duration, originalValue, timingFunction.release());
+ double keyTime = originalValue->keyTime() * duration;
+ if (reverse)
+ keyTime = duration - keyTime;
+ appendKeyframe<Value, Keyframe, Curve>(*curve, keyTime, originalValue, timingFunction.release());
}
OwnPtr<CCActiveAnimation> anim = CCActiveAnimation::create(curve.release(), animationId, groupId, targetProperty);
@@ -101,6 +108,7 @@
if (anim.get()) {
int iterations = (animation && animation->isIterationCountSet()) ? animation->iterationCount() : 1;
anim->setIterations(iterations);
+ anim->setAlternatesDirection(alternate);
}
// In order to avoid skew, the main thread animation cannot tick until it has received the start time of

Powered by Google App Engine
This is Rietveld 408576698