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

Unified Diff: Source/core/animation/CompositorAnimations.cpp

Issue 812013002: Define step timing function for the cc animation framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Codereview fixes Created 6 years 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/core/animation/CompositorAnimations.cpp
diff --git a/Source/core/animation/CompositorAnimations.cpp b/Source/core/animation/CompositorAnimations.cpp
index 674b9352f0fc4ab0fb5a387e6afa7c592d05947a..ef29fc8a6335de77863837900410dc4b587ebed7 100644
--- a/Source/core/animation/CompositorAnimations.cpp
+++ b/Source/core/animation/CompositorAnimations.cpp
@@ -145,7 +145,6 @@ bool CompositorAnimations::isCandidateForAnimationOnCompositor(const Timing& tim
for (const auto& property : properties) {
const PropertySpecificKeyframeVector& keyframes = keyframeEffect.getPropertySpecificKeyframes(property);
ASSERT(keyframes.size() >= 2);
- auto* lastKeyframe = keyframes.last().get();
for (const auto& keyframe : keyframes) {
// FIXME: Determine candidacy based on the CSSValue instead of a snapshot AnimatableValue.
if (keyframe->composite() != AnimationEffect::CompositeReplace || !keyframe->getAnimatableValue())
@@ -167,10 +166,6 @@ bool CompositorAnimations::isCandidateForAnimationOnCompositor(const Timing& tim
default:
return false;
}
-
- // FIXME: Remove this check when crbug.com/229405 is resolved
- if (keyframe != lastKeyframe && keyframe->easing().type() == TimingFunction::StepsFunction)
- return false;
}
}
@@ -181,11 +176,11 @@ bool CompositorAnimations::isCandidateForAnimationOnCompositor(const Timing& tim
if (timing.timingFunction->type() != TimingFunction::LinearFunction) {
// Checks the of size of KeyframeVector instead of PropertySpecificKeyframeVector.
const KeyframeVector& keyframes = keyframeEffect.getFrames();
- if (keyframes.size() == 2 && keyframes.first()->easing().type() == TimingFunction::LinearFunction && timing.timingFunction->type() != TimingFunction::StepsFunction)
+ if (keyframes.size() == 2 && keyframes.first()->easing().type() == TimingFunction::LinearFunction)
return true;
// FIXME: Support non-linear timing functions in the compositor for
- // more than two keyframes and step timing functions in the compositor.
+ // more than two keyframes.
return false;
}
@@ -330,8 +325,24 @@ void addKeyframeWithTimingFunction(PlatformAnimationCurveType& curve, const Plat
}
case TimingFunction::StepsFunction:
- default:
- ASSERT_NOT_REACHED();
+ const StepsTimingFunction* steps = toStepsTimingFunction(timingFunction);
+
+ float stepsStartOffset;
+ switch (steps->stepAtPosition()) {
+ case StepsTimingFunction::Start:
+ stepsStartOffset = 1;
+ break;
+ case StepsTimingFunction::Middle:
+ stepsStartOffset = 0.5;
+ break;
+ case StepsTimingFunction::End:
+ stepsStartOffset = 0;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ return;
+ }
+ curve.add(keyframe, steps->numberOfSteps(), stepsStartOffset);
return;
}
}
« no previous file with comments | « ManualTests/animation/compositor-animation-steps.html ('k') | Source/core/animation/CompositorAnimationsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698