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

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

Issue 1113173003: Web Animations: Update naming to reflect spec changes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: No, really. Created 5 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
« no previous file with comments | « Source/core/animation/CompositorAnimations.h ('k') | Source/core/animation/CompositorAnimationsImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/animation/CompositorAnimations.cpp
diff --git a/Source/core/animation/CompositorAnimations.cpp b/Source/core/animation/CompositorAnimations.cpp
index 62eef54ffef1e562c34dc525042b2944231653df..24dd788a64118288112626a1d749c5b5dab4ea58 100644
--- a/Source/core/animation/CompositorAnimations.cpp
+++ b/Source/core/animation/CompositorAnimations.cpp
@@ -31,7 +31,7 @@
#include "config.h"
#include "core/animation/CompositorAnimations.h"
-#include "core/animation/AnimationNode.h"
+#include "core/animation/AnimationEffect.h"
#include "core/animation/AnimationTranslationUtil.h"
#include "core/animation/ElementAnimations.h"
#include "core/animation/CompositorAnimationsImpl.h"
@@ -73,27 +73,27 @@ void getKeyframeValuesForProperty(const KeyframeEffectModelBase* effect, Propert
}
}
-bool considerPlayerAsIncompatible(const AnimationPlayer& player, const AnimationPlayer& playerToAdd)
+bool considerAnimationAsIncompatible(const Animation& animation, const Animation& animationToAdd)
{
- if (&player == &playerToAdd)
+ if (&animation == &animationToAdd)
return false;
- switch (player.playStateInternal()) {
- case AnimationPlayer::Idle:
+ switch (animation.playStateInternal()) {
+ case Animation::Idle:
return false;
- case AnimationPlayer::Pending:
- case AnimationPlayer::Running:
+ case Animation::Pending:
+ case Animation::Running:
return true;
- case AnimationPlayer::Paused:
- case AnimationPlayer::Finished:
- return AnimationPlayer::hasLowerPriority(&playerToAdd, &player);
+ case Animation::Paused:
+ case Animation::Finished:
+ return Animation::hasLowerPriority(&animationToAdd, &animation);
default:
ASSERT_NOT_REACHED();
return true;
}
}
-bool hasIncompatibleAnimations(const Element& targetElement, const AnimationPlayer& playerToAdd, const AnimationEffect& effectToAdd)
+bool hasIncompatibleAnimations(const Element& targetElement, const Animation& animationToAdd, const EffectModel& effectToAdd)
{
const bool affectsOpacity = effectToAdd.affects(PropertyHandle(CSSPropertyOpacity));
const bool affectsTransform = effectToAdd.affects(PropertyHandle(CSSPropertyTransform));
@@ -105,14 +105,14 @@ bool hasIncompatibleAnimations(const Element& targetElement, const AnimationPlay
ElementAnimations* elementAnimations = targetElement.elementAnimations();
ASSERT(elementAnimations);
- for (const auto& entry : elementAnimations->players()) {
- const AnimationPlayer* attachedPlayer = entry.key;
- if (!considerPlayerAsIncompatible(*attachedPlayer, playerToAdd))
+ for (const auto& entry : elementAnimations->animations()) {
+ const Animation* attachedAnimation = entry.key;
+ if (!considerAnimationAsIncompatible(*attachedAnimation, animationToAdd))
continue;
- if ((affectsOpacity && attachedPlayer->affects(targetElement, CSSPropertyOpacity))
- || (affectsTransform && attachedPlayer->affects(targetElement, CSSPropertyTransform))
- || (affectsFilter && attachedPlayer->affects(targetElement, CSSPropertyWebkitFilter)))
+ if ((affectsOpacity && attachedAnimation->affects(targetElement, CSSPropertyOpacity))
+ || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyTransform))
+ || (affectsFilter && attachedAnimation->affects(targetElement, CSSPropertyWebkitFilter)))
return true;
}
@@ -125,7 +125,7 @@ CSSPropertyID CompositorAnimations::CompositableProperties[3] = {
CSSPropertyOpacity, CSSPropertyTransform, CSSPropertyWebkitFilter
};
-bool CompositorAnimations::getAnimatedBoundingBox(FloatBox& box, const AnimationEffect& effect, double minValue, double maxValue) const
+bool CompositorAnimations::getAnimatedBoundingBox(FloatBox& box, const EffectModel& effect, double minValue, double maxValue) const
{
const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(effect);
@@ -158,7 +158,7 @@ bool CompositorAnimations::getAnimatedBoundingBox(FloatBox& box, const Animation
return false;
// TODO: Add support for inflating modes other than Replace.
- if (frames[j]->composite() != AnimationEffect::CompositeReplace)
+ if (frames[j]->composite() != EffectModel::CompositeReplace)
return false;
const TimingFunction& timing = frames[j]->easing();
@@ -192,7 +192,7 @@ bool CompositorAnimations::getAnimatedBoundingBox(FloatBox& box, const Animation
// CompositorAnimations public API
// -----------------------------------------------------------------------
-bool CompositorAnimations::isCandidateForAnimationOnCompositor(const Timing& timing, const Element& targetElement, const AnimationPlayer* playerToAdd, const AnimationEffect& effect, double playerPlaybackRate)
+bool CompositorAnimations::isCandidateForAnimationOnCompositor(const Timing& timing, const Element& targetElement, const Animation* animationToAdd, const EffectModel& effect, double animationPlaybackRate)
{
const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(effect);
@@ -208,8 +208,8 @@ bool CompositorAnimations::isCandidateForAnimationOnCompositor(const Timing& tim
ASSERT(keyframes.size() >= 2);
for (const auto& keyframe : keyframes) {
// FIXME: Determine candidacy based on the CSSValue instead of a snapshot AnimatableValue.
- bool isNeutralKeyframe = keyframe->isCSSPropertySpecificKeyframe() && !toCSSPropertySpecificKeyframe(keyframe.get())->value() && keyframe->composite() == AnimationEffect::CompositeAdd;
- if ((keyframe->composite() != AnimationEffect::CompositeReplace && !isNeutralKeyframe) || !keyframe->getAnimatableValue())
+ bool isNeutralKeyframe = keyframe->isCSSPropertySpecificKeyframe() && !toCSSPropertySpecificKeyframe(keyframe.get())->value() && keyframe->composite() == EffectModel::CompositeAdd;
+ if ((keyframe->composite() != EffectModel::CompositeReplace && !isNeutralKeyframe) || !keyframe->getAnimatableValue())
return false;
switch (property.cssProperty()) {
@@ -232,17 +232,17 @@ bool CompositorAnimations::isCandidateForAnimationOnCompositor(const Timing& tim
}
}
- if (playerToAdd && hasIncompatibleAnimations(targetElement, *playerToAdd, effect))
+ if (animationToAdd && hasIncompatibleAnimations(targetElement, *animationToAdd, effect))
return false;
CompositorAnimationsImpl::CompositorTiming out;
- if (!CompositorAnimationsImpl::convertTimingForCompositor(timing, 0, out, playerPlaybackRate))
+ if (!CompositorAnimationsImpl::convertTimingForCompositor(timing, 0, out, animationPlaybackRate))
return false;
return true;
}
-void CompositorAnimations::cancelIncompatibleAnimationsOnCompositor(const Element& targetElement, const AnimationPlayer& playerToAdd, const AnimationEffect& effectToAdd)
+void CompositorAnimations::cancelIncompatibleAnimationsOnCompositor(const Element& targetElement, const Animation& animationToAdd, const EffectModel& effectToAdd)
{
const bool affectsOpacity = effectToAdd.affects(PropertyHandle(CSSPropertyOpacity));
const bool affectsTransform = effectToAdd.affects(PropertyHandle(CSSPropertyTransform));
@@ -254,15 +254,15 @@ void CompositorAnimations::cancelIncompatibleAnimationsOnCompositor(const Elemen
ElementAnimations* elementAnimations = targetElement.elementAnimations();
ASSERT(elementAnimations);
- for (const auto& entry : elementAnimations->players()) {
- AnimationPlayer* attachedPlayer = entry.key;
- if (!considerPlayerAsIncompatible(*attachedPlayer, playerToAdd))
+ for (const auto& entry : elementAnimations->animations()) {
+ Animation* attachedAnimation = entry.key;
+ if (!considerAnimationAsIncompatible(*attachedAnimation, animationToAdd))
continue;
- if ((affectsOpacity && attachedPlayer->affects(targetElement, CSSPropertyOpacity))
- || (affectsTransform && attachedPlayer->affects(targetElement, CSSPropertyTransform))
- || (affectsFilter && attachedPlayer->affects(targetElement, CSSPropertyWebkitFilter)))
- attachedPlayer->cancelAnimationOnCompositor();
+ if ((affectsOpacity && attachedAnimation->affects(targetElement, CSSPropertyOpacity))
+ || (affectsTransform && attachedAnimation->affects(targetElement, CSSPropertyTransform))
+ || (affectsFilter && attachedAnimation->affects(targetElement, CSSPropertyWebkitFilter)))
+ attachedAnimation->cancelAnimationOnCompositor();
}
}
@@ -271,10 +271,10 @@ bool CompositorAnimations::canStartAnimationOnCompositor(const Element& element)
return element.layoutObject() && element.layoutObject()->compositingState() == PaintsIntoOwnBacking;
}
-bool CompositorAnimations::startAnimationOnCompositor(const Element& element, int group, double startTime, double timeOffset, const Timing& timing, const AnimationPlayer& player, const AnimationEffect& effect, Vector<int>& startedAnimationIds, double playerPlaybackRate)
+bool CompositorAnimations::startAnimationOnCompositor(const Element& element, int group, double startTime, double timeOffset, const Timing& timing, const Animation& animation, const EffectModel& effect, Vector<int>& startedAnimationIds, double animationPlaybackRate)
{
ASSERT(startedAnimationIds.isEmpty());
- ASSERT(isCandidateForAnimationOnCompositor(timing, element, &player, effect, playerPlaybackRate));
+ ASSERT(isCandidateForAnimationOnCompositor(timing, element, &animation, effect, animationPlaybackRate));
ASSERT(canStartAnimationOnCompositor(element));
const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(effect);
@@ -283,18 +283,18 @@ bool CompositorAnimations::startAnimationOnCompositor(const Element& element, in
ASSERT(layer);
Vector<OwnPtr<WebCompositorAnimation>> animations;
- CompositorAnimationsImpl::getAnimationOnCompositor(timing, group, startTime, timeOffset, keyframeEffect, animations, playerPlaybackRate);
+ CompositorAnimationsImpl::getAnimationOnCompositor(timing, group, startTime, timeOffset, keyframeEffect, animations, animationPlaybackRate);
ASSERT(!animations.isEmpty());
- for (auto& animation : animations) {
- int id = animation->id();
+ for (auto& compositorAnimation : animations) {
+ int id = compositorAnimation->id();
if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
- WebCompositorAnimationPlayer* compositorPlayer = player.compositorPlayer();
+ WebCompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer();
ASSERT(compositorPlayer);
- compositorPlayer->addAnimation(animation.leakPtr());
- } else if (!layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->addAnimation(animation.release())) {
+ compositorPlayer->addAnimation(compositorAnimation.leakPtr());
+ } else if (!layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->addAnimation(compositorAnimation.release())) {
// FIXME: We should know ahead of time whether these animations can be started.
for (int startedAnimationId : startedAnimationIds)
- cancelAnimationOnCompositor(element, player, startedAnimationId);
+ cancelAnimationOnCompositor(element, animation, startedAnimationId);
startedAnimationIds.clear();
return false;
}
@@ -304,18 +304,18 @@ bool CompositorAnimations::startAnimationOnCompositor(const Element& element, in
return true;
}
-void CompositorAnimations::cancelAnimationOnCompositor(const Element& element, const AnimationPlayer& player, int id)
+void CompositorAnimations::cancelAnimationOnCompositor(const Element& element, const Animation& animation, int id)
{
if (!canStartAnimationOnCompositor(element)) {
// When an element is being detached, we cancel any associated
- // AnimationPlayers for CSS animations. But by the time we get
+ // Animations for CSS animations. But by the time we get
// here the mapping will have been removed.
// FIXME: Defer remove/pause operations until after the
// compositing update.
return;
}
if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
- WebCompositorAnimationPlayer* compositorPlayer = player.compositorPlayer();
+ WebCompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer();
ASSERT(compositorPlayer);
compositorPlayer->removeAnimation(id);
} else {
@@ -323,7 +323,7 @@ void CompositorAnimations::cancelAnimationOnCompositor(const Element& element, c
}
}
-void CompositorAnimations::pauseAnimationForTestingOnCompositor(const Element& element, const AnimationPlayer& player, int id, double pauseTime)
+void CompositorAnimations::pauseAnimationForTestingOnCompositor(const Element& element, const Animation& animation, int id, double pauseTime)
{
// FIXME: canStartAnimationOnCompositor queries compositingState, which is not necessarily up to date.
// https://code.google.com/p/chromium/issues/detail?id=339847
@@ -334,7 +334,7 @@ void CompositorAnimations::pauseAnimationForTestingOnCompositor(const Element& e
return;
}
if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
- WebCompositorAnimationPlayer* compositorPlayer = player.compositorPlayer();
+ WebCompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer();
ASSERT(compositorPlayer);
compositorPlayer->pauseAnimation(id, pauseTime);
} else {
@@ -342,12 +342,12 @@ void CompositorAnimations::pauseAnimationForTestingOnCompositor(const Element& e
}
}
-bool CompositorAnimations::canAttachCompositedLayers(const Element& element, const AnimationPlayer& player)
+bool CompositorAnimations::canAttachCompositedLayers(const Element& element, const Animation& animation)
{
if (!RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled())
return false;
- if (!player.compositorPlayer())
+ if (!animation.compositorPlayer())
return false;
if (!element.layoutObject() || !element.layoutObject()->isBoxModelObject())
@@ -366,14 +366,14 @@ bool CompositorAnimations::canAttachCompositedLayers(const Element& element, con
return true;
}
-void CompositorAnimations::attachCompositedLayers(const Element& element, const AnimationPlayer& player)
+void CompositorAnimations::attachCompositedLayers(const Element& element, const Animation& animation)
{
ASSERT(element.layoutObject());
DeprecatedPaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();
ASSERT(layer);
- WebCompositorAnimationPlayer* compositorPlayer = player.compositorPlayer();
+ WebCompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer();
ASSERT(compositorPlayer);
ASSERT(layer->compositedDeprecatedPaintLayerMapping());
@@ -384,7 +384,7 @@ void CompositorAnimations::attachCompositedLayers(const Element& element, const
// CompositorAnimationsImpl
// -----------------------------------------------------------------------
-bool CompositorAnimationsImpl::convertTimingForCompositor(const Timing& timing, double timeOffset, CompositorTiming& out, double playerPlaybackRate)
+bool CompositorAnimationsImpl::convertTimingForCompositor(const Timing& timing, double timeOffset, CompositorTiming& out, double animationPlaybackRate)
{
timing.assertValid();
@@ -404,8 +404,8 @@ bool CompositorAnimationsImpl::convertTimingForCompositor(const Timing& timing,
out.scaledDuration = timing.iterationDuration;
out.direction = timing.direction;
// Compositor's time offset is positive for seeking into the animation.
- out.scaledTimeOffset = -timing.startDelay / playerPlaybackRate + timeOffset;
- out.playbackRate = timing.playbackRate * playerPlaybackRate;
+ out.scaledTimeOffset = -timing.startDelay / animationPlaybackRate + timeOffset;
+ out.playbackRate = timing.playbackRate * animationPlaybackRate;
out.fillMode = timing.fillMode == Timing::FillModeAuto ? Timing::FillModeNone : timing.fillMode;
out.iterationStart = timing.iterationStart;
out.assertValid();
@@ -597,11 +597,11 @@ void CompositorAnimationsImpl::addKeyframesToCurve(WebCompositorAnimationCurve&
}
}
-void CompositorAnimationsImpl::getAnimationOnCompositor(const Timing& timing, int group, double startTime, double timeOffset, const KeyframeEffectModelBase& effect, Vector<OwnPtr<WebCompositorAnimation>>& animations, double playerPlaybackRate)
+void CompositorAnimationsImpl::getAnimationOnCompositor(const Timing& timing, int group, double startTime, double timeOffset, const KeyframeEffectModelBase& effect, Vector<OwnPtr<WebCompositorAnimation>>& animations, double animationPlaybackRate)
{
ASSERT(animations.isEmpty());
CompositorTiming compositorTiming;
- bool timingValid = convertTimingForCompositor(timing, timeOffset, compositorTiming, playerPlaybackRate);
+ bool timingValid = convertTimingForCompositor(timing, timeOffset, compositorTiming, animationPlaybackRate);
ASSERT_UNUSED(timingValid, timingValid);
PropertyHandleSet properties = effect.properties();
« no previous file with comments | « Source/core/animation/CompositorAnimations.h ('k') | Source/core/animation/CompositorAnimationsImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698