CC Animation: Expose TargetProperty enum to be aliased in Blink Platform.
TargetProperty is intended to be used as an alias in Source/platform/animation/CompositorTargetProperty.h
This is slightly better then untyped approach used here:
https://codereview.chromium.org/1599673002
where we setup struct with constants in it and pass uint32_t everywhere.
An alternative approach with strongly typed enum
considered too verbose:
https://codereview.chromium.org/1698813002/
BUG=577016
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1700653002
Cr-Commit-Position: refs/heads/master@{#377501}
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 5d0bd0d..ce1a7c5 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -34,6 +34,8 @@
"animation/layer_animation_value_provider.h",
"animation/scroll_offset_animation_curve.cc",
"animation/scroll_offset_animation_curve.h",
+ "animation/target_property.cc",
+ "animation/target_property.h",
"animation/timing_function.cc",
"animation/timing_function.h",
"animation/transform_operation.cc",
diff --git a/cc/animation/animation.cc b/cc/animation/animation.cc
index dfdaeb70..5c6fcd0f 100644
--- a/cc/animation/animation.cc
+++ b/cc/animation/animation.cc
@@ -27,27 +27,14 @@
"RunStateEnumSize should equal the number of elements in "
"s_runStateNames");
-// This should match the TargetProperty enum.
-static const char* const s_targetPropertyNames[] = {"TRANSFORM",
- "OPACITY",
- "FILTER",
- "SCROLL_OFFSET",
- "BACKGROUND_COLOR"};
-
-static_assert(static_cast<int>(cc::Animation::LAST_TARGET_PROPERTY) + 1 ==
- arraysize(s_targetPropertyNames),
- "TargetPropertyEnumSize should equal the number of elements in "
- "s_targetPropertyNames");
-
} // namespace
namespace cc {
-scoped_ptr<Animation> Animation::Create(
- scoped_ptr<AnimationCurve> curve,
- int animation_id,
- int group_id,
- TargetProperty target_property) {
+scoped_ptr<Animation> Animation::Create(scoped_ptr<AnimationCurve> curve,
+ int animation_id,
+ int group_id,
+ TargetProperty::Type target_property) {
return make_scoped_ptr(
new Animation(std::move(curve), animation_id, group_id, target_property));
}
@@ -55,7 +42,7 @@
Animation::Animation(scoped_ptr<AnimationCurve> curve,
int animation_id,
int group_id,
- TargetProperty target_property)
+ TargetProperty::Type target_property)
: curve_(std::move(curve)),
id_(animation_id),
group_(group_id),
@@ -85,11 +72,8 @@
return;
char name_buffer[256];
- base::snprintf(name_buffer,
- sizeof(name_buffer),
- "%s-%d",
- s_targetPropertyNames[target_property_],
- group_);
+ base::snprintf(name_buffer, sizeof(name_buffer), "%s-%d",
+ TargetProperty::GetName(target_property_), group_);
bool is_waiting_to_start =
run_state_ == WAITING_FOR_TARGET_AVAILABILITY || run_state_ == STARTING;
diff --git a/cc/animation/animation.h b/cc/animation/animation.h
index fb8f8d82..645b71f 100644
--- a/cc/animation/animation.h
+++ b/cc/animation/animation.h
@@ -8,6 +8,7 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
+#include "cc/animation/target_property.h"
#include "cc/base/cc_export.h"
namespace cc {
@@ -39,16 +40,6 @@
LAST_RUN_STATE = ABORTED
};
- enum TargetProperty {
- TRANSFORM = 0,
- OPACITY,
- FILTER,
- SCROLL_OFFSET,
- BACKGROUND_COLOR,
- // This sentinel must be last.
- LAST_TARGET_PROPERTY = BACKGROUND_COLOR
- };
-
enum Direction {
DIRECTION_NORMAL,
DIRECTION_REVERSE,
@@ -66,13 +57,13 @@
static scoped_ptr<Animation> Create(scoped_ptr<AnimationCurve> curve,
int animation_id,
int group_id,
- TargetProperty target_property);
+ TargetProperty::Type target_property);
virtual ~Animation();
int id() const { return id_; }
int group() const { return group_; }
- TargetProperty target_property() const { return target_property_; }
+ TargetProperty::Type target_property() const { return target_property_; }
RunState run_state() const { return run_state_; }
void SetRunState(RunState run_state, base::TimeTicks monotonic_time);
@@ -175,7 +166,7 @@
Animation(scoped_ptr<AnimationCurve> curve,
int animation_id,
int group_id,
- TargetProperty target_property);
+ TargetProperty::Type target_property);
base::TimeDelta ConvertToActiveTime(base::TimeTicks monotonic_time) const;
@@ -190,7 +181,7 @@
// all animations in the group have finished animating.
int group_;
- TargetProperty target_property_;
+ TargetProperty::Type target_property_;
RunState run_state_;
double iterations_;
double iteration_start_;
diff --git a/cc/animation/animation_delegate.h b/cc/animation/animation_delegate.h
index 6064c7e..732e693 100644
--- a/cc/animation/animation_delegate.h
+++ b/cc/animation/animation_delegate.h
@@ -13,15 +13,14 @@
class CC_EXPORT AnimationDelegate {
public:
virtual void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) = 0;
- virtual void NotifyAnimationFinished(
- base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
- int group) = 0;
+ virtual void NotifyAnimationFinished(base::TimeTicks monotonic_time,
+ TargetProperty::Type target_property,
+ int group) = 0;
virtual void NotifyAnimationAborted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) = 0;
protected:
diff --git a/cc/animation/animation_events.cc b/cc/animation/animation_events.cc
index bdf6592..edd435b7 100644
--- a/cc/animation/animation_events.cc
+++ b/cc/animation/animation_events.cc
@@ -9,7 +9,7 @@
AnimationEvent::AnimationEvent(AnimationEvent::Type type,
int layer_id,
int group_id,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
base::TimeTicks monotonic_time)
: type(type),
layer_id(layer_id),
@@ -17,8 +17,7 @@
target_property(target_property),
monotonic_time(monotonic_time),
is_impl_only(false),
- opacity(0.f) {
-}
+ opacity(0.f) {}
AnimationEvent::AnimationEvent(const AnimationEvent& other) = default;
diff --git a/cc/animation/animation_events.h b/cc/animation/animation_events.h
index b65a678b..650b9b5 100644
--- a/cc/animation/animation_events.h
+++ b/cc/animation/animation_events.h
@@ -20,14 +20,14 @@
AnimationEvent(Type type,
int layer_id,
int group_id,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
base::TimeTicks monotonic_time);
AnimationEvent(const AnimationEvent& other);
Type type;
int layer_id;
int group_id;
- Animation::TargetProperty target_property;
+ TargetProperty::Type target_property;
base::TimeTicks monotonic_time;
bool is_impl_only;
float opacity;
diff --git a/cc/animation/animation_host.cc b/cc/animation/animation_host.cc
index cf34e38..2165fe0c 100644
--- a/cc/animation/animation_host.cc
+++ b/cc/animation/animation_host.cc
@@ -54,7 +54,7 @@
scoped_ptr<Animation> animation = Animation::Create(
std::move(curve), AnimationIdProvider::NextAnimationId(),
- AnimationIdProvider::NextGroupId(), Animation::SCROLL_OFFSET);
+ AnimationIdProvider::NextGroupId(), TargetProperty::SCROLL_OFFSET);
animation->set_is_impl_only(true);
DCHECK(scroll_offset_animation_player_);
@@ -77,7 +77,7 @@
Animation* animation = scroll_offset_animation_player_->element_animations()
->layer_animation_controller()
- ->GetAnimation(Animation::SCROLL_OFFSET);
+ ->GetAnimation(TargetProperty::SCROLL_OFFSET);
if (!animation) {
scroll_offset_animation_player_->DetachLayer();
return false;
@@ -100,22 +100,23 @@
void ScrollAnimationAbort() {
DCHECK(scroll_offset_animation_player_);
- scroll_offset_animation_player_->AbortAnimations(Animation::SCROLL_OFFSET);
+ scroll_offset_animation_player_->AbortAnimations(
+ TargetProperty::SCROLL_OFFSET);
}
// AnimationDelegate implementation.
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {}
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
- DCHECK_EQ(target_property, Animation::SCROLL_OFFSET);
+ DCHECK_EQ(target_property, TargetProperty::SCROLL_OFFSET);
DCHECK(animation_host_->mutator_host_client());
animation_host_->mutator_host_client()->ScrollOffsetAnimationFinished();
}
void NotifyAnimationAborted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {}
private:
@@ -392,7 +393,7 @@
LayerAnimationController* controller = GetControllerForLayerId(layer_id);
return controller
? controller->IsCurrentlyAnimatingProperty(
- Animation::FILTER, ObserverTypeFromTreeType(tree_type))
+ TargetProperty::FILTER, ObserverTypeFromTreeType(tree_type))
: false;
}
@@ -401,7 +402,7 @@
LayerAnimationController* controller = GetControllerForLayerId(layer_id);
return controller
? controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, ObserverTypeFromTreeType(tree_type))
+ TargetProperty::OPACITY, ObserverTypeFromTreeType(tree_type))
: false;
}
@@ -411,7 +412,8 @@
LayerAnimationController* controller = GetControllerForLayerId(layer_id);
return controller
? controller->IsCurrentlyAnimatingProperty(
- Animation::TRANSFORM, ObserverTypeFromTreeType(tree_type))
+ TargetProperty::TRANSFORM,
+ ObserverTypeFromTreeType(tree_type))
: false;
}
@@ -421,7 +423,7 @@
LayerAnimationController* controller = GetControllerForLayerId(layer_id);
return controller
? controller->IsPotentiallyAnimatingProperty(
- Animation::FILTER, ObserverTypeFromTreeType(tree_type))
+ TargetProperty::FILTER, ObserverTypeFromTreeType(tree_type))
: false;
}
@@ -431,7 +433,7 @@
LayerAnimationController* controller = GetControllerForLayerId(layer_id);
return controller
? controller->IsPotentiallyAnimatingProperty(
- Animation::OPACITY, ObserverTypeFromTreeType(tree_type))
+ TargetProperty::OPACITY, ObserverTypeFromTreeType(tree_type))
: false;
}
@@ -441,13 +443,14 @@
LayerAnimationController* controller = GetControllerForLayerId(layer_id);
return controller
? controller->IsPotentiallyAnimatingProperty(
- Animation::TRANSFORM, ObserverTypeFromTreeType(tree_type))
+ TargetProperty::TRANSFORM,
+ ObserverTypeFromTreeType(tree_type))
: false;
}
bool AnimationHost::HasAnyAnimationTargetingProperty(
int layer_id,
- Animation::TargetProperty property) const {
+ TargetProperty::Type property) const {
LayerAnimationController* controller = GetControllerForLayerId(layer_id);
if (!controller)
return false;
@@ -460,7 +463,7 @@
if (!controller)
return false;
- Animation* animation = controller->GetAnimation(Animation::FILTER);
+ Animation* animation = controller->GetAnimation(TargetProperty::FILTER);
return animation && animation->is_impl_only();
}
@@ -469,7 +472,7 @@
if (!controller)
return false;
- Animation* animation = controller->GetAnimation(Animation::OPACITY);
+ Animation* animation = controller->GetAnimation(TargetProperty::OPACITY);
return animation && animation->is_impl_only();
}
@@ -478,7 +481,7 @@
if (!controller)
return false;
- Animation* animation = controller->GetAnimation(Animation::TRANSFORM);
+ Animation* animation = controller->GetAnimation(TargetProperty::TRANSFORM);
return animation && animation->is_impl_only();
}
diff --git a/cc/animation/animation_host.h b/cc/animation/animation_host.h
index 2cddf6a0..445209f 100644
--- a/cc/animation/animation_host.h
+++ b/cc/animation/animation_host.h
@@ -110,9 +110,8 @@
bool HasPotentiallyRunningTransformAnimation(int layer_id,
LayerTreeType tree_type) const;
- bool HasAnyAnimationTargetingProperty(
- int layer_id,
- Animation::TargetProperty property) const;
+ bool HasAnyAnimationTargetingProperty(int layer_id,
+ TargetProperty::Type property) const;
bool FilterIsAnimatingOnImplOnly(int layer_id) const;
bool OpacityIsAnimatingOnImplOnly(int layer_id) const;
diff --git a/cc/animation/animation_player.cc b/cc/animation/animation_player.cc
index 52fa9a8..0c8ad3c 100644
--- a/cc/animation/animation_player.cc
+++ b/cc/animation/animation_player.cc
@@ -119,7 +119,7 @@
}
void AnimationPlayer::AddAnimation(scoped_ptr<Animation> animation) {
- DCHECK(animation->target_property() != Animation::SCROLL_OFFSET ||
+ DCHECK(animation->target_property() != TargetProperty::SCROLL_OFFSET ||
(animation_host_ && animation_host_->SupportsScrollAnimations()));
if (element_animations_) {
@@ -160,8 +160,7 @@
SetNeedsCommit();
}
-void AnimationPlayer::AbortAnimations(
- Animation::TargetProperty target_property) {
+void AnimationPlayer::AbortAnimations(TargetProperty::Type target_property) {
if (element_animations_) {
element_animations_->layer_animation_controller()->AbortAnimations(
target_property);
@@ -187,7 +186,7 @@
void AnimationPlayer::NotifyAnimationStarted(
base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) {
if (layer_animation_delegate_)
layer_animation_delegate_->NotifyAnimationStarted(monotonic_time,
@@ -196,7 +195,7 @@
void AnimationPlayer::NotifyAnimationFinished(
base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) {
if (layer_animation_delegate_)
layer_animation_delegate_->NotifyAnimationFinished(monotonic_time,
@@ -205,7 +204,7 @@
void AnimationPlayer::NotifyAnimationAborted(
base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) {
if (layer_animation_delegate_)
layer_animation_delegate_->NotifyAnimationAborted(monotonic_time,
diff --git a/cc/animation/animation_player.h b/cc/animation/animation_player.h
index 7d04c56..97883ac 100644
--- a/cc/animation/animation_player.h
+++ b/cc/animation/animation_player.h
@@ -69,19 +69,19 @@
void PauseAnimation(int animation_id, double time_offset);
void RemoveAnimation(int animation_id);
void AbortAnimation(int animation_id);
- void AbortAnimations(Animation::TargetProperty target_property);
+ void AbortAnimations(TargetProperty::Type target_property);
void PushPropertiesTo(AnimationPlayer* player_impl);
// AnimationDelegate routing.
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group);
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group);
void NotifyAnimationAborted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group);
// Whether this player has animations waiting to get sent to LAC.
diff --git a/cc/animation/animation_player_unittest.cc b/cc/animation/animation_player_unittest.cc
index d8030b3..6e165fd 100644
--- a/cc/animation/animation_player_unittest.cc
+++ b/cc/animation/animation_player_unittest.cc
@@ -123,18 +123,18 @@
host_->PushPropertiesTo(host_impl_);
EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
- Animation::TRANSFORM));
+ TargetProperty::TRANSFORM));
EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
- Animation::FILTER));
+ TargetProperty::FILTER));
EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
- Animation::TRANSFORM));
+ TargetProperty::TRANSFORM));
EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
- Animation::FILTER));
+ TargetProperty::FILTER));
host_impl_->animation_registrar()->ActivateAnimations();
@@ -278,14 +278,14 @@
host_->PushPropertiesTo(host_impl_);
EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
- Animation::FILTER));
+ TargetProperty::FILTER));
EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
- Animation::FILTER));
+ TargetProperty::FILTER));
host_impl_->animation_registrar()->ActivateAnimations();
@@ -304,9 +304,9 @@
end_opacity);
EXPECT_FALSE(client_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
- Animation::FILTER));
+ TargetProperty::FILTER));
EXPECT_FALSE(client_impl_.IsPropertyMutated(layer_id_, LayerTreeType::ACTIVE,
- Animation::FILTER));
+ TargetProperty::FILTER));
}
TEST_F(AnimationPlayerTest, AddRemoveAnimationCausesSetNeedsCommit) {
diff --git a/cc/animation/animation_unittest.cc b/cc/animation/animation_unittest.cc
index 5a08912..3bb984a 100644
--- a/cc/animation/animation_unittest.cc
+++ b/cc/animation/animation_unittest.cc
@@ -23,7 +23,7 @@
double playback_rate) {
scoped_ptr<Animation> to_return(
Animation::Create(make_scoped_ptr(new FakeFloatAnimationCurve(duration)),
- 0, 1, Animation::OPACITY));
+ 0, 1, TargetProperty::OPACITY));
to_return->set_iterations(iterations);
to_return->set_playback_rate(playback_rate);
return to_return;
diff --git a/cc/animation/element_animations.cc b/cc/animation/element_animations.cc
index cd3a736..e3c2224 100644
--- a/cc/animation/element_animations.cc
+++ b/cc/animation/element_animations.cc
@@ -239,7 +239,7 @@
void ElementAnimations::NotifyAnimationStarted(
base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) {
for (PlayersListNode* node = players_list_->head();
node != players_list_->end(); node = node->next()) {
@@ -250,7 +250,7 @@
void ElementAnimations::NotifyAnimationFinished(
base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) {
for (PlayersListNode* node = players_list_->head();
node != players_list_->end(); node = node->next()) {
@@ -261,7 +261,7 @@
void ElementAnimations::NotifyAnimationAborted(
base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) {
for (PlayersListNode* node = players_list_->head();
node != players_list_->end(); node = node->next()) {
diff --git a/cc/animation/element_animations.h b/cc/animation/element_animations.h
index 90090cfe..1c5ecc39 100644
--- a/cc/animation/element_animations.h
+++ b/cc/animation/element_animations.h
@@ -95,13 +95,13 @@
// AnimationDelegate implementation
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override;
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override;
void NotifyAnimationAborted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override;
// LayerAnimationValueProvider implementation.
diff --git a/cc/animation/layer_animation_controller.cc b/cc/animation/layer_animation_controller.cc
index 6aa254c..1e8aa02ea 100644
--- a/cc/animation/layer_animation_controller.cc
+++ b/cc/animation/layer_animation_controller.cc
@@ -66,7 +66,7 @@
for (const auto& animation : animations_) {
if (!animation->is_finished() &&
- animation->target_property() == Animation::TRANSFORM) {
+ animation->target_property() == TargetProperty::TRANSFORM) {
potentially_animating_transform_for_active_observers_ |=
animation->affects_active_observers();
potentially_animating_transform_for_pending_observers_ |=
@@ -99,9 +99,9 @@
return animation->id() != animation_id;
});
for (auto it = animations_to_remove; it != animations_.end(); ++it) {
- if ((*it)->target_property() == Animation::SCROLL_OFFSET) {
+ if ((*it)->target_property() == TargetProperty::SCROLL_OFFSET) {
scroll_offset_animation_was_interrupted_ = true;
- } else if ((*it)->target_property() == Animation::TRANSFORM &&
+ } else if ((*it)->target_property() == TargetProperty::TRANSFORM &&
!(*it)->is_finished()) {
removed_transform_animation = true;
}
@@ -118,7 +118,7 @@
if (Animation* animation = GetAnimationById(animation_id)) {
if (!animation->is_finished()) {
animation->SetRunState(Animation::ABORTED, last_tick_time_);
- if (animation->target_property() == Animation::TRANSFORM)
+ if (animation->target_property() == TargetProperty::TRANSFORM)
aborted_transform_animation = true;
}
}
@@ -127,13 +127,13 @@
}
void LayerAnimationController::AbortAnimations(
- Animation::TargetProperty target_property) {
+ TargetProperty::Type target_property) {
bool aborted_transform_animation = false;
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->target_property() == target_property &&
!animations_[i]->is_finished()) {
animations_[i]->SetRunState(Animation::ABORTED, last_tick_time_);
- if (target_property == Animation::TRANSFORM)
+ if (target_property == TargetProperty::TRANSFORM)
aborted_transform_animation = true;
}
}
@@ -190,9 +190,9 @@
base::TimeDelta trimmed =
animation->TrimTimeToCurrentIteration(monotonic_time);
switch (animation->target_property()) {
- case Animation::OPACITY: {
+ case TargetProperty::OPACITY: {
AnimationEvent event(AnimationEvent::PROPERTY_UPDATE, id_,
- animation->group(), Animation::OPACITY,
+ animation->group(), TargetProperty::OPACITY,
monotonic_time);
const FloatAnimationCurve* float_animation_curve =
animation->curve()->ToFloatAnimationCurve();
@@ -202,9 +202,9 @@
break;
}
- case Animation::TRANSFORM: {
+ case TargetProperty::TRANSFORM: {
AnimationEvent event(AnimationEvent::PROPERTY_UPDATE, id_,
- animation->group(), Animation::TRANSFORM,
+ animation->group(), TargetProperty::TRANSFORM,
monotonic_time);
const TransformAnimationCurve* transform_animation_curve =
animation->curve()->ToTransformAnimationCurve();
@@ -214,9 +214,9 @@
break;
}
- case Animation::FILTER: {
+ case TargetProperty::FILTER: {
AnimationEvent event(AnimationEvent::PROPERTY_UPDATE, id_,
- animation->group(), Animation::FILTER,
+ animation->group(), TargetProperty::FILTER,
monotonic_time);
const FilterAnimationCurve* filter_animation_curve =
animation->curve()->ToFilterAnimationCurve();
@@ -226,11 +226,11 @@
break;
}
- case Animation::BACKGROUND_COLOR: {
+ case TargetProperty::BACKGROUND_COLOR: {
break;
}
- case Animation::SCROLL_OFFSET: {
+ case TargetProperty::SCROLL_OFFSET: {
// Impl-side changes to scroll offset are already sent back to the
// main thread (e.g. for user-driven scrolling), so a PROPERTY_UPDATE
// isn't needed.
@@ -271,7 +271,7 @@
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->affects_active_observers() !=
animations_[i]->affects_pending_observers() &&
- animations_[i]->target_property() == Animation::TRANSFORM)
+ animations_[i]->target_property() == TargetProperty::TRANSFORM)
changed_transform_animation = true;
animations_[i]->set_affects_active_observers(
animations_[i]->affects_pending_observers());
@@ -291,7 +291,7 @@
void LayerAnimationController::AddAnimation(scoped_ptr<Animation> animation) {
bool added_transform_animation =
- animation->target_property() == Animation::TRANSFORM;
+ animation->target_property() == TargetProperty::TRANSFORM;
animations_.push_back(std::move(animation));
needs_to_start_animations_ = true;
UpdateActivation(NORMAL_ACTIVATION);
@@ -300,7 +300,7 @@
}
Animation* LayerAnimationController::GetAnimation(
- Animation::TargetProperty target_property) const {
+ TargetProperty::Type target_property) const {
for (size_t i = 0; i < animations_.size(); ++i) {
size_t index = animations_.size() - i - 1;
if (animations_[index]->target_property() == target_property)
@@ -325,7 +325,7 @@
}
bool LayerAnimationController::IsPotentiallyAnimatingProperty(
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
ObserverType observer_type) const {
for (size_t i = 0; i < animations_.size(); ++i) {
if (!animations_[i]->is_finished() &&
@@ -341,7 +341,7 @@
}
bool LayerAnimationController::IsCurrentlyAnimatingProperty(
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
ObserverType observer_type) const {
for (size_t i = 0; i < animations_.size(); ++i) {
if (!animations_[i]->is_finished() &&
@@ -435,7 +435,7 @@
if (layer_animation_delegate_)
layer_animation_delegate_->NotifyAnimationAborted(
event.monotonic_time, event.target_property, event.group_id);
- if (event.target_property == Animation::TRANSFORM)
+ if (event.target_property == TargetProperty::TRANSFORM)
aborted_transform_animation = true;
}
}
@@ -448,11 +448,11 @@
bool notify_active_observers = true;
bool notify_pending_observers = true;
switch (event.target_property) {
- case Animation::OPACITY:
+ case TargetProperty::OPACITY:
NotifyObserversOpacityAnimated(
event.opacity, notify_active_observers, notify_pending_observers);
break;
- case Animation::TRANSFORM:
+ case TargetProperty::TRANSFORM:
NotifyObserversTransformAnimated(
event.transform, notify_active_observers, notify_pending_observers);
break;
@@ -486,7 +486,7 @@
bool LayerAnimationController::HasFilterAnimationThatInflatesBounds() const {
for (size_t i = 0; i < animations_.size(); ++i) {
if (!animations_[i]->is_finished() &&
- animations_[i]->target_property() == Animation::FILTER &&
+ animations_[i]->target_property() == TargetProperty::FILTER &&
animations_[i]
->curve()
->ToFilterAnimationCurve()
@@ -498,9 +498,9 @@
}
bool LayerAnimationController::HasTransformAnimationThatInflatesBounds() const {
- return IsCurrentlyAnimatingProperty(Animation::TRANSFORM,
+ return IsCurrentlyAnimatingProperty(TargetProperty::TRANSFORM,
ObserverType::ACTIVE) ||
- IsCurrentlyAnimatingProperty(Animation::TRANSFORM,
+ IsCurrentlyAnimatingProperty(TargetProperty::TRANSFORM,
ObserverType::PENDING);
}
@@ -525,7 +525,7 @@
*bounds = gfx::BoxF();
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->is_finished() ||
- animations_[i]->target_property() != Animation::TRANSFORM)
+ animations_[i]->target_property() != TargetProperty::TRANSFORM)
continue;
const TransformAnimationCurve* transform_animation_curve =
@@ -544,7 +544,7 @@
bool LayerAnimationController::HasAnimationThatAffectsScale() const {
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->is_finished() ||
- animations_[i]->target_property() != Animation::TRANSFORM)
+ animations_[i]->target_property() != TargetProperty::TRANSFORM)
continue;
const TransformAnimationCurve* transform_animation_curve =
@@ -560,7 +560,7 @@
ObserverType observer_type) const {
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->is_finished() ||
- animations_[i]->target_property() != Animation::TRANSFORM)
+ animations_[i]->target_property() != TargetProperty::TRANSFORM)
continue;
if ((observer_type == ObserverType::ACTIVE &&
@@ -581,7 +581,7 @@
bool LayerAnimationController::AnimationsPreserveAxisAlignment() const {
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->is_finished() ||
- animations_[i]->target_property() != Animation::TRANSFORM)
+ animations_[i]->target_property() != TargetProperty::TRANSFORM)
continue;
const TransformAnimationCurve* transform_animation_curve =
@@ -598,7 +598,7 @@
*start_scale = 0.f;
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->is_finished() ||
- animations_[i]->target_property() != Animation::TRANSFORM)
+ animations_[i]->target_property() != TargetProperty::TRANSFORM)
continue;
if ((observer_type == ObserverType::ACTIVE &&
@@ -635,7 +635,7 @@
*max_scale = 0.f;
for (size_t i = 0; i < animations_.size(); ++i) {
if (animations_[i]->is_finished() ||
- animations_[i]->target_property() != Animation::TRANSFORM)
+ animations_[i]->target_property() != TargetProperty::TRANSFORM)
continue;
if ((observer_type == ObserverType::ACTIVE &&
@@ -678,7 +678,7 @@
if (controller_impl->GetAnimationById(animations_[i]->id()))
continue;
- if (animations_[i]->target_property() == Animation::SCROLL_OFFSET &&
+ if (animations_[i]->target_property() == TargetProperty::SCROLL_OFFSET &&
!animations_[i]
->curve()
->ToScrollOffsetAnimationCurve()
@@ -728,7 +728,7 @@
for (const auto& animation : animations) {
if (IsCompleted(animation.get(), this)) {
animation->set_affects_pending_observers(false);
- if (animation->target_property() == Animation::TRANSFORM)
+ if (animation->target_property() == TargetProperty::TRANSFORM)
removed_transform_animation = true;
}
}
@@ -884,7 +884,7 @@
if (!animations_[i]->is_finished() &&
animations_[i]->IsFinishedAt(monotonic_time)) {
animations_[i]->SetRunState(Animation::FINISHED, monotonic_time);
- if (animations_[i]->target_property() == Animation::TRANSFORM) {
+ if (animations_[i]->target_property() == TargetProperty::TRANSFORM) {
finished_transform_animation = true;
}
}
@@ -1006,7 +1006,7 @@
controller_impl->last_tick_time_);
animation->SetRunState(Animation::WAITING_FOR_DELETION,
last_tick_time_);
- if (animation_impl->target_property() == Animation::TRANSFORM) {
+ if (animation_impl->target_property() == TargetProperty::TRANSFORM) {
aborted_transform_animation = true;
}
}
@@ -1038,7 +1038,7 @@
animations_[i]->TrimTimeToCurrentIteration(monotonic_time);
switch (animations_[i]->target_property()) {
- case Animation::TRANSFORM: {
+ case TargetProperty::TRANSFORM: {
const TransformAnimationCurve* transform_animation_curve =
animations_[i]->curve()->ToTransformAnimationCurve();
const gfx::Transform transform =
@@ -1050,7 +1050,7 @@
break;
}
- case Animation::OPACITY: {
+ case TargetProperty::OPACITY: {
const FloatAnimationCurve* float_animation_curve =
animations_[i]->curve()->ToFloatAnimationCurve();
const float opacity = std::max(
@@ -1062,7 +1062,7 @@
break;
}
- case Animation::FILTER: {
+ case TargetProperty::FILTER: {
const FilterAnimationCurve* filter_animation_curve =
animations_[i]->curve()->ToFilterAnimationCurve();
const FilterOperations filter =
@@ -1074,12 +1074,12 @@
break;
}
- case Animation::BACKGROUND_COLOR: {
+ case TargetProperty::BACKGROUND_COLOR: {
// Not yet implemented.
break;
}
- case Animation::SCROLL_OFFSET: {
+ case TargetProperty::SCROLL_OFFSET: {
const ScrollOffsetAnimationCurve* scroll_offset_animation_curve =
animations_[i]->curve()->ToScrollOffsetAnimationCurve();
const gfx::ScrollOffset scroll_offset =
diff --git a/cc/animation/layer_animation_controller.h b/cc/animation/layer_animation_controller.h
index 70c76d10..a364172c 100644
--- a/cc/animation/layer_animation_controller.h
+++ b/cc/animation/layer_animation_controller.h
@@ -47,7 +47,7 @@
void PauseAnimation(int animation_id, base::TimeDelta time_offset);
void RemoveAnimation(int animation_id);
void AbortAnimation(int animation_id);
- void AbortAnimations(Animation::TargetProperty target_property);
+ void AbortAnimations(TargetProperty::Type target_property);
// Ensures that the list of active animations on the main thread and the impl
// thread are kept in sync. This function does not take ownership of the impl
@@ -68,7 +68,7 @@
// Returns the active animation animating the given property that is either
// running, or is next to run, if such an animation exists.
- Animation* GetAnimation(Animation::TargetProperty target_property) const;
+ Animation* GetAnimation(TargetProperty::Type target_property) const;
// Returns the active animation for the given unique animation id.
Animation* GetAnimationById(int animation_id) const;
@@ -83,12 +83,12 @@
// Returns true if there is an animation that is either currently animating
// the given property or scheduled to animate this property in the future, and
// that affects the given observer type.
- bool IsPotentiallyAnimatingProperty(Animation::TargetProperty target_property,
+ bool IsPotentiallyAnimatingProperty(TargetProperty::Type target_property,
ObserverType observer_type) const;
// Returns true if there is an animation that is currently animating the given
// property and that affects the given observer type.
- bool IsCurrentlyAnimatingProperty(Animation::TargetProperty target_property,
+ bool IsCurrentlyAnimatingProperty(TargetProperty::Type target_property,
ObserverType observer_type) const;
void SetAnimationRegistrar(AnimationRegistrar* registrar);
diff --git a/cc/animation/layer_animation_controller_unittest.cc b/cc/animation/layer_animation_controller_unittest.cc
index 2f5f37e..764b4709 100644
--- a/cc/animation/layer_animation_controller_unittest.cc
+++ b/cc/animation/layer_animation_controller_unittest.cc
@@ -38,7 +38,7 @@
scoped_ptr<Animation> CreateAnimation(scoped_ptr<AnimationCurve> curve,
int group_id,
- Animation::TargetProperty property) {
+ TargetProperty::Type property) {
return Animation::Create(std::move(curve), 0, group_id, property);
}
@@ -52,7 +52,7 @@
LayerAnimationController::Create(0));
controller->AddValueObserver(&dummy);
- EXPECT_FALSE(controller_impl->GetAnimation(Animation::OPACITY));
+ EXPECT_FALSE(controller_impl->GetAnimation(TargetProperty::OPACITY));
EXPECT_FALSE(controller->needs_to_start_animations_for_testing());
EXPECT_FALSE(controller_impl->needs_to_start_animations_for_testing());
@@ -85,7 +85,7 @@
controller->AddValueObserver(&dummy);
controller->set_value_provider(&dummy_provider);
- EXPECT_FALSE(controller_impl->GetAnimation(Animation::SCROLL_OFFSET));
+ EXPECT_FALSE(controller_impl->GetAnimation(TargetProperty::SCROLL_OFFSET));
EXPECT_FALSE(controller->needs_to_start_animations_for_testing());
EXPECT_FALSE(controller_impl->needs_to_start_animations_for_testing());
@@ -103,7 +103,7 @@
curve_fixed->SetInitialValue(initial_value);
scoped_ptr<Animation> animation_fixed(
Animation::Create(std::move(curve_fixed), 1 /* animation_id */, 0,
- Animation::SCROLL_OFFSET));
+ TargetProperty::SCROLL_OFFSET));
controller->AddAnimation(std::move(animation_fixed));
controller->PushAnimationUpdatesTo(controller_impl.get());
EXPECT_VECTOR2DF_EQ(initial_value, controller_impl->GetAnimationById(1)
@@ -115,8 +115,9 @@
scoped_ptr<ScrollOffsetAnimationCurve> curve(
ScrollOffsetAnimationCurve::Create(target_value,
EaseInOutTimingFunction::Create()));
- scoped_ptr<Animation> animation(Animation::Create(
- std::move(curve), 2 /* animation id */, 0, Animation::SCROLL_OFFSET));
+ scoped_ptr<Animation> animation(
+ Animation::Create(std::move(curve), 2 /* animation id */, 0,
+ TargetProperty::SCROLL_OFFSET));
controller->AddAnimation(std::move(animation));
controller->PushAnimationUpdatesTo(controller_impl.get());
EXPECT_VECTOR2DF_EQ(provider_initial_value,
@@ -138,7 +139,7 @@
LayerAnimationController::Create(0));
controller->AddValueObserver(&dummy);
- EXPECT_FALSE(controller_impl->GetAnimation(Animation::OPACITY));
+ EXPECT_FALSE(controller_impl->GetAnimation(TargetProperty::OPACITY));
int animation_id =
AddOpacityTransitionToController(controller.get(), 1, 0, 1, false);
@@ -181,7 +182,7 @@
AddOpacityTransitionToController(controller.get(), 1, 0, 1, false);
const TimeTicks start_time = TicksFromSecondsF(123);
- controller->GetAnimation(Animation::OPACITY)->set_start_time(start_time);
+ controller->GetAnimation(TargetProperty::OPACITY)->set_start_time(start_time);
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
@@ -264,7 +265,7 @@
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1000));
controller->UpdateState(true, nullptr);
EXPECT_EQ(Animation::FINISHED,
- controller->GetAnimation(Animation::OPACITY)->run_state());
+ controller->GetAnimation(TargetProperty::OPACITY)->run_state());
EXPECT_EQ(1u, registrar->active_animation_controllers_for_testing().size());
events.reset(new AnimationEvents);
@@ -272,8 +273,9 @@
TimeDelta::FromMilliseconds(1500));
controller_impl->UpdateState(true, events.get());
- EXPECT_EQ(Animation::WAITING_FOR_DELETION,
- controller_impl->GetAnimation(Animation::OPACITY)->run_state());
+ EXPECT_EQ(
+ Animation::WAITING_FOR_DELETION,
+ controller_impl->GetAnimation(TargetProperty::OPACITY)->run_state());
// The impl thread controller should have de-activated.
EXPECT_EQ(0u,
registrar_impl->active_animation_controllers_for_testing().size());
@@ -284,7 +286,7 @@
controller->UpdateState(true, nullptr);
EXPECT_EQ(Animation::WAITING_FOR_DELETION,
- controller->GetAnimation(Animation::OPACITY)->run_state());
+ controller->GetAnimation(TargetProperty::OPACITY)->run_state());
// The main thread controller should have de-activated.
EXPECT_EQ(0u, registrar->active_animation_controllers_for_testing().size());
@@ -310,7 +312,7 @@
LayerAnimationController::Create(0));
controller->AddValueObserver(&dummy);
- EXPECT_FALSE(controller_impl->GetAnimation(Animation::OPACITY));
+ EXPECT_FALSE(controller_impl->GetAnimation(TargetProperty::OPACITY));
// Two steps, three ranges: [0-1) -> 0.2, [1-2) -> 0.3, [2-3] -> 0.4.
const double duration = 3.0;
@@ -387,7 +389,7 @@
controller->AddValueObserver(&dummy);
scoped_ptr<AnimationEvents> events(make_scoped_ptr(new AnimationEvents));
- EXPECT_FALSE(controller_impl->GetAnimation(Animation::OPACITY));
+ EXPECT_FALSE(controller_impl->GetAnimation(TargetProperty::OPACITY));
int animation_id =
AddOpacityTransitionToController(controller.get(), 1, 0, 1, false);
@@ -471,8 +473,8 @@
EXPECT_EQ(AnimationEvent::FINISHED, events->events_[0].type);
// Neither controller should have deleted the animation yet.
- EXPECT_TRUE(controller->GetAnimation(Animation::OPACITY));
- EXPECT_TRUE(controller_impl->GetAnimation(Animation::OPACITY));
+ EXPECT_TRUE(controller->GetAnimation(TargetProperty::OPACITY));
+ EXPECT_TRUE(controller_impl->GetAnimation(TargetProperty::OPACITY));
controller->NotifyAnimationFinished(events->events_[0]);
@@ -511,7 +513,7 @@
scoped_ptr<Animation> to_add(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 1,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
EXPECT_FALSE(controller->needs_to_start_animations_for_testing());
controller->AddAnimation(std::move(to_add));
@@ -541,7 +543,7 @@
scoped_ptr<Animation> to_add(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 1,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
to_add->set_is_impl_only(true);
controller_impl->AddAnimation(std::move(to_add));
@@ -589,7 +591,7 @@
base::TimeDelta::FromSecondsD(1.0), operations, nullptr));
scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve), 1, 0, Animation::TRANSFORM));
+ Animation::Create(std::move(curve), 1, 0, TargetProperty::TRANSFORM));
animation->set_is_impl_only(true);
controller_impl->AddAnimation(std::move(animation));
@@ -640,7 +642,7 @@
end_filters, nullptr));
scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve), 1, 0, Animation::FILTER));
+ Animation::Create(std::move(curve), 1, 0, TargetProperty::FILTER));
controller->AddAnimation(std::move(animation));
controller->Animate(kInitialTickTime);
@@ -688,7 +690,7 @@
end_filters, nullptr));
scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve), 1, 0, Animation::FILTER));
+ Animation::Create(std::move(curve), 1, 0, TargetProperty::FILTER));
animation->set_is_impl_only(true);
controller_impl->AddAnimation(std::move(animation));
@@ -739,20 +741,21 @@
EaseInOutTimingFunction::Create()));
scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve), 1, 0, Animation::SCROLL_OFFSET));
+ Animation::Create(std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET));
animation->set_needs_synchronized_start_time(true);
controller->AddAnimation(std::move(animation));
dummy_provider_impl.set_scroll_offset(initial_value);
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
- EXPECT_TRUE(controller_impl->GetAnimation(Animation::SCROLL_OFFSET));
- TimeDelta duration = controller_impl->GetAnimation(Animation::SCROLL_OFFSET)
- ->curve()
- ->Duration();
- EXPECT_EQ(
- duration,
- controller->GetAnimation(Animation::SCROLL_OFFSET)->curve()->Duration());
+ EXPECT_TRUE(controller_impl->GetAnimation(TargetProperty::SCROLL_OFFSET));
+ TimeDelta duration =
+ controller_impl->GetAnimation(TargetProperty::SCROLL_OFFSET)
+ ->curve()
+ ->Duration();
+ EXPECT_EQ(duration, controller->GetAnimation(TargetProperty::SCROLL_OFFSET)
+ ->curve()
+ ->Duration());
controller->Animate(kInitialTickTime);
controller->UpdateState(true, nullptr);
@@ -816,20 +819,21 @@
EaseInOutTimingFunction::Create()));
scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve), 1, 0, Animation::SCROLL_OFFSET));
+ Animation::Create(std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET));
animation->set_needs_synchronized_start_time(true);
controller->AddAnimation(std::move(animation));
dummy_provider.set_scroll_offset(initial_value);
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
- EXPECT_TRUE(controller_impl->GetAnimation(Animation::SCROLL_OFFSET));
- TimeDelta duration = controller_impl->GetAnimation(Animation::SCROLL_OFFSET)
- ->curve()
- ->Duration();
- EXPECT_EQ(
- duration,
- controller->GetAnimation(Animation::SCROLL_OFFSET)->curve()->Duration());
+ EXPECT_TRUE(controller_impl->GetAnimation(TargetProperty::SCROLL_OFFSET));
+ TimeDelta duration =
+ controller_impl->GetAnimation(TargetProperty::SCROLL_OFFSET)
+ ->curve()
+ ->Duration();
+ EXPECT_EQ(duration, controller->GetAnimation(TargetProperty::SCROLL_OFFSET)
+ ->curve()
+ ->Duration());
controller->Animate(kInitialTickTime);
controller->UpdateState(true, nullptr);
@@ -886,7 +890,7 @@
double duration_in_seconds = curve->Duration().InSecondsF();
scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve), 1, 0, Animation::SCROLL_OFFSET));
+ Animation::Create(std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET));
animation->set_is_impl_only(true);
controller_impl->AddAnimation(std::move(animation));
@@ -939,7 +943,7 @@
int animation_id = 1;
scoped_ptr<Animation> animation(Animation::Create(
- std::move(curve), animation_id, 0, Animation::SCROLL_OFFSET));
+ std::move(curve), animation_id, 0, TargetProperty::SCROLL_OFFSET));
animation->set_needs_synchronized_start_time(true);
controller->AddAnimation(std::move(animation));
controller->PushAnimationUpdatesTo(controller_impl.get());
@@ -961,7 +965,7 @@
curve = ScrollOffsetAnimationCurve::Create(target_value,
EaseInOutTimingFunction::Create());
animation = Animation::Create(std::move(curve), animation_id, 0,
- Animation::SCROLL_OFFSET);
+ TargetProperty::SCROLL_OFFSET);
animation->set_needs_synchronized_start_time(true);
controller->AddAnimation(std::move(animation));
controller->PushAnimationUpdatesTo(controller_impl.get());
@@ -1024,20 +1028,20 @@
start_time_(base::TimeTicks()) {}
void NotifyAnimationStarted(TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
started_ = true;
start_time_ = monotonic_time;
}
void NotifyAnimationFinished(TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
finished_ = true;
}
void NotifyAnimationAborted(TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
aborted_ = true;
}
@@ -1071,7 +1075,7 @@
scoped_ptr<Animation> to_add(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 1,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
to_add->set_is_impl_only(true);
controller_impl->AddAnimation(std::move(to_add));
@@ -1111,7 +1115,7 @@
AddOpacityTransitionToController(controller.get(), 1, 0, 1, false);
const TimeTicks start_time = TicksFromSecondsF(123);
- controller->GetAnimation(Animation::OPACITY)->set_start_time(start_time);
+ controller->GetAnimation(TargetProperty::OPACITY)->set_start_time(start_time);
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
@@ -1163,7 +1167,7 @@
AddOpacityTransitionToController(controller.get(), 1, 0, 1, false);
const TimeTicks start_time = TicksFromSecondsF(123);
- controller->GetAnimation(Animation::OPACITY)->set_start_time(start_time);
+ controller->GetAnimation(TargetProperty::OPACITY)->set_start_time(start_time);
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
@@ -1196,7 +1200,7 @@
scoped_ptr<Animation> to_add(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 1,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
to_add->set_needs_synchronized_start_time(true);
// We should pause at the first keyframe indefinitely waiting for that
@@ -1217,7 +1221,7 @@
// Send the synchronized start time.
controller->NotifyAnimationStarted(
- AnimationEvent(AnimationEvent::STARTED, 0, 1, Animation::OPACITY,
+ AnimationEvent(AnimationEvent::STARTED, 0, 1, TargetProperty::OPACITY,
kInitialTickTime + TimeDelta::FromMilliseconds(2000)));
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(5000));
controller->UpdateState(true, events.get());
@@ -1237,10 +1241,10 @@
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 1,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.5f)), 2,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
EXPECT_TRUE(controller->needs_to_start_animations_for_testing());
@@ -1275,7 +1279,7 @@
controller->AddValueObserver(&dummy);
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 1,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
controller->Animate(kInitialTickTime);
controller->UpdateState(true, events.get());
EXPECT_TRUE(controller->HasActiveAnimation());
@@ -1283,8 +1287,8 @@
scoped_ptr<Animation> to_add(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.5f)), 2,
- Animation::OPACITY));
- controller->AbortAnimations(Animation::OPACITY);
+ TargetProperty::OPACITY));
+ controller->AbortAnimations(TargetProperty::OPACITY);
controller->AddAnimation(std::move(to_add));
// Since the previous animation was aborted, the new animation should start
@@ -1310,13 +1314,13 @@
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(1)), 1,
- Animation::TRANSFORM));
+ TargetProperty::TRANSFORM));
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(1)), 2,
- Animation::TRANSFORM));
+ TargetProperty::TRANSFORM));
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 2,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
controller->Animate(kInitialTickTime);
controller->UpdateState(true, events.get());
@@ -1346,13 +1350,13 @@
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(2)), 1,
- Animation::TRANSFORM));
+ TargetProperty::TRANSFORM));
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 1,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.5f)), 2,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
// Animations with id 1 should both start now.
controller->Animate(kInitialTickTime);
@@ -1386,7 +1390,7 @@
scoped_ptr<Animation> to_add(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 1,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
to_add->set_iterations(3);
controller->AddAnimation(std::move(to_add));
@@ -1431,7 +1435,7 @@
scoped_ptr<Animation> to_add(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 1,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
to_add->set_iterations(-1);
controller->AddAnimation(std::move(to_add));
@@ -1459,8 +1463,8 @@
EXPECT_TRUE(controller->HasActiveAnimation());
EXPECT_EQ(0.75f, dummy.opacity());
- EXPECT_TRUE(controller->GetAnimation(Animation::OPACITY));
- controller->GetAnimation(Animation::OPACITY)
+ EXPECT_TRUE(controller->GetAnimation(TargetProperty::OPACITY));
+ controller->GetAnimation(TargetProperty::OPACITY)
->SetRunState(Animation::ABORTED,
kInitialTickTime + TimeDelta::FromMilliseconds(750));
EXPECT_FALSE(controller->HasActiveAnimation());
@@ -1477,7 +1481,7 @@
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 1,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
controller->Animate(kInitialTickTime);
controller->UpdateState(true, events.get());
@@ -1488,8 +1492,8 @@
EXPECT_TRUE(controller->HasActiveAnimation());
EXPECT_EQ(0.5f, dummy.opacity());
- EXPECT_TRUE(controller->GetAnimation(Animation::OPACITY));
- controller->GetAnimation(Animation::OPACITY)
+ EXPECT_TRUE(controller->GetAnimation(TargetProperty::OPACITY));
+ controller->GetAnimation(TargetProperty::OPACITY)
->SetRunState(Animation::PAUSED,
kInitialTickTime + TimeDelta::FromMilliseconds(500));
@@ -1498,8 +1502,8 @@
EXPECT_TRUE(controller->HasActiveAnimation());
EXPECT_EQ(0.5f, dummy.opacity());
- EXPECT_TRUE(controller->GetAnimation(Animation::OPACITY));
- controller->GetAnimation(Animation::OPACITY)
+ EXPECT_TRUE(controller->GetAnimation(TargetProperty::OPACITY));
+ controller->GetAnimation(TargetProperty::OPACITY)
->SetRunState(Animation::RUNNING,
kInitialTickTime + TimeDelta::FromMilliseconds(1024000));
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(1024250));
@@ -1523,13 +1527,13 @@
const int animation_id = 2;
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(1)), 1, 1,
- Animation::TRANSFORM));
+ TargetProperty::TRANSFORM));
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(2.0, 0.f, 1.f)),
- animation_id, 1, Animation::OPACITY));
+ animation_id, 1, TargetProperty::OPACITY));
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 1.f, 0.75f)), 3,
- 2, Animation::OPACITY));
+ 2, TargetProperty::OPACITY));
controller->Animate(kInitialTickTime);
controller->UpdateState(true, events.get());
@@ -1567,21 +1571,22 @@
scoped_ptr<Animation> to_add(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(2.0, 0.f, 1.f)), 0,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
to_add->set_needs_synchronized_start_time(true);
controller->AddAnimation(std::move(to_add));
controller->Animate(kInitialTickTime);
controller->UpdateState(true, events.get());
EXPECT_TRUE(controller->HasActiveAnimation());
- Animation* active_animation = controller->GetAnimation(Animation::OPACITY);
+ Animation* active_animation =
+ controller->GetAnimation(TargetProperty::OPACITY);
EXPECT_TRUE(active_animation);
EXPECT_TRUE(active_animation->needs_synchronized_start_time());
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
- active_animation = controller_impl->GetAnimation(Animation::OPACITY);
+ active_animation = controller_impl->GetAnimation(TargetProperty::OPACITY);
EXPECT_TRUE(active_animation);
EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
active_animation->run_state());
@@ -1597,7 +1602,7 @@
scoped_ptr<Animation> first_animation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(1)), 1,
- Animation::TRANSFORM));
+ TargetProperty::TRANSFORM));
first_animation->set_is_controlling_instance_for_test(true);
controller->AddAnimation(std::move(first_animation));
@@ -1606,7 +1611,7 @@
scoped_ptr<Animation> second_animation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 2,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
second_animation->set_is_controlling_instance_for_test(true);
controller->AddAnimation(std::move(second_animation));
@@ -1645,7 +1650,7 @@
const int id = 1;
controller->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.5f, 1.f)), id,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
// Without an observer, the animation shouldn't progress to the STARTING
// state.
@@ -1653,7 +1658,7 @@
controller->UpdateState(true, events.get());
EXPECT_EQ(0u, events->events_.size());
EXPECT_EQ(Animation::WAITING_FOR_TARGET_AVAILABILITY,
- controller->GetAnimation(Animation::OPACITY)->run_state());
+ controller->GetAnimation(TargetProperty::OPACITY)->run_state());
controller->AddValueObserver(&pending_dummy);
@@ -1664,7 +1669,7 @@
controller->UpdateState(true, events.get());
EXPECT_EQ(0u, events->events_.size());
EXPECT_EQ(Animation::STARTING,
- controller->GetAnimation(Animation::OPACITY)->run_state());
+ controller->GetAnimation(TargetProperty::OPACITY)->run_state());
EXPECT_EQ(0.5f, pending_dummy.opacity());
// Even when already in the STARTING state, the animation should stay
@@ -1673,7 +1678,7 @@
controller->UpdateState(true, events.get());
EXPECT_EQ(0u, events->events_.size());
EXPECT_EQ(Animation::STARTING,
- controller->GetAnimation(Animation::OPACITY)->run_state());
+ controller->GetAnimation(TargetProperty::OPACITY)->run_state());
EXPECT_EQ(0.5f, pending_dummy.opacity());
controller->AddValueObserver(&dummy);
@@ -1684,7 +1689,7 @@
controller->UpdateState(true, events.get());
EXPECT_EQ(1u, events->events_.size());
EXPECT_EQ(Animation::RUNNING,
- controller->GetAnimation(Animation::OPACITY)->run_state());
+ controller->GetAnimation(TargetProperty::OPACITY)->run_state());
EXPECT_EQ(0.5f, pending_dummy.opacity());
EXPECT_EQ(0.5f, dummy.opacity());
@@ -1709,7 +1714,7 @@
base::TimeDelta::FromSecondsD(1.0), operations1, nullptr));
scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve1), 1, 1, Animation::TRANSFORM));
+ Animation::Create(std::move(curve1), 1, 1, TargetProperty::TRANSFORM));
controller_impl->AddAnimation(std::move(animation));
scoped_ptr<KeyframedTransformAnimationCurve> curve2(
@@ -1722,7 +1727,8 @@
curve2->AddKeyframe(TransformKeyframe::Create(
base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
- animation = Animation::Create(std::move(curve2), 2, 2, Animation::TRANSFORM);
+ animation =
+ Animation::Create(std::move(curve2), 2, 2, TargetProperty::TRANSFORM);
controller_impl->AddAnimation(std::move(animation));
gfx::BoxF box(1.f, 2.f, -1.f, 3.f, 4.f, 5.f);
@@ -1757,7 +1763,8 @@
operations3.AppendMatrix(transform3);
curve3->AddKeyframe(TransformKeyframe::Create(
base::TimeDelta::FromSecondsD(1.0), operations3, nullptr));
- animation = Animation::Create(std::move(curve3), 3, 3, Animation::TRANSFORM);
+ animation =
+ Animation::Create(std::move(curve3), 3, 3, TargetProperty::TRANSFORM);
controller_impl->AddAnimation(std::move(animation));
EXPECT_FALSE(controller_impl->TransformAnimationBoundsForBox(box, &bounds));
}
@@ -1774,19 +1781,19 @@
// state.
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 1, 1,
- Animation::TRANSFORM));
+ TargetProperty::TRANSFORM));
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 2, 2,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 3, 3,
- Animation::TRANSFORM));
+ TargetProperty::TRANSFORM));
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(2.0)), 4, 4,
- Animation::TRANSFORM));
+ TargetProperty::TRANSFORM));
controller->AddAnimation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 5, 5,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
controller->Animate(kInitialTickTime);
controller->UpdateState(true, nullptr);
@@ -1800,7 +1807,7 @@
controller->GetAnimationById(4)->run_state());
EXPECT_EQ(Animation::RUNNING, controller->GetAnimationById(5)->run_state());
- controller->AbortAnimations(Animation::TRANSFORM);
+ controller->AbortAnimations(TargetProperty::TRANSFORM);
// Only un-finished TRANSFORM animations should have been aborted.
EXPECT_EQ(Animation::FINISHED, controller->GetAnimationById(1)->run_state());
@@ -1828,9 +1835,9 @@
controller_impl->ActivateAnimations();
EXPECT_TRUE(controller_impl->GetAnimationById(animation_id));
- controller->AbortAnimations(Animation::OPACITY);
+ controller->AbortAnimations(TargetProperty::OPACITY);
EXPECT_EQ(Animation::ABORTED,
- controller->GetAnimation(Animation::OPACITY)->run_state());
+ controller->GetAnimation(TargetProperty::OPACITY)->run_state());
EXPECT_FALSE(dummy.animation_waiting_for_deletion());
EXPECT_FALSE(dummy_impl.animation_waiting_for_deletion());
@@ -1838,7 +1845,7 @@
controller->UpdateState(true, nullptr);
EXPECT_FALSE(dummy.animation_waiting_for_deletion());
EXPECT_EQ(Animation::ABORTED,
- controller->GetAnimation(Animation::OPACITY)->run_state());
+ controller->GetAnimation(TargetProperty::OPACITY)->run_state());
controller->PushAnimationUpdatesTo(controller_impl.get());
EXPECT_FALSE(controller->GetAnimationById(animation_id));
@@ -1865,9 +1872,10 @@
controller_impl->ActivateAnimations();
EXPECT_TRUE(controller_impl->GetAnimationById(animation_id));
- controller_impl->AbortAnimations(Animation::OPACITY);
- EXPECT_EQ(Animation::ABORTED,
- controller_impl->GetAnimation(Animation::OPACITY)->run_state());
+ controller_impl->AbortAnimations(TargetProperty::OPACITY);
+ EXPECT_EQ(
+ Animation::ABORTED,
+ controller_impl->GetAnimation(TargetProperty::OPACITY)->run_state());
EXPECT_FALSE(dummy.animation_waiting_for_deletion());
EXPECT_FALSE(dummy_impl.animation_waiting_for_deletion());
@@ -1877,19 +1885,20 @@
EXPECT_TRUE(dummy_impl.animation_waiting_for_deletion());
EXPECT_EQ(1u, events.events_.size());
EXPECT_EQ(AnimationEvent::ABORTED, events.events_[0].type);
- EXPECT_EQ(Animation::WAITING_FOR_DELETION,
- controller_impl->GetAnimation(Animation::OPACITY)->run_state());
+ EXPECT_EQ(
+ Animation::WAITING_FOR_DELETION,
+ controller_impl->GetAnimation(TargetProperty::OPACITY)->run_state());
controller->NotifyAnimationAborted(events.events_[0]);
EXPECT_EQ(Animation::ABORTED,
- controller->GetAnimation(Animation::OPACITY)->run_state());
+ controller->GetAnimation(TargetProperty::OPACITY)->run_state());
EXPECT_TRUE(delegate.aborted());
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(500));
controller->UpdateState(true, nullptr);
EXPECT_TRUE(dummy.animation_waiting_for_deletion());
EXPECT_EQ(Animation::WAITING_FOR_DELETION,
- controller->GetAnimation(Animation::OPACITY)->run_state());
+ controller->GetAnimation(TargetProperty::OPACITY)->run_state());
controller->PushAnimationUpdatesTo(controller_impl.get());
controller_impl->ActivateAnimations();
@@ -1911,13 +1920,13 @@
// Add two animations with the same group id but different durations.
scoped_ptr<Animation> first_animation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(2.0)), 1, group_id,
- Animation::TRANSFORM));
+ TargetProperty::TRANSFORM));
first_animation->set_is_controlling_instance_for_test(true);
controller_impl->AddAnimation(std::move(first_animation));
scoped_ptr<Animation> second_animation(Animation::Create(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 2,
- group_id, Animation::OPACITY));
+ group_id, TargetProperty::OPACITY));
second_animation->set_is_controlling_instance_for_test(true);
controller_impl->AddAnimation(std::move(second_animation));
@@ -1965,13 +1974,13 @@
// Add two animations with the same group id.
scoped_ptr<Animation> first_animation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 1,
- Animation::TRANSFORM));
+ TargetProperty::TRANSFORM));
first_animation->set_is_controlling_instance_for_test(true);
controller_impl->AddAnimation(std::move(first_animation));
scoped_ptr<Animation> second_animation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 1,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
second_animation->set_is_controlling_instance_for_test(true);
controller_impl->AddAnimation(std::move(second_animation));
@@ -1983,7 +1992,7 @@
EXPECT_EQ(AnimationEvent::STARTED, events->events_[0].type);
EXPECT_EQ(AnimationEvent::STARTED, events->events_[1].type);
- controller_impl->AbortAnimations(Animation::OPACITY);
+ controller_impl->AbortAnimations(TargetProperty::OPACITY);
events.reset(new AnimationEvents);
controller_impl->Animate(kInitialTickTime +
@@ -1994,9 +2003,9 @@
// animation, and an ABORTED event for the opacity animation.
EXPECT_EQ(2u, events->events_.size());
EXPECT_EQ(AnimationEvent::FINISHED, events->events_[0].type);
- EXPECT_EQ(Animation::TRANSFORM, events->events_[0].target_property);
+ EXPECT_EQ(TargetProperty::TRANSFORM, events->events_[0].target_property);
EXPECT_EQ(AnimationEvent::ABORTED, events->events_[1].type);
- EXPECT_EQ(Animation::OPACITY, events->events_[1].target_property);
+ EXPECT_EQ(TargetProperty::OPACITY, events->events_[1].target_property);
}
TEST(LayerAnimationControllerTest, HasAnimationThatAffectsScale) {
@@ -2007,7 +2016,7 @@
controller_impl->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 1,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
// Opacity animations don't affect scale.
EXPECT_FALSE(controller_impl->HasAnimationThatAffectsScale());
@@ -2023,7 +2032,7 @@
base::TimeDelta::FromSecondsD(1.0), operations1, nullptr));
scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve1), 2, 2, Animation::TRANSFORM));
+ Animation::Create(std::move(curve1), 2, 2, TargetProperty::TRANSFORM));
controller_impl->AddAnimation(std::move(animation));
// Translations don't affect scale.
@@ -2039,7 +2048,8 @@
curve2->AddKeyframe(TransformKeyframe::Create(
base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
- animation = Animation::Create(std::move(curve2), 3, 3, Animation::TRANSFORM);
+ animation =
+ Animation::Create(std::move(curve2), 3, 3, TargetProperty::TRANSFORM);
controller_impl->AddAnimation(std::move(animation));
EXPECT_TRUE(controller_impl->HasAnimationThatAffectsScale());
@@ -2063,7 +2073,7 @@
controller_impl->AddAnimation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 1,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
// Opacity animations aren't non-translation transforms.
EXPECT_TRUE(controller_impl->HasOnlyTranslationTransforms(
@@ -2082,7 +2092,7 @@
base::TimeDelta::FromSecondsD(1.0), operations1, nullptr));
scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve1), 2, 2, Animation::TRANSFORM));
+ Animation::Create(std::move(curve1), 2, 2, TargetProperty::TRANSFORM));
controller_impl->AddAnimation(std::move(animation));
// The only transform animation we've added is a translation.
@@ -2101,7 +2111,8 @@
curve2->AddKeyframe(TransformKeyframe::Create(
base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
- animation = Animation::Create(std::move(curve2), 3, 3, Animation::TRANSFORM);
+ animation =
+ Animation::Create(std::move(curve2), 3, 3, TargetProperty::TRANSFORM);
animation->set_affects_active_observers(false);
controller_impl->AddAnimation(std::move(animation));
@@ -2148,7 +2159,7 @@
curve1->AddKeyframe(TransformKeyframe::Create(
base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve1), 1, 1, Animation::TRANSFORM));
+ Animation::Create(std::move(curve1), 1, 1, TargetProperty::TRANSFORM));
animation->set_affects_active_observers(false);
controller_impl->AddAnimation(std::move(animation));
@@ -2179,7 +2190,8 @@
base::TimeDelta::FromSecondsD(1.0), operations3, nullptr));
controller_impl->RemoveAnimation(1);
- animation = Animation::Create(std::move(curve2), 2, 2, Animation::TRANSFORM);
+ animation =
+ Animation::Create(std::move(curve2), 2, 2, TargetProperty::TRANSFORM);
// Reverse Direction
animation->set_direction(Animation::DIRECTION_REVERSE);
@@ -2197,7 +2209,8 @@
curve3->AddKeyframe(TransformKeyframe::Create(
base::TimeDelta::FromSecondsD(1.0), operations5, nullptr));
- animation = Animation::Create(std::move(curve3), 3, 3, Animation::TRANSFORM);
+ animation =
+ Animation::Create(std::move(curve3), 3, 3, TargetProperty::TRANSFORM);
animation->set_affects_active_observers(false);
controller_impl->AddAnimation(std::move(animation));
@@ -2252,7 +2265,7 @@
base::TimeDelta::FromSecondsD(1.0), operations1, nullptr));
scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve1), 1, 1, Animation::TRANSFORM));
+ Animation::Create(std::move(curve1), 1, 1, TargetProperty::TRANSFORM));
animation->set_affects_active_observers(false);
controller_impl->AddAnimation(std::move(animation));
@@ -2281,7 +2294,8 @@
curve2->AddKeyframe(TransformKeyframe::Create(
base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
- animation = Animation::Create(std::move(curve2), 2, 2, Animation::TRANSFORM);
+ animation =
+ Animation::Create(std::move(curve2), 2, 2, TargetProperty::TRANSFORM);
animation->set_affects_active_observers(false);
controller_impl->AddAnimation(std::move(animation));
@@ -2310,7 +2324,8 @@
curve3->AddKeyframe(TransformKeyframe::Create(
base::TimeDelta::FromSecondsD(1.0), operations3, nullptr));
- animation = Animation::Create(std::move(curve3), 3, 3, Animation::TRANSFORM);
+ animation =
+ Animation::Create(std::move(curve3), 3, 3, TargetProperty::TRANSFORM);
animation->set_affects_active_observers(false);
controller_impl->AddAnimation(std::move(animation));
@@ -2357,7 +2372,7 @@
base::TimeDelta::FromSecondsD(1.0), operations2, nullptr));
scoped_ptr<Animation> animation_owned(
- Animation::Create(std::move(curve1), 1, 1, Animation::TRANSFORM));
+ Animation::Create(std::move(curve1), 1, 1, TargetProperty::TRANSFORM));
Animation* animation = animation_owned.get();
controller_impl->AddAnimation(std::move(animation_owned));
@@ -2661,7 +2676,7 @@
controller->NotifyAnimationStarted(events.events_[0]);
events.events_.clear();
- controller_impl->AbortAnimations(Animation::TRANSFORM);
+ controller_impl->AbortAnimations(TargetProperty::TRANSFORM);
EXPECT_FALSE(pending_dummy_impl.transform_is_animating());
EXPECT_FALSE(active_dummy_impl.transform_is_animating());
@@ -2737,7 +2752,7 @@
// Delete the animation on the main-thread controller.
controller->RemoveAnimation(
- controller->GetAnimation(Animation::OPACITY)->id());
+ controller->GetAnimation(TargetProperty::OPACITY)->id());
controller->PushAnimationUpdatesTo(controller_impl.get());
// The animation should no longer affect pending observers.
@@ -2785,7 +2800,7 @@
// Remove the first animation from the main-thread controller, and add a
// new animation affecting the same property.
controller->RemoveAnimation(
- controller->GetAnimation(Animation::OPACITY)->id());
+ controller->GetAnimation(TargetProperty::OPACITY)->id());
int second_animation_id =
AddOpacityTransitionToController(controller.get(), 1, 1.f, 0.5f, true);
controller->PushAnimationUpdatesTo(controller_impl.get());
@@ -2849,49 +2864,53 @@
// Create an animation that initially affects only pending observers.
scoped_ptr<Animation> animation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 1,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
animation->set_affects_active_observers(false);
controller->AddAnimation(std::move(animation));
controller->Animate(kInitialTickTime);
EXPECT_TRUE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::OPACITY,
+ LayerAnimationController::ObserverType::PENDING));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
controller->UpdateState(true, nullptr);
EXPECT_TRUE(controller->HasActiveAnimation());
EXPECT_TRUE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::OPACITY,
+ LayerAnimationController::ObserverType::PENDING));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::FILTER, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::FILTER, LayerAnimationController::ObserverType::PENDING));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::FILTER, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::FILTER, LayerAnimationController::ObserverType::ACTIVE));
controller->ActivateAnimations();
EXPECT_TRUE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::OPACITY,
+ LayerAnimationController::ObserverType::PENDING));
EXPECT_TRUE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::FILTER, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::FILTER, LayerAnimationController::ObserverType::PENDING));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::FILTER, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::FILTER, LayerAnimationController::ObserverType::ACTIVE));
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(10));
controller->UpdateState(true, nullptr);
EXPECT_TRUE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::OPACITY,
+ LayerAnimationController::ObserverType::PENDING));
EXPECT_TRUE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::FILTER, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::FILTER, LayerAnimationController::ObserverType::PENDING));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::FILTER, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::FILTER, LayerAnimationController::ObserverType::ACTIVE));
EXPECT_EQ(0.f, dummy.opacity());
@@ -2900,13 +2919,14 @@
controller->UpdateState(true, nullptr);
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::OPACITY,
+ LayerAnimationController::ObserverType::PENDING));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::FILTER, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::FILTER, LayerAnimationController::ObserverType::PENDING));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::FILTER, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::FILTER, LayerAnimationController::ObserverType::ACTIVE));
EXPECT_EQ(1.f, dummy.opacity());
}
@@ -2921,7 +2941,7 @@
// a start delay of 2 seconds.
scoped_ptr<Animation> animation(CreateAnimation(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)), 1,
- Animation::OPACITY));
+ TargetProperty::OPACITY));
animation->set_fill_mode(Animation::FILL_MODE_NONE);
animation->set_time_offset(TimeDelta::FromMilliseconds(-2000));
animation->set_affects_active_observers(false);
@@ -2934,34 +2954,38 @@
// potentially running transform animation but aren't currently animating
// transform.
EXPECT_TRUE(controller->IsPotentiallyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::OPACITY,
+ LayerAnimationController::ObserverType::PENDING));
EXPECT_FALSE(controller->IsPotentiallyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::OPACITY,
+ LayerAnimationController::ObserverType::PENDING));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
EXPECT_TRUE(controller->HasActiveAnimation());
EXPECT_FALSE(controller->IsPotentiallyAnimatingProperty(
- Animation::FILTER, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::FILTER, LayerAnimationController::ObserverType::PENDING));
EXPECT_FALSE(controller->IsPotentiallyAnimatingProperty(
- Animation::FILTER, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::FILTER, LayerAnimationController::ObserverType::ACTIVE));
controller->ActivateAnimations();
EXPECT_TRUE(controller->IsPotentiallyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::OPACITY,
+ LayerAnimationController::ObserverType::PENDING));
EXPECT_TRUE(controller->IsPotentiallyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::OPACITY,
+ LayerAnimationController::ObserverType::PENDING));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
EXPECT_TRUE(controller->HasActiveAnimation());
EXPECT_FALSE(controller->IsPotentiallyAnimatingProperty(
- Animation::FILTER, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::FILTER, LayerAnimationController::ObserverType::PENDING));
EXPECT_FALSE(controller->IsPotentiallyAnimatingProperty(
- Animation::FILTER, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::FILTER, LayerAnimationController::ObserverType::ACTIVE));
controller->UpdateState(true, nullptr);
@@ -2969,13 +2993,15 @@
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(2000));
controller->UpdateState(true, nullptr);
EXPECT_TRUE(controller->IsPotentiallyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::OPACITY,
+ LayerAnimationController::ObserverType::PENDING));
EXPECT_TRUE(controller->IsPotentiallyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
EXPECT_TRUE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::OPACITY,
+ LayerAnimationController::ObserverType::PENDING));
EXPECT_TRUE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
// After the animaton finishes, the observers it affects have neither a
// potentially running transform animation nor a currently running transform
@@ -2983,13 +3009,15 @@
controller->Animate(kInitialTickTime + TimeDelta::FromMilliseconds(4000));
controller->UpdateState(true, nullptr);
EXPECT_FALSE(controller->IsPotentiallyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::OPACITY,
+ LayerAnimationController::ObserverType::PENDING));
EXPECT_FALSE(controller->IsPotentiallyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::PENDING));
+ TargetProperty::OPACITY,
+ LayerAnimationController::ObserverType::PENDING));
EXPECT_FALSE(controller->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
+ TargetProperty::OPACITY, LayerAnimationController::ObserverType::ACTIVE));
}
} // namespace
diff --git a/cc/animation/target_property.cc b/cc/animation/target_property.cc
new file mode 100644
index 0000000..15144a7c
--- /dev/null
+++ b/cc/animation/target_property.cc
@@ -0,0 +1,28 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/animation/target_property.h"
+
+#include "base/macros.h"
+
+namespace cc {
+
+namespace {
+
+// This should match the TargetProperty enum.
+static const char* const s_targetPropertyNames[] = {
+ "TRANSFORM", "OPACITY", "FILTER", "SCROLL_OFFSET", "BACKGROUND_COLOR"};
+
+static_assert(static_cast<int>(TargetProperty::LAST_TARGET_PROPERTY) + 1 ==
+ arraysize(s_targetPropertyNames),
+ "TargetPropertyEnumSize should equal the number of elements in "
+ "s_targetPropertyNames");
+
+} // namespace
+
+const char* TargetProperty::GetName(TargetProperty::Type property) {
+ return s_targetPropertyNames[property];
+}
+
+} // namespace cc
diff --git a/cc/animation/target_property.h b/cc/animation/target_property.h
new file mode 100644
index 0000000..e4658e1
--- /dev/null
+++ b/cc/animation/target_property.h
@@ -0,0 +1,28 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_ANIMATION_TARGET_PROPERTY_H_
+#define CC_ANIMATION_TARGET_PROPERTY_H_
+
+namespace cc {
+
+namespace TargetProperty {
+
+enum Type {
+ TRANSFORM = 0,
+ OPACITY,
+ FILTER,
+ SCROLL_OFFSET,
+ BACKGROUND_COLOR,
+ // This sentinel must be last.
+ LAST_TARGET_PROPERTY = BACKGROUND_COLOR
+};
+
+const char* GetName(TargetProperty::Type property);
+
+} // namespace TargetProperty
+
+} // namespace cc
+
+#endif // CC_ANIMATION_TARGET_PROPERTY_H_
diff --git a/cc/blink/web_to_cc_animation_delegate_adapter.cc b/cc/blink/web_to_cc_animation_delegate_adapter.cc
index 97bc0b9..2ad069d4 100644
--- a/cc/blink/web_to_cc_animation_delegate_adapter.cc
+++ b/cc/blink/web_to_cc_animation_delegate_adapter.cc
@@ -14,7 +14,7 @@
void WebToCCAnimationDelegateAdapter::NotifyAnimationStarted(
base::TimeTicks monotonic_time,
- cc::Animation::TargetProperty target_property,
+ cc::TargetProperty::Type target_property,
int group) {
delegate_->notifyAnimationStarted(
(monotonic_time - base::TimeTicks()).InSecondsF(), group);
@@ -22,7 +22,7 @@
void WebToCCAnimationDelegateAdapter::NotifyAnimationFinished(
base::TimeTicks monotonic_time,
- cc::Animation::TargetProperty target_property,
+ cc::TargetProperty::Type target_property,
int group) {
delegate_->notifyAnimationFinished(
(monotonic_time - base::TimeTicks()).InSecondsF(), group);
@@ -30,7 +30,7 @@
void WebToCCAnimationDelegateAdapter::NotifyAnimationAborted(
base::TimeTicks monotonic_time,
- cc::Animation::TargetProperty target_property,
+ cc::TargetProperty::Type target_property,
int group) {
delegate_->notifyAnimationAborted(
(monotonic_time - base::TimeTicks()).InSecondsF(), group);
diff --git a/cc/blink/web_to_cc_animation_delegate_adapter.h b/cc/blink/web_to_cc_animation_delegate_adapter.h
index 343afa5..0978736 100644
--- a/cc/blink/web_to_cc_animation_delegate_adapter.h
+++ b/cc/blink/web_to_cc_animation_delegate_adapter.h
@@ -22,13 +22,13 @@
private:
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- cc::Animation::TargetProperty target_property,
+ cc::TargetProperty::Type target_property,
int group) override;
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
- cc::Animation::TargetProperty target_property,
+ cc::TargetProperty::Type target_property,
int group) override;
void NotifyAnimationAborted(base::TimeTicks monotonic_time,
- cc::Animation::TargetProperty target_property,
+ cc::TargetProperty::Type target_property,
int group) override;
blink::WebCompositorAnimationDelegate* delegate_;
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 22c01e23..62afc299 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -63,6 +63,8 @@
'animation/layer_animation_value_provider.h',
'animation/scroll_offset_animation_curve.cc',
'animation/scroll_offset_animation_curve.h',
+ 'animation/target_property.cc',
+ 'animation/target_property.h',
'animation/timing_function.cc',
'animation/timing_function.h',
'animation/transform_operation.cc',
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index e7053a8..5a7796c8 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -507,7 +507,7 @@
DCHECK(layer_tree_host_);
return layer_animation_controller_
? layer_animation_controller_->IsCurrentlyAnimatingProperty(
- Animation::FILTER,
+ TargetProperty::FILTER,
LayerAnimationController::ObserverType::ACTIVE)
: layer_tree_host_->IsAnimatingFilterProperty(this);
}
@@ -515,7 +515,7 @@
bool Layer::HasPotentiallyRunningFilterAnimation() const {
if (layer_animation_controller_) {
return layer_animation_controller_->IsPotentiallyAnimatingProperty(
- Animation::FILTER, LayerAnimationController::ObserverType::ACTIVE);
+ TargetProperty::FILTER, LayerAnimationController::ObserverType::ACTIVE);
}
return layer_tree_host_->HasPotentiallyRunningFilterAnimation(this);
}
@@ -544,7 +544,7 @@
DCHECK(layer_tree_host_);
return layer_animation_controller_
? layer_animation_controller_->IsCurrentlyAnimatingProperty(
- Animation::OPACITY,
+ TargetProperty::OPACITY,
LayerAnimationController::ObserverType::ACTIVE)
: layer_tree_host_->IsAnimatingOpacityProperty(this);
}
@@ -552,7 +552,8 @@
bool Layer::HasPotentiallyRunningOpacityAnimation() const {
if (layer_animation_controller_) {
return layer_animation_controller_->IsPotentiallyAnimatingProperty(
- Animation::OPACITY, LayerAnimationController::ObserverType::ACTIVE);
+ TargetProperty::OPACITY,
+ LayerAnimationController::ObserverType::ACTIVE);
}
return layer_tree_host_->HasPotentiallyRunningOpacityAnimation(this);
}
@@ -756,7 +757,7 @@
DCHECK(layer_tree_host_);
return layer_animation_controller_
? layer_animation_controller_->IsCurrentlyAnimatingProperty(
- Animation::TRANSFORM,
+ TargetProperty::TRANSFORM,
LayerAnimationController::ObserverType::ACTIVE)
: layer_tree_host_->IsAnimatingTransformProperty(this);
}
@@ -764,7 +765,8 @@
bool Layer::HasPotentiallyRunningTransformAnimation() const {
if (layer_animation_controller_) {
return layer_animation_controller_->IsPotentiallyAnimatingProperty(
- Animation::TRANSFORM, LayerAnimationController::ObserverType::ACTIVE);
+ TargetProperty::TRANSFORM,
+ LayerAnimationController::ObserverType::ACTIVE);
}
return layer_tree_host_->HasPotentiallyRunningTransformAnimation(this);
}
@@ -794,7 +796,7 @@
}
bool Layer::HasAnyAnimationTargetingProperty(
- Animation::TargetProperty property) const {
+ TargetProperty::Type property) const {
if (layer_animation_controller_)
return !!layer_animation_controller_->GetAnimation(property);
@@ -1879,7 +1881,7 @@
if (!layer_animation_controller_->animation_registrar())
return false;
- if (animation->target_property() == Animation::SCROLL_OFFSET &&
+ if (animation->target_property() == TargetProperty::SCROLL_OFFSET &&
!layer_animation_controller_->animation_registrar()
->supports_scroll_animations())
return false;
diff --git a/cc/layers/layer.h b/cc/layers/layer.h
index cdc0feee..afb5356 100644
--- a/cc/layers/layer.h
+++ b/cc/layers/layer.h
@@ -217,8 +217,7 @@
void SetTransformOrigin(const gfx::Point3F&);
gfx::Point3F transform_origin() const { return transform_origin_; }
- bool HasAnyAnimationTargetingProperty(
- Animation::TargetProperty property) const;
+ bool HasAnyAnimationTargetingProperty(TargetProperty::Type property) const;
bool ScrollOffsetAnimationWasInterrupted() const;
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index b0515b0d..aa34a8d3 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -862,10 +862,10 @@
if (scrollable())
UpdatePropertyTreeScrollOffset();
- if (HasAnyAnimationTargetingProperty(Animation::OPACITY))
+ if (HasAnyAnimationTargetingProperty(TargetProperty::OPACITY))
UpdatePropertyTreeOpacity();
- if (HasAnyAnimationTargetingProperty(Animation::TRANSFORM)) {
+ if (HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM)) {
UpdatePropertyTreeTransform();
UpdatePropertyTreeTransformIsAnimated(
HasPotentiallyRunningTransformAnimation());
@@ -1081,7 +1081,7 @@
: LayerAnimationController::ObserverType::PENDING;
return layer_animation_controller_
? layer_animation_controller_->IsCurrentlyAnimatingProperty(
- Animation::FILTER, observer_type)
+ TargetProperty::FILTER, observer_type)
: layer_tree_impl_->IsAnimatingFilterProperty(this);
}
@@ -1091,7 +1091,7 @@
: LayerAnimationController::ObserverType::PENDING;
return layer_animation_controller_
? layer_animation_controller_->IsPotentiallyAnimatingProperty(
- Animation::FILTER, observer_type)
+ TargetProperty::FILTER, observer_type)
: layer_tree_impl_->HasPotentiallyRunningFilterAnimation(this);
}
@@ -1100,7 +1100,7 @@
return layer_tree_impl_->FilterIsAnimatingOnImplOnly(this);
Animation* filter_animation =
- layer_animation_controller_->GetAnimation(Animation::FILTER);
+ layer_animation_controller_->GetAnimation(TargetProperty::FILTER);
return filter_animation && filter_animation->is_impl_only();
}
@@ -1145,7 +1145,7 @@
: LayerAnimationController::ObserverType::PENDING;
return layer_animation_controller_
? layer_animation_controller_->IsCurrentlyAnimatingProperty(
- Animation::OPACITY, observer_type)
+ TargetProperty::OPACITY, observer_type)
: layer_tree_impl_->IsAnimatingOpacityProperty(this);
}
@@ -1155,7 +1155,7 @@
: LayerAnimationController::ObserverType::PENDING;
return layer_animation_controller_
? layer_animation_controller_->IsPotentiallyAnimatingProperty(
- Animation::OPACITY, observer_type)
+ TargetProperty::OPACITY, observer_type)
: layer_tree_impl_->HasPotentiallyRunningOpacityAnimation(this);
}
@@ -1164,7 +1164,7 @@
return layer_tree_impl_->OpacityIsAnimatingOnImplOnly(this);
Animation* opacity_animation =
- layer_animation_controller_->GetAnimation(Animation::OPACITY);
+ layer_animation_controller_->GetAnimation(TargetProperty::OPACITY);
return opacity_animation && opacity_animation->is_impl_only();
}
@@ -1267,7 +1267,7 @@
: LayerAnimationController::ObserverType::PENDING;
return layer_animation_controller_
? layer_animation_controller_->IsCurrentlyAnimatingProperty(
- Animation::TRANSFORM, observer_type)
+ TargetProperty::TRANSFORM, observer_type)
: layer_tree_impl_->IsAnimatingTransformProperty(this);
}
@@ -1277,7 +1277,7 @@
: LayerAnimationController::ObserverType::PENDING;
return layer_animation_controller_
? layer_animation_controller_->IsPotentiallyAnimatingProperty(
- Animation::TRANSFORM, observer_type)
+ TargetProperty::TRANSFORM, observer_type)
: layer_tree_impl_->HasPotentiallyRunningTransformAnimation(this);
}
@@ -1286,7 +1286,7 @@
return layer_tree_impl_->TransformIsAnimatingOnImplOnly(this);
Animation* transform_animation =
- layer_animation_controller_->GetAnimation(Animation::TRANSFORM);
+ layer_animation_controller_->GetAnimation(TargetProperty::TRANSFORM);
return transform_animation && transform_animation->is_impl_only();
}
@@ -1330,7 +1330,7 @@
}
bool LayerImpl::HasAnyAnimationTargetingProperty(
- Animation::TargetProperty property) const {
+ TargetProperty::Type property) const {
if (!layer_animation_controller_)
return layer_tree_impl_->HasAnyAnimationTargetingProperty(this, property);
@@ -1691,11 +1691,10 @@
return num_descendants_that_draw_content_;
}
-void LayerImpl::NotifyAnimationFinished(
- base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
- int group) {
- if (target_property == Animation::SCROLL_OFFSET)
+void LayerImpl::NotifyAnimationFinished(base::TimeTicks monotonic_time,
+ TargetProperty::Type target_property,
+ int group) {
+ if (target_property == TargetProperty::SCROLL_OFFSET)
layer_tree_impl_->InputScrollAnimationFinished();
}
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index d4bf384..b5f2ee2 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -119,13 +119,13 @@
// AnimationDelegate implementation.
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override{};
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override;
void NotifyAnimationAborted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override{};
// Tree structure.
@@ -548,8 +548,7 @@
// This includes all animations, even those that are finished but haven't yet
// been deleted.
- bool HasAnyAnimationTargetingProperty(
- Animation::TargetProperty property) const;
+ bool HasAnyAnimationTargetingProperty(TargetProperty::Type property) const;
bool HasFilterAnimationThatInflatesBounds() const;
bool HasTransformAnimationThatInflatesBounds() const;
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc
index 1b10a914..b393af3f 100644
--- a/cc/layers/layer_unittest.cc
+++ b/cc/layers/layer_unittest.cc
@@ -1759,7 +1759,7 @@
AddOpacityTransitionToController(impl_layer->layer_animation_controller(),
1.0, 0.3f, 0.7f, false);
impl_layer->layer_animation_controller()
- ->GetAnimation(Animation::OPACITY)
+ ->GetAnimation(TargetProperty::OPACITY)
->set_is_impl_only(true);
}
EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetOpacity(0.75f));
@@ -1810,7 +1810,7 @@
AddAnimatedFilterToController(impl_layer->layer_animation_controller(), 1.0,
1.f, 2.f);
impl_layer->layer_animation_controller()
- ->GetAnimation(Animation::FILTER)
+ ->GetAnimation(TargetProperty::FILTER)
->set_is_impl_only(true);
}
filters.Append(FilterOperation::CreateSepiaFilter(0.5f));
@@ -2144,7 +2144,7 @@
curve->AddKeyframe(
FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.7f, nullptr));
scoped_ptr<Animation> animation =
- Animation::Create(std::move(curve), 0, 0, Animation::OPACITY);
+ Animation::Create(std::move(curve), 0, 0, TargetProperty::OPACITY);
return layer->AddAnimation(std::move(animation));
}
diff --git a/cc/test/animation_test_common.cc b/cc/test/animation_test_common.cc
index f61e9bb..cc02e633 100644
--- a/cc/test/animation_test_common.cc
+++ b/cc/test/animation_test_common.cc
@@ -47,7 +47,7 @@
scoped_ptr<Animation> animation(Animation::Create(
std::move(curve), id, AnimationIdProvider::NextGroupId(),
- Animation::OPACITY));
+ TargetProperty::OPACITY));
animation->set_needs_synchronized_start_time(true);
target->AddAnimation(std::move(animation));
@@ -74,7 +74,7 @@
scoped_ptr<Animation> animation(Animation::Create(
std::move(curve), id, AnimationIdProvider::NextGroupId(),
- Animation::TRANSFORM));
+ TargetProperty::TRANSFORM));
animation->set_needs_synchronized_start_time(true);
target->AddAnimation(std::move(animation));
@@ -119,9 +119,9 @@
int id = AnimationIdProvider::NextAnimationId();
- scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve), id,
- AnimationIdProvider::NextGroupId(), Animation::FILTER));
+ scoped_ptr<Animation> animation(Animation::Create(
+ std::move(curve), id, AnimationIdProvider::NextGroupId(),
+ TargetProperty::FILTER));
animation->set_needs_synchronized_start_time(true);
target->AddAnimation(std::move(animation));
@@ -417,7 +417,7 @@
scoped_ptr<Animation> animation(Animation::Create(
std::move(curve), id, AnimationIdProvider::NextGroupId(),
- Animation::OPACITY));
+ TargetProperty::OPACITY));
animation->set_needs_synchronized_start_time(true);
target->AddAnimation(std::move(animation));
@@ -525,10 +525,9 @@
end_opacity, use_timing_function);
}
-void AbortAnimationsOnLayerWithPlayer(
- int layer_id,
- scoped_refptr<AnimationTimeline> timeline,
- Animation::TargetProperty target_property) {
+void AbortAnimationsOnLayerWithPlayer(int layer_id,
+ scoped_refptr<AnimationTimeline> timeline,
+ TargetProperty::Type target_property) {
LayerAnimationController* controller =
timeline->animation_host()->GetControllerForLayerId(layer_id);
DCHECK(controller);
diff --git a/cc/test/animation_test_common.h b/cc/test/animation_test_common.h
index 19e7a7c..7a6fe0d8 100644
--- a/cc/test/animation_test_common.h
+++ b/cc/test/animation_test_common.h
@@ -260,10 +260,9 @@
float end_opacity,
bool use_timing_function);
-void AbortAnimationsOnLayerWithPlayer(
- int layer_id,
- scoped_refptr<AnimationTimeline> timeline,
- Animation::TargetProperty target_property);
+void AbortAnimationsOnLayerWithPlayer(int layer_id,
+ scoped_refptr<AnimationTimeline> timeline,
+ TargetProperty::Type target_property);
} // namespace cc
diff --git a/cc/test/animation_timelines_test_common.cc b/cc/test/animation_timelines_test_common.cc
index d3b80f60..f9417360 100644
--- a/cc/test/animation_timelines_test_common.cc
+++ b/cc/test/animation_timelines_test_common.cc
@@ -31,7 +31,7 @@
opacity_ = 0;
brightness_ = 0;
- for (int i = 0; i <= Animation::LAST_TARGET_PROPERTY; ++i)
+ for (int i = 0; i <= TargetProperty::LAST_TARGET_PROPERTY; ++i)
mutated_properties_[i] = false;
}
@@ -129,10 +129,9 @@
layers_in_tree.erase(kv);
}
-bool TestHostClient::IsPropertyMutated(
- int layer_id,
- LayerTreeType tree_type,
- Animation::TargetProperty property) const {
+bool TestHostClient::IsPropertyMutated(int layer_id,
+ LayerTreeType tree_type,
+ TargetProperty::Type property) const {
TestLayer* layer = FindTestLayer(layer_id, tree_type);
return layer->is_property_mutated(property);
}
@@ -141,7 +140,7 @@
LayerTreeType tree_type,
float brightness) const {
TestLayer* layer = FindTestLayer(layer_id, tree_type);
- EXPECT_TRUE(layer->is_property_mutated(Animation::OPACITY));
+ EXPECT_TRUE(layer->is_property_mutated(TargetProperty::OPACITY));
EXPECT_EQ(brightness, layer->brightness());
}
@@ -149,7 +148,7 @@
LayerTreeType tree_type,
float opacity) const {
TestLayer* layer = FindTestLayer(layer_id, tree_type);
- EXPECT_TRUE(layer->is_property_mutated(Animation::OPACITY));
+ EXPECT_TRUE(layer->is_property_mutated(TargetProperty::OPACITY));
EXPECT_EQ(opacity, layer->opacity());
}
@@ -158,7 +157,7 @@
int transform_x,
int transform_y) const {
TestLayer* layer = FindTestLayer(layer_id, tree_type);
- EXPECT_TRUE(layer->is_property_mutated(Animation::OPACITY));
+ EXPECT_TRUE(layer->is_property_mutated(TargetProperty::OPACITY));
EXPECT_EQ(transform_x, layer->transform_x());
EXPECT_EQ(transform_y, layer->transform_y());
}
@@ -180,13 +179,13 @@
void TestAnimationDelegate::NotifyAnimationStarted(
base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) {
started_ = true;
}
void TestAnimationDelegate::NotifyAnimationFinished(
base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) {
finished_ = true;
}
diff --git a/cc/test/animation_timelines_test_common.h b/cc/test/animation_timelines_test_common.h
index 2f1388e..0d041b5 100644
--- a/cc/test/animation_timelines_test_common.h
+++ b/cc/test/animation_timelines_test_common.h
@@ -29,28 +29,28 @@
void set_transform(int transform_x, int transform_y) {
transform_x_ = transform_x;
transform_y_ = transform_y;
- mutated_properties_[Animation::TRANSFORM] = true;
+ mutated_properties_[TargetProperty::TRANSFORM] = true;
}
float opacity() const { return opacity_; }
void set_opacity(float opacity) {
opacity_ = opacity;
- mutated_properties_[Animation::OPACITY] = true;
+ mutated_properties_[TargetProperty::OPACITY] = true;
}
float brightness() const { return brightness_; }
void set_brightness(float brightness) {
brightness_ = brightness;
- mutated_properties_[Animation::FILTER] = true;
+ mutated_properties_[TargetProperty::FILTER] = true;
}
gfx::ScrollOffset scroll_offset() const { return scroll_offset_; }
void set_scroll_offset(const gfx::ScrollOffset& scroll_offset) {
scroll_offset_ = scroll_offset;
- mutated_properties_[Animation::SCROLL_OFFSET] = true;
+ mutated_properties_[TargetProperty::SCROLL_OFFSET] = true;
}
- bool is_property_mutated(Animation::TargetProperty property) const {
+ bool is_property_mutated(TargetProperty::Type property) const {
return mutated_properties_[property];
}
@@ -64,7 +64,7 @@
float brightness_;
gfx::ScrollOffset scroll_offset_;
- bool mutated_properties_[Animation::LAST_TARGET_PROPERTY + 1];
+ bool mutated_properties_[TargetProperty::LAST_TARGET_PROPERTY + 1];
};
class TestHostClient : public MutatorHostClient {
@@ -117,7 +117,7 @@
bool IsPropertyMutated(int layer_id,
LayerTreeType tree_type,
- Animation::TargetProperty property) const;
+ TargetProperty::Type property) const;
void ExpectFilterPropertyMutated(int layer_id,
LayerTreeType tree_type,
@@ -147,13 +147,13 @@
TestAnimationDelegate();
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override;
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override;
void NotifyAnimationAborted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {}
bool started_;
bool finished_;
diff --git a/cc/test/test_hooks.h b/cc/test/test_hooks.h
index 30ebece..a00233dc 100644
--- a/cc/test/test_hooks.h
+++ b/cc/test/test_hooks.h
@@ -129,13 +129,13 @@
// Implementation of AnimationDelegate:
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {}
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {}
void NotifyAnimationAborted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {}
virtual void RequestNewOutputSurface() = 0;
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 42a97ea..2dff375 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -1388,7 +1388,7 @@
bool LayerTreeHost::HasAnyAnimationTargetingProperty(
const Layer* layer,
- Animation::TargetProperty property) const {
+ TargetProperty::Type property) const {
return animation_host_
? animation_host_->HasAnyAnimationTargetingProperty(layer->id(),
property)
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index 453c75f..c9850023 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -397,9 +397,8 @@
bool HasOnlyTranslationTransforms(const Layer* layer) const;
bool MaximumTargetScale(const Layer* layer, float* max_scale) const;
bool AnimationStartScale(const Layer* layer, float* start_scale) const;
- bool HasAnyAnimationTargetingProperty(
- const Layer* layer,
- Animation::TargetProperty property) const;
+ bool HasAnyAnimationTargetingProperty(const Layer* layer,
+ TargetProperty::Type property) const;
bool AnimationsPreserveAxisAlignment(const Layer* layer) const;
bool HasAnyAnimation(const Layer* layer) const;
bool HasActiveAnimation(const Layer* layer) const;
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index b80902a6..69a8ce7 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -2626,7 +2626,7 @@
// Add a transform animation with a start delay to |grand_child|.
scoped_ptr<Animation> animation = Animation::Create(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)), 0, 1,
- Animation::TRANSFORM);
+ TargetProperty::TRANSFORM);
animation->set_fill_mode(Animation::FILL_MODE_NONE);
animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
if (layer_settings().use_compositor_animation_timelines) {
@@ -7553,18 +7553,18 @@
if (layer_settings().use_compositor_animation_timelines) {
AbortAnimationsOnLayerWithPlayer(grand_parent->id(), timeline,
- Animation::TRANSFORM);
+ TargetProperty::TRANSFORM);
AbortAnimationsOnLayerWithPlayer(parent_raw->id(), timeline,
- Animation::TRANSFORM);
+ TargetProperty::TRANSFORM);
AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline,
- Animation::TRANSFORM);
+ TargetProperty::TRANSFORM);
} else {
grand_parent->layer_animation_controller()->AbortAnimations(
- Animation::TRANSFORM);
+ TargetProperty::TRANSFORM);
parent_raw->layer_animation_controller()->AbortAnimations(
- Animation::TRANSFORM);
+ TargetProperty::TRANSFORM);
child_raw->layer_animation_controller()->AbortAnimations(
- Animation::TRANSFORM);
+ TargetProperty::TRANSFORM);
}
TransformOperations perspective;
@@ -7602,10 +7602,10 @@
if (layer_settings().use_compositor_animation_timelines) {
AbortAnimationsOnLayerWithPlayer(child_raw->id(), timeline,
- Animation::TRANSFORM);
+ TargetProperty::TRANSFORM);
} else {
child_raw->layer_animation_controller()->AbortAnimations(
- Animation::TRANSFORM);
+ TargetProperty::TRANSFORM);
}
gfx::Transform scale_matrix;
scale_matrix.Scale(1.f, 2.f);
@@ -8522,7 +8522,7 @@
curve->AddKeyframe(FilterKeyframe::Create(
base::TimeDelta::FromMilliseconds(100), end_filters, nullptr));
scoped_ptr<Animation> animation =
- Animation::Create(std::move(curve), 0, 1, Animation::FILTER);
+ Animation::Create(std::move(curve), 0, 1, TargetProperty::FILTER);
animation->set_fill_mode(Animation::FILL_MODE_NONE);
animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
@@ -9003,7 +9003,7 @@
int animation_id = 0;
scoped_ptr<Animation> animation = Animation::Create(
scoped_ptr<AnimationCurve>(new FakeTransformTransition(1.0)),
- animation_id, 1, Animation::TRANSFORM);
+ animation_id, 1, TargetProperty::TRANSFORM);
animation->set_fill_mode(Animation::FILL_MODE_NONE);
animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
if (layer_settings().use_compositor_animation_timelines) {
@@ -9040,7 +9040,7 @@
animation_id = 1;
animation = Animation::Create(
scoped_ptr<AnimationCurve>(new FakeFloatTransition(1.0, 0.f, 1.f)),
- animation_id, 1, Animation::OPACITY);
+ animation_id, 1, TargetProperty::OPACITY);
animation->set_fill_mode(Animation::FILL_MODE_NONE);
animation->set_time_offset(base::TimeDelta::FromMilliseconds(-1000));
if (layer_settings().use_compositor_animation_timelines) {
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 0ffe578..8b12272 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -3750,7 +3750,7 @@
return animation_host_->ScrollAnimationAbort();
layer_impl->layer_animation_controller()->AbortAnimations(
- Animation::SCROLL_OFFSET);
+ TargetProperty::SCROLL_OFFSET);
}
void LayerTreeHostImpl::ScrollAnimationCreate(
@@ -3771,7 +3771,7 @@
scoped_ptr<Animation> animation = Animation::Create(
std::move(curve), AnimationIdProvider::NextAnimationId(),
- AnimationIdProvider::NextGroupId(), Animation::SCROLL_OFFSET);
+ AnimationIdProvider::NextGroupId(), TargetProperty::SCROLL_OFFSET);
animation->set_is_impl_only(true);
layer_impl->layer_animation_controller()->AddAnimation(std::move(animation));
@@ -3792,7 +3792,7 @@
Animation* animation =
layer_impl->layer_animation_controller()
? layer_impl->layer_animation_controller()->GetAnimation(
- Animation::SCROLL_OFFSET)
+ TargetProperty::SCROLL_OFFSET)
: nullptr;
if (!animation)
return false;
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index d7fc121..d155c5b0 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -9403,7 +9403,7 @@
host_impl_->UpdateAnimationState(true);
EXPECT_TRUE(host_impl_->animation_host()->HasAnyAnimationTargetingProperty(
- scrolling_layer->id(), Animation::SCROLL_OFFSET));
+ scrolling_layer->id(), TargetProperty::SCROLL_OFFSET));
EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset());
host_impl_->DidFinishImplFrame();
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
index 3e269c3..bc68df8 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -136,13 +136,13 @@
}
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
EXPECT_LT(base::TimeTicks(), monotonic_time);
LayerAnimationController* controller =
layer_tree_host()->root_layer()->layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::OPACITY);
+ Animation* animation = controller->GetAnimation(TargetProperty::OPACITY);
if (animation)
controller->RemoveAnimation(animation->id());
@@ -220,7 +220,7 @@
}
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
// Animations on the impl-side controller only get deleted during a commit,
// so we need to schedule a commit.
@@ -258,7 +258,8 @@
LayerAnimationController* controller_impl =
host_impl->active_tree()->root_layer()->children()[0]->
layer_animation_controller();
- Animation* animation = controller_impl->GetAnimation(Animation::OPACITY);
+ Animation* animation =
+ controller_impl->GetAnimation(TargetProperty::OPACITY);
if (!animation)
return;
@@ -303,12 +304,12 @@
void BeginTest() override { PostAddAnimationToMainThread(picture_.get()); }
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
LayerAnimationController* controller =
layer_tree_host()->root_layer()->children()[0]->
layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::OPACITY);
+ Animation* animation = controller->GetAnimation(TargetProperty::OPACITY);
main_start_time_ = animation->start_time();
controller->RemoveAnimation(animation->id());
EndTest();
@@ -319,7 +320,7 @@
LayerAnimationController* controller =
impl_host->active_tree()->root_layer()->children()[0]->
layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::OPACITY);
+ Animation* animation = controller->GetAnimation(TargetProperty::OPACITY);
if (!animation)
return;
@@ -350,11 +351,11 @@
}
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
LayerAnimationController* controller =
layer_tree_host()->root_layer()->layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::OPACITY);
+ Animation* animation = controller->GetAnimation(TargetProperty::OPACITY);
if (animation)
controller->RemoveAnimation(animation->id());
EndTest();
@@ -390,7 +391,7 @@
LayerAnimationController* controller_impl =
host_impl->active_tree()->root_layer()->layer_animation_controller();
Animation* animation_impl =
- controller_impl->GetAnimation(Animation::OPACITY);
+ controller_impl->GetAnimation(TargetProperty::OPACITY);
controller_impl->RemoveAnimation(animation_impl->id());
EndTest();
}
@@ -427,7 +428,7 @@
// Any valid AnimationCurve will do here.
scoped_ptr<AnimationCurve> curve(new FakeFloatAnimationCurve());
scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve), 1, 1, Animation::OPACITY));
+ Animation::Create(std::move(curve), 1, 1, TargetProperty::OPACITY));
layer->layer_animation_controller()->AddAnimation(std::move(animation));
// We add the animation *before* attaching the layer to the tree.
@@ -616,7 +617,7 @@
}
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
if (TestEnded())
return;
@@ -667,7 +668,7 @@
gfx::ScrollOffset(500.f, 550.f),
EaseInOutTimingFunction::Create()));
scoped_ptr<Animation> animation(Animation::Create(
- std::move(curve), 1, 0, Animation::SCROLL_OFFSET));
+ std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET));
animation->set_needs_synchronized_start_time(true);
bool animation_added =
scroll_layer_->AddAnimation(std::move(animation));
@@ -718,8 +719,8 @@
scoped_ptr<ScrollOffsetAnimationCurve> curve(
ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f),
EaseInOutTimingFunction::Create()));
- scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve), 1, 0, Animation::SCROLL_OFFSET));
+ scoped_ptr<Animation> animation(Animation::Create(
+ std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET));
animation->set_needs_synchronized_start_time(true);
scroll_layer_->AddAnimation(std::move(animation));
}
@@ -733,7 +734,7 @@
case 1: {
Animation* animation =
scroll_layer_->layer_animation_controller()->GetAnimation(
- Animation::SCROLL_OFFSET);
+ TargetProperty::SCROLL_OFFSET);
scroll_layer_->layer_animation_controller()->RemoveAnimation(
animation->id());
scroll_layer_->SetScrollOffset(final_postion_);
@@ -762,7 +763,7 @@
host_impl->active_tree()->root_layer()->children()[0].get();
Animation* animation =
scroll_layer_impl->layer_animation_controller()->GetAnimation(
- Animation::SCROLL_OFFSET);
+ TargetProperty::SCROLL_OFFSET);
if (!animation || animation->run_state() != Animation::RUNNING) {
host_impl->BlockNotifyReadyToActivateForTesting(false);
@@ -864,7 +865,7 @@
LayerAnimationController* root_controller_impl =
host_impl->active_tree()->root_layer()->layer_animation_controller();
Animation* root_animation =
- root_controller_impl->GetAnimation(Animation::OPACITY);
+ root_controller_impl->GetAnimation(TargetProperty::OPACITY);
if (!root_animation || root_animation->run_state() != Animation::RUNNING)
return;
@@ -872,12 +873,12 @@
host_impl->active_tree()->root_layer()->children()
[0]->layer_animation_controller();
Animation* child_animation =
- child_controller_impl->GetAnimation(Animation::OPACITY);
+ child_controller_impl->GetAnimation(TargetProperty::OPACITY);
EXPECT_EQ(Animation::RUNNING, child_animation->run_state());
EXPECT_EQ(root_animation->start_time(), child_animation->start_time());
- root_controller_impl->AbortAnimations(Animation::OPACITY);
- root_controller_impl->AbortAnimations(Animation::TRANSFORM);
- child_controller_impl->AbortAnimations(Animation::OPACITY);
+ root_controller_impl->AbortAnimations(TargetProperty::OPACITY);
+ root_controller_impl->AbortAnimations(TargetProperty::TRANSFORM);
+ child_controller_impl->AbortAnimations(TargetProperty::OPACITY);
EndTest();
}
@@ -932,7 +933,8 @@
LayerImpl* child = root->children()[0].get();
LayerAnimationController* controller_impl =
child->layer_animation_controller();
- Animation* animation = controller_impl->GetAnimation(Animation::TRANSFORM);
+ Animation* animation =
+ controller_impl->GetAnimation(TargetProperty::TRANSFORM);
// The animation should be starting for the first frame.
EXPECT_EQ(Animation::STARTING, animation->run_state());
@@ -945,7 +947,7 @@
// And the sync tree layer should know it is animating.
EXPECT_TRUE(child->screen_space_transform_is_animating());
- controller_impl->AbortAnimations(Animation::TRANSFORM);
+ controller_impl->AbortAnimations(TargetProperty::TRANSFORM);
EndTest();
}
@@ -1046,10 +1048,10 @@
for (auto& it : controllers_copy) {
int id = it.first;
if (id == host_impl->RootLayer()->id()) {
- Animation* anim = it.second->GetAnimation(Animation::TRANSFORM);
+ Animation* anim = it.second->GetAnimation(TargetProperty::TRANSFORM);
EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0);
} else if (id == host_impl->RootLayer()->children()[0]->id()) {
- Animation* anim = it.second->GetAnimation(Animation::OPACITY);
+ Animation* anim = it.second->GetAnimation(TargetProperty::OPACITY);
EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0);
}
EndTest();
@@ -1086,7 +1088,8 @@
case 2:
LayerAnimationController* controller =
layer_->layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::TRANSFORM);
+ Animation* animation =
+ controller->GetAnimation(TargetProperty::TRANSFORM);
layer_->RemoveAnimation(animation->id());
gfx::Transform transform;
transform.Translate(10.f, 10.f);
@@ -1162,7 +1165,8 @@
case 2:
LayerAnimationController* controller =
layer_->layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::TRANSFORM);
+ Animation* animation =
+ controller->GetAnimation(TargetProperty::TRANSFORM);
layer_->RemoveAnimation(animation->id());
break;
}
@@ -1310,7 +1314,7 @@
}
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
called_animation_started_ = true;
layer_tree_host()->AnimateLayers(base::TimeTicks::FromInternalValue(
@@ -1319,7 +1323,7 @@
}
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
called_animation_finished_ = true;
EndTest();
diff --git a/cc/trees/layer_tree_host_unittest_animation_timelines.cc b/cc/trees/layer_tree_host_unittest_animation_timelines.cc
index 1c62e37..aade4bd 100644
--- a/cc/trees/layer_tree_host_unittest_animation_timelines.cc
+++ b/cc/trees/layer_tree_host_unittest_animation_timelines.cc
@@ -87,13 +87,13 @@
}
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
EXPECT_LT(base::TimeTicks(), monotonic_time);
LayerAnimationController* controller =
player_->element_animations()->layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::OPACITY);
+ Animation* animation = controller->GetAnimation(TargetProperty::OPACITY);
if (animation)
player_->RemoveAnimation(animation->id());
@@ -178,7 +178,7 @@
}
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
// Animations on the impl-side controller only get deleted during a commit,
// so we need to schedule a commit.
@@ -228,7 +228,8 @@
LayerAnimationController* controller_impl =
player_child_impl->element_animations()->layer_animation_controller();
- Animation* animation = controller_impl->GetAnimation(Animation::OPACITY);
+ Animation* animation =
+ controller_impl->GetAnimation(TargetProperty::OPACITY);
const FloatAnimationCurve* curve =
animation->curve()->ToFloatAnimationCurve();
@@ -280,11 +281,11 @@
}
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
LayerAnimationController* controller =
player_child_->element_animations()->layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::OPACITY);
+ Animation* animation = controller->GetAnimation(TargetProperty::OPACITY);
main_start_time_ = animation->start_time();
controller->RemoveAnimation(animation->id());
EndTest();
@@ -299,7 +300,7 @@
LayerAnimationController* controller =
player_child_impl->element_animations()->layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::OPACITY);
+ Animation* animation = controller->GetAnimation(TargetProperty::OPACITY);
if (!animation)
return;
@@ -335,11 +336,11 @@
}
void NotifyAnimationFinished(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
LayerAnimationController* controller =
player_->element_animations()->layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::OPACITY);
+ Animation* animation = controller->GetAnimation(TargetProperty::OPACITY);
if (animation)
controller->RemoveAnimation(animation->id());
EndTest();
@@ -384,7 +385,7 @@
LayerAnimationController* controller_impl =
player_impl->element_animations()->layer_animation_controller();
Animation* animation_impl =
- controller_impl->GetAnimation(Animation::OPACITY);
+ controller_impl->GetAnimation(TargetProperty::OPACITY);
controller_impl->RemoveAnimation(animation_impl->id());
EndTest();
}
@@ -427,7 +428,7 @@
// Any valid AnimationCurve will do here.
scoped_ptr<AnimationCurve> curve(new FakeFloatAnimationCurve());
scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve), 1, 1, Animation::OPACITY));
+ Animation::Create(std::move(curve), 1, 1, TargetProperty::OPACITY));
player_->AddAnimation(std::move(animation));
// We add the animation *before* attaching the layer to the tree.
@@ -507,7 +508,7 @@
}
void NotifyAnimationStarted(base::TimeTicks monotonic_time,
- Animation::TargetProperty target_property,
+ TargetProperty::Type target_property,
int group) override {
if (TestEnded())
return;
@@ -564,7 +565,7 @@
gfx::ScrollOffset(500.f, 550.f),
EaseInOutTimingFunction::Create()));
scoped_ptr<Animation> animation(Animation::Create(
- std::move(curve), 1, 0, Animation::SCROLL_OFFSET));
+ std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET));
animation->set_needs_synchronized_start_time(true);
bool impl_scrolling_supported =
layer_tree_host()->proxy()->SupportsImplScrolling();
@@ -615,8 +616,8 @@
scoped_ptr<ScrollOffsetAnimationCurve> curve(
ScrollOffsetAnimationCurve::Create(gfx::ScrollOffset(6500.f, 7500.f),
EaseInOutTimingFunction::Create()));
- scoped_ptr<Animation> animation(
- Animation::Create(std::move(curve), 1, 0, Animation::SCROLL_OFFSET));
+ scoped_ptr<Animation> animation(Animation::Create(
+ std::move(curve), 1, 0, TargetProperty::SCROLL_OFFSET));
animation->set_needs_synchronized_start_time(true);
AttachPlayersToTimeline();
@@ -631,9 +632,10 @@
case 0:
break;
case 1: {
- Animation* animation = player_child_->element_animations()
- ->layer_animation_controller()
- ->GetAnimation(Animation::SCROLL_OFFSET);
+ Animation* animation =
+ player_child_->element_animations()
+ ->layer_animation_controller()
+ ->GetAnimation(TargetProperty::SCROLL_OFFSET);
player_child_->RemoveAnimation(animation->id());
scroll_layer_->SetScrollOffset(final_postion_);
break;
@@ -666,7 +668,7 @@
host_impl->active_tree()->root_layer()->children()[0].get();
Animation* animation = player_impl->element_animations()
->layer_animation_controller()
- ->GetAnimation(Animation::SCROLL_OFFSET);
+ ->GetAnimation(TargetProperty::SCROLL_OFFSET);
if (!animation || animation->run_state() != Animation::RUNNING) {
host_impl->BlockNotifyReadyToActivateForTesting(false);
@@ -785,19 +787,19 @@
LayerAnimationController* root_controller_impl =
player_impl->element_animations()->layer_animation_controller();
Animation* root_animation =
- root_controller_impl->GetAnimation(Animation::OPACITY);
+ root_controller_impl->GetAnimation(TargetProperty::OPACITY);
if (!root_animation || root_animation->run_state() != Animation::RUNNING)
return;
LayerAnimationController* child_controller_impl =
player_child_impl->element_animations()->layer_animation_controller();
Animation* child_animation =
- child_controller_impl->GetAnimation(Animation::OPACITY);
+ child_controller_impl->GetAnimation(TargetProperty::OPACITY);
EXPECT_EQ(Animation::RUNNING, child_animation->run_state());
EXPECT_EQ(root_animation->start_time(), child_animation->start_time());
- root_controller_impl->AbortAnimations(Animation::OPACITY);
- root_controller_impl->AbortAnimations(Animation::TRANSFORM);
- child_controller_impl->AbortAnimations(Animation::OPACITY);
+ root_controller_impl->AbortAnimations(TargetProperty::OPACITY);
+ root_controller_impl->AbortAnimations(TargetProperty::TRANSFORM);
+ child_controller_impl->AbortAnimations(TargetProperty::OPACITY);
EndTest();
}
@@ -856,10 +858,10 @@
for (auto& it : controllers_copy) {
int id = it.first;
if (id == host_impl->RootLayer()->id()) {
- Animation* anim = it.second->GetAnimation(Animation::TRANSFORM);
+ Animation* anim = it.second->GetAnimation(TargetProperty::TRANSFORM);
EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0);
} else if (id == host_impl->RootLayer()->children()[0]->id()) {
- Animation* anim = it.second->GetAnimation(Animation::OPACITY);
+ Animation* anim = it.second->GetAnimation(TargetProperty::OPACITY);
EXPECT_GT((anim->start_time() - base::TimeTicks()).InSecondsF(), 0);
}
EndTest();
@@ -901,7 +903,8 @@
case 2:
LayerAnimationController* controller =
player_child_->element_animations()->layer_animation_controller();
- Animation* animation = controller->GetAnimation(Animation::TRANSFORM);
+ Animation* animation =
+ controller->GetAnimation(TargetProperty::TRANSFORM);
player_child_->RemoveAnimation(animation->id());
gfx::Transform transform;
transform.Translate(10.f, 10.f);
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 268d01b..254f253b 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -1923,7 +1923,7 @@
bool LayerTreeImpl::HasAnyAnimationTargetingProperty(
const LayerImpl* layer,
- Animation::TargetProperty property) const {
+ TargetProperty::Type property) const {
return layer_tree_host_impl_->animation_host()
? layer_tree_host_impl_->animation_host()
->HasAnyAnimationTargetingProperty(layer->id(), property)
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h
index bafbed1..f9f1ba1 100644
--- a/cc/trees/layer_tree_impl.h
+++ b/cc/trees/layer_tree_impl.h
@@ -412,9 +412,8 @@
bool HasPotentiallyRunningOpacityAnimation(const LayerImpl* layer) const;
bool HasPotentiallyRunningTransformAnimation(const LayerImpl* layer) const;
- bool HasAnyAnimationTargetingProperty(
- const LayerImpl* layer,
- Animation::TargetProperty property) const;
+ bool HasAnyAnimationTargetingProperty(const LayerImpl* layer,
+ TargetProperty::Type property) const;
bool FilterIsAnimatingOnImplOnly(const LayerImpl* layer) const;
bool OpacityIsAnimatingOnImplOnly(const LayerImpl* layer) const;
diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc
index c159aaa..551c911 100644
--- a/cc/trees/property_tree_builder.cc
+++ b/cc/trees/property_tree_builder.cc
@@ -241,7 +241,7 @@
// in the Finished state at tree-building time on the main thread is still in
// the Running state right after commit on the compositor thread.
const bool has_any_transform_animation =
- layer->HasAnyAnimationTargetingProperty(Animation::TRANSFORM);
+ layer->HasAnyAnimationTargetingProperty(TargetProperty::TRANSFORM);
const bool has_surface = created_render_surface;
diff --git a/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp b/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp
index 362c833..da39c595 100644
--- a/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp
+++ b/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp
@@ -678,11 +678,11 @@
PropertySpecificKeyframeVector values;
getKeyframeValuesForProperty(&effect, property, compositorTiming.scaledDuration, values);
- CompositorAnimation::TargetProperty targetProperty;
+ CompositorTargetProperty::Type targetProperty;
OwnPtr<CompositorAnimationCurve> curve;
switch (property.cssProperty()) {
case CSSPropertyOpacity: {
- targetProperty = CompositorAnimation::TargetPropertyOpacity;
+ targetProperty = CompositorTargetProperty::OPACITY;
CompositorFloatAnimationCurve* floatCurve = CompositorFactory::current().createFloatAnimationCurve();
addKeyframesToCurve(*floatCurve, values, timing);
@@ -692,7 +692,7 @@
}
case CSSPropertyWebkitFilter:
case CSSPropertyBackdropFilter: {
- targetProperty = CompositorAnimation::TargetPropertyFilter;
+ targetProperty = CompositorTargetProperty::FILTER;
CompositorFilterAnimationCurve* filterCurve = CompositorFactory::current().createFilterAnimationCurve();
addKeyframesToCurve(*filterCurve, values, timing);
setTimingFunctionOnCurve(*filterCurve, timing.timingFunction.get());
@@ -703,7 +703,7 @@
case CSSPropertyScale:
case CSSPropertyTranslate:
case CSSPropertyTransform: {
- targetProperty = CompositorAnimation::TargetPropertyTransform;
+ targetProperty = CompositorTargetProperty::TRANSFORM;
CompositorTransformAnimationCurve* transformCurve = CompositorFactory::current().createTransformAnimationCurve();
addKeyframesToCurve(*transformCurve, values, timing);
setTimingFunctionOnCurve(*transformCurve, timing.timingFunction.get());
diff --git a/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp b/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp
index 86e27384..1a599a7 100644
--- a/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp
+++ b/third_party/WebKit/Source/core/animation/CompositorAnimationsTest.cpp
@@ -669,10 +669,10 @@
usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(CompositorFloatKeyframe(1.0, 5.0)));
// Create animation
- WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorAnimation::TargetPropertyOpacity);
+ WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorTargetProperty::OPACITY);
ExpectationSet usesMockAnimation;
- usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorAnimation::TargetPropertyOpacity, _, _))
+ usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorTargetProperty::OPACITY, _, _))
.WillOnce(Return(mockAnimationPtr));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
@@ -714,10 +714,10 @@
usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(CompositorFloatKeyframe(10.0, 5.0)));
// Create animation
- WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorAnimation::TargetPropertyOpacity);
+ WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorTargetProperty::OPACITY);
ExpectationSet usesMockAnimation;
- usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorAnimation::TargetPropertyOpacity, _, _))
+ usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorTargetProperty::OPACITY, _, _))
.WillOnce(Return(mockAnimationPtr));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
@@ -766,10 +766,10 @@
usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(CompositorFloatKeyframe(1.0, 5.0)));
// KeyframeEffect is created
- WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorAnimation::TargetPropertyOpacity);
+ WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorTargetProperty::OPACITY);
ExpectationSet usesMockAnimation;
- usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorAnimation::TargetPropertyOpacity, _, _))
+ usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorTargetProperty::OPACITY, _, _))
.WillOnce(Return(mockAnimationPtr));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
@@ -813,10 +813,10 @@
usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(CompositorFloatKeyframe(1.75, 5.0)));
// Create animation
- WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorAnimation::TargetPropertyOpacity);
+ WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorTargetProperty::OPACITY);
ExpectationSet usesMockAnimation;
- usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorAnimation::TargetPropertyOpacity, _, _))
+ usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorTargetProperty::OPACITY, _, _))
.WillOnce(Return(mockAnimationPtr));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
@@ -870,10 +870,10 @@
usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(CompositorFloatKeyframe(2.0, 5.0)));
// KeyframeEffect is created
- WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorAnimation::TargetPropertyOpacity);
+ WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorTargetProperty::OPACITY);
ExpectationSet usesMockAnimation;
- usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorAnimation::TargetPropertyOpacity, _, _))
+ usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorTargetProperty::OPACITY, _, _))
.WillOnce(Return(mockAnimationPtr));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10));
@@ -928,10 +928,10 @@
usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(CompositorFloatKeyframe(1.0, 5.0)));
// Create the animation
- WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorAnimation::TargetPropertyOpacity);
+ WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorTargetProperty::OPACITY);
ExpectationSet usesMockAnimation;
- usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorAnimation::TargetPropertyOpacity, _, _))
+ usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorTargetProperty::OPACITY, _, _))
.WillOnce(Return(mockAnimationPtr));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(10));
@@ -976,10 +976,10 @@
usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(CompositorFloatKeyframe(1.5, 5.0)));
// Create animation
- WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorAnimation::TargetPropertyOpacity);
+ WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorTargetProperty::OPACITY);
ExpectationSet usesMockAnimation;
- usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorAnimation::TargetPropertyOpacity, _, _))
+ usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorTargetProperty::OPACITY, _, _))
.WillOnce(Return(mockAnimationPtr));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(5));
@@ -1021,10 +1021,10 @@
usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(CompositorFloatKeyframe(1.0, 5.0)));
// Create animation
- WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorAnimation::TargetPropertyOpacity);
+ WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorTargetProperty::OPACITY);
ExpectationSet usesMockAnimation;
- usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorAnimation::TargetPropertyOpacity, _, _))
+ usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorTargetProperty::OPACITY, _, _))
.WillOnce(Return(mockAnimationPtr));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
@@ -1066,10 +1066,10 @@
usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(CompositorFloatKeyframe(1.0, 5.0)));
// Create animation
- WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorAnimation::TargetPropertyOpacity);
+ WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorTargetProperty::OPACITY);
ExpectationSet usesMockAnimation;
- usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorAnimation::TargetPropertyOpacity, _, _))
+ usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorTargetProperty::OPACITY, _, _))
.WillOnce(Return(mockAnimationPtr));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
@@ -1111,10 +1111,10 @@
usesMockCurve += EXPECT_CALL(*mockCurvePtr, add(CompositorFloatKeyframe(1.0, 5.0)));
// Create animation
- WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorAnimation::TargetPropertyOpacity);
+ WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorTargetProperty::OPACITY);
ExpectationSet usesMockAnimation;
- usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorAnimation::TargetPropertyOpacity, _, _))
+ usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorTargetProperty::OPACITY, _, _))
.WillOnce(Return(mockAnimationPtr));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
@@ -1157,10 +1157,10 @@
usesMockCurve += EXPECT_CALL(*mockCurvePtr, setCubicBezierTimingFunction(1, 2, 3, 4));
// Create animation
- WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorAnimation::TargetPropertyOpacity);
+ WebCompositorAnimationMock* mockAnimationPtr = new WebCompositorAnimationMock(CompositorTargetProperty::OPACITY);
ExpectationSet usesMockAnimation;
- usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorAnimation::TargetPropertyOpacity, _, _))
+ usesMockCurve += EXPECT_CALL(*m_mockCompositorFactory, createAnimation(Ref(*mockCurvePtr), CompositorTargetProperty::OPACITY, _, _))
.WillOnce(Return(mockAnimationPtr));
usesMockAnimation += EXPECT_CALL(*mockAnimationPtr, setIterations(1));
diff --git a/third_party/WebKit/Source/core/animation/CompositorAnimationsTestHelper.h b/third_party/WebKit/Source/core/animation/CompositorAnimationsTestHelper.h
index 075bae81..0b53fa4 100644
--- a/third_party/WebKit/Source/core/animation/CompositorAnimationsTestHelper.h
+++ b/third_party/WebKit/Source/core/animation/CompositorAnimationsTestHelper.h
@@ -58,12 +58,12 @@
class WebCompositorAnimationMock : public CompositorAnimation {
private:
- CompositorAnimation::TargetProperty m_property;
+ CompositorTargetProperty::Type m_property;
public:
// Target Property is set through the constructor.
- WebCompositorAnimationMock(CompositorAnimation::TargetProperty p) : m_property(p) { }
- virtual CompositorAnimation::TargetProperty targetProperty() const { return m_property; }
+ WebCompositorAnimationMock(CompositorTargetProperty::Type p) : m_property(p) { }
+ virtual CompositorTargetProperty::Type targetProperty() const { return m_property; }
MOCK_METHOD0(id, int());
MOCK_METHOD0(group, int());
@@ -130,7 +130,7 @@
public:
class CompositorFactoryMock : public CompositorFactory {
public:
- MOCK_METHOD4(createAnimation, CompositorAnimation*(const CompositorAnimationCurve& curve, CompositorAnimation::TargetProperty target, int groupId, int animationId));
+ MOCK_METHOD4(createAnimation, CompositorAnimation*(const CompositorAnimationCurve& curve, CompositorTargetProperty::Type target, int groupId, int animationId));
MOCK_METHOD0(createFloatAnimationCurve, CompositorFloatAnimationCurve*());
MOCK_METHOD0(createAnimationPlayer, CompositorAnimationPlayer*());
MOCK_METHOD0(createAnimationTimeline, CompositorAnimationTimeline*());
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimation.cpp b/third_party/WebKit/Source/platform/animation/CompositorAnimation.cpp
index 6dd71a6d..2e8c2cc0 100644
--- a/third_party/WebKit/Source/platform/animation/CompositorAnimation.cpp
+++ b/third_party/WebKit/Source/platform/animation/CompositorAnimation.cpp
@@ -21,17 +21,7 @@
namespace blink {
-#define STATIC_ASSERT_ENUM(a, b) \
- static_assert(static_cast<int>(a) == static_cast<int>(b), \
- "mismatching enums: " #a)
-
-// TargetProperty
-STATIC_ASSERT_ENUM(CompositorAnimation::TargetPropertyTransform, cc::Animation::TRANSFORM);
-STATIC_ASSERT_ENUM(CompositorAnimation::TargetPropertyOpacity, cc::Animation::OPACITY);
-STATIC_ASSERT_ENUM(CompositorAnimation::TargetPropertyFilter, cc::Animation::FILTER);
-STATIC_ASSERT_ENUM(CompositorAnimation::TargetPropertyScrollOffset, cc::Animation::SCROLL_OFFSET);
-
-CompositorAnimation::CompositorAnimation(const CompositorAnimationCurve& webCurve, TargetProperty targetProperty, int animationId, int groupId)
+CompositorAnimation::CompositorAnimation(const CompositorAnimationCurve& webCurve, CompositorTargetProperty::Type targetProperty, int animationId, int groupId)
{
if (!animationId)
animationId = AnimationIdProvider::NextAnimationId();
@@ -62,9 +52,7 @@
break;
}
}
- m_animation = Animation::Create(
- std::move(curve), animationId, groupId,
- static_cast<cc::Animation::TargetProperty>(targetProperty));
+ m_animation = Animation::Create(std::move(curve), animationId, groupId, targetProperty);
}
CompositorAnimation::CompositorAnimation() {}
@@ -81,9 +69,9 @@
return m_animation->group();
}
-blink::CompositorAnimation::TargetProperty CompositorAnimation::targetProperty() const
+CompositorTargetProperty::Type CompositorAnimation::targetProperty() const
{
- return static_cast<CompositorAnimation::TargetProperty>(m_animation->target_property());
+ return m_animation->target_property();
}
double CompositorAnimation::iterations() const
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimation.h b/third_party/WebKit/Source/platform/animation/CompositorAnimation.h
index 80211b6..17d2a65 100644
--- a/third_party/WebKit/Source/platform/animation/CompositorAnimation.h
+++ b/third_party/WebKit/Source/platform/animation/CompositorAnimation.h
@@ -7,6 +7,7 @@
#include "base/memory/scoped_ptr.h"
#include "platform/PlatformExport.h"
+#include "platform/animation/CompositorTargetProperty.h"
#include "wtf/Noncopyable.h"
namespace cc {
@@ -21,13 +22,6 @@
class PLATFORM_EXPORT CompositorAnimation {
WTF_MAKE_NONCOPYABLE(CompositorAnimation);
public:
- enum TargetProperty {
- TargetPropertyTransform,
- TargetPropertyOpacity,
- TargetPropertyFilter,
- TargetPropertyScrollOffset
- };
-
enum Direction {
DirectionNormal,
DirectionReverse,
@@ -42,14 +36,14 @@
FillModeBoth
};
- CompositorAnimation(const CompositorAnimationCurve&, TargetProperty, int animationId, int groupId);
+ CompositorAnimation(const CompositorAnimationCurve&, CompositorTargetProperty::Type, int animationId, int groupId);
virtual ~CompositorAnimation();
// An id must be unique.
virtual int id();
virtual int group();
- virtual TargetProperty targetProperty() const;
+ virtual CompositorTargetProperty::Type targetProperty() const;
// This is the number of times that the animation will play. If this
// value is zero the animation will not play. If it is negative, then
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.cpp b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.cpp
index 21147bd..ca747797 100644
--- a/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.cpp
+++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.cpp
@@ -70,7 +70,7 @@
void CompositorAnimationPlayer::NotifyAnimationStarted(
base::TimeTicks monotonicTime,
- cc::Animation::TargetProperty targetProperty,
+ cc::TargetProperty::Type targetProperty,
int group)
{
if (m_delegate)
@@ -79,7 +79,7 @@
void CompositorAnimationPlayer::NotifyAnimationFinished(
base::TimeTicks monotonicTime,
- cc::Animation::TargetProperty targetProperty,
+ cc::TargetProperty::Type targetProperty,
int group)
{
if (m_delegate)
@@ -88,7 +88,7 @@
void CompositorAnimationPlayer::NotifyAnimationAborted(
base::TimeTicks monotonicTime,
- cc::Animation::TargetProperty targetProperty,
+ cc::TargetProperty::Type targetProperty,
int group)
{
if (m_delegate)
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.h b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.h
index 9019fe6..b58d656 100644
--- a/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.h
+++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayer.h
@@ -45,9 +45,9 @@
private:
// cc::AnimationDelegate implementation.
- void NotifyAnimationStarted(base::TimeTicks monotonicTime, cc::Animation::TargetProperty, int group) override;
- void NotifyAnimationFinished(base::TimeTicks monotonicTime, cc::Animation::TargetProperty, int group) override;
- void NotifyAnimationAborted(base::TimeTicks monotonicTime, cc::Animation::TargetProperty, int group) override;
+ void NotifyAnimationStarted(base::TimeTicks monotonicTime, cc::TargetProperty::Type, int group) override;
+ void NotifyAnimationFinished(base::TimeTicks monotonicTime, cc::TargetProperty::Type, int group) override;
+ void NotifyAnimationAborted(base::TimeTicks monotonicTime, cc::TargetProperty::Type, int group) override;
scoped_refptr<cc::AnimationPlayer> m_animationPlayer;
WebCompositorAnimationDelegate* m_delegate;
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayerTest.cpp b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayerTest.cpp
index 792d2b7..2aa9eb0 100644
--- a/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayerTest.cpp
+++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationPlayerTest.cpp
@@ -6,6 +6,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
+#include "platform/animation/CompositorTargetProperty.h"
#include "public/platform/WebCompositorAnimationDelegate.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -40,10 +41,10 @@
cc::AnimationPlayer* player = webPlayer->animationPlayer();
webPlayer->setAnimationDelegate(delegate.get());
- player->NotifyAnimationFinished(TimeTicks(), Animation::SCROLL_OFFSET, 0);
+ player->NotifyAnimationFinished(TimeTicks(), CompositorTargetProperty::SCROLL_OFFSET, 0);
webPlayer->setAnimationDelegate(nullptr);
- player->NotifyAnimationFinished(TimeTicks(), Animation::SCROLL_OFFSET, 0);
+ player->NotifyAnimationFinished(TimeTicks(), CompositorTargetProperty::SCROLL_OFFSET, 0);
}
} // namespace blink
diff --git a/third_party/WebKit/Source/platform/animation/CompositorAnimationTest.cpp b/third_party/WebKit/Source/platform/animation/CompositorAnimationTest.cpp
index 4eb4b47..d68d4be 100644
--- a/third_party/WebKit/Source/platform/animation/CompositorAnimationTest.cpp
+++ b/third_party/WebKit/Source/platform/animation/CompositorAnimationTest.cpp
@@ -13,7 +13,7 @@
{
scoped_ptr<CompositorAnimationCurve> curve(new CompositorFloatAnimationCurve());
scoped_ptr<CompositorAnimation> animation(new CompositorAnimation(
- *curve, CompositorAnimation::TargetPropertyOpacity, 1, 0));
+ *curve, CompositorTargetProperty::OPACITY, 1, 0));
// Ensure that the defaults are correct.
EXPECT_EQ(1, animation->iterations());
@@ -26,7 +26,7 @@
{
scoped_ptr<CompositorFloatAnimationCurve> curve(new CompositorFloatAnimationCurve());
scoped_ptr<CompositorAnimation> animation(new CompositorAnimation(
- *curve, CompositorAnimation::TargetPropertyOpacity, 1, 0));
+ *curve, CompositorTargetProperty::OPACITY, 1, 0));
animation->setIterations(2);
animation->setStartTime(2);
animation->setTimeOffset(2);
diff --git a/third_party/WebKit/Source/platform/animation/CompositorTargetProperty.h b/third_party/WebKit/Source/platform/animation/CompositorTargetProperty.h
new file mode 100644
index 0000000..9c091c9
--- /dev/null
+++ b/third_party/WebKit/Source/platform/animation/CompositorTargetProperty.h
@@ -0,0 +1,16 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CompositorTargetProperty_h
+#define CompositorTargetProperty_h
+
+#include "cc/animation/target_property.h"
+
+namespace blink {
+
+namespace CompositorTargetProperty = cc::TargetProperty;
+
+} // namespace blink
+
+#endif // CompositorTargetProperty_h
diff --git a/third_party/WebKit/Source/platform/blink_platform.gypi b/third_party/WebKit/Source/platform/blink_platform.gypi
index 35a2a63..0cb2f1a 100644
--- a/third_party/WebKit/Source/platform/blink_platform.gypi
+++ b/third_party/WebKit/Source/platform/blink_platform.gypi
@@ -150,11 +150,6 @@
'animation/AnimationTranslationUtil.cpp',
'animation/AnimationTranslationUtil.h',
'animation/AnimationUtilities.h',
- 'animation/CubicBezierControlPoints.cpp',
- 'animation/CubicBezierControlPoints.h',
- 'animation/TimingFunction.cpp',
- 'animation/TimingFunction.h',
- 'animation/UnitBezier.h',
'animation/CompositorAnimation.cpp',
'animation/CompositorAnimation.h',
'animation/CompositorAnimationCurve.cpp',
@@ -174,12 +169,18 @@
'animation/CompositorFloatKeyframe.h',
'animation/CompositorScrollOffsetAnimationCurve.cpp',
'animation/CompositorScrollOffsetAnimationCurve.h',
+ 'animation/CompositorTargetProperty.h',
'animation/CompositorTransformAnimationCurve.cpp',
'animation/CompositorTransformAnimationCurve.h',
'animation/CompositorTransformKeyframe.cpp',
'animation/CompositorTransformKeyframe.h',
'animation/CompositorTransformOperations.cpp',
'animation/CompositorTransformOperations.h',
+ 'animation/CubicBezierControlPoints.cpp',
+ 'animation/CubicBezierControlPoints.h',
+ 'animation/TimingFunction.cpp',
+ 'animation/TimingFunction.h',
+ 'animation/UnitBezier.h',
'audio/AudioArray.h',
'audio/AudioBus.cpp',
'audio/AudioBus.h',
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorFactory.cpp b/third_party/WebKit/Source/platform/graphics/CompositorFactory.cpp
index 8695aea..6ab41fd 100644
--- a/third_party/WebKit/Source/platform/graphics/CompositorFactory.cpp
+++ b/third_party/WebKit/Source/platform/graphics/CompositorFactory.cpp
@@ -51,7 +51,7 @@
return new CompositorFilterOperations();
}
- CompositorAnimation* createAnimation(const blink::CompositorAnimationCurve& curve, blink::CompositorAnimation::TargetProperty target, int groupId, int animationId) override
+ CompositorAnimation* createAnimation(const blink::CompositorAnimationCurve& curve, CompositorTargetProperty::Type target, int groupId, int animationId) override
{
return new CompositorAnimation(curve, target, animationId, groupId);
}
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorFactory.h b/third_party/WebKit/Source/platform/graphics/CompositorFactory.h
index 143a9918..612dfda 100644
--- a/third_party/WebKit/Source/platform/graphics/CompositorFactory.h
+++ b/third_party/WebKit/Source/platform/graphics/CompositorFactory.h
@@ -46,7 +46,7 @@
virtual CompositorFilterOperations* createFilterOperations() { return nullptr; }
- virtual CompositorAnimation* createAnimation(const CompositorAnimationCurve&, CompositorAnimation::TargetProperty, int groupId = 0, int animationId = 0) { return nullptr; }
+ virtual CompositorAnimation* createAnimation(const CompositorAnimationCurve&, CompositorTargetProperty::Type, int groupId = 0, int animationId = 0) { return nullptr; }
virtual CompositorAnimationPlayer* createAnimationPlayer() { return nullptr; }
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
index d1e7faf..5a62bb9c 100644
--- a/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayerTest.cpp
@@ -122,7 +122,7 @@
OwnPtr<CompositorFloatAnimationCurve> curve = adoptPtr(CompositorFactory::current().createFloatAnimationCurve());
curve->add(CompositorFloatKeyframe(0.0, 0.0));
- OwnPtr<CompositorAnimation> floatAnimation(adoptPtr(CompositorFactory::current().createAnimation(*curve, CompositorAnimation::TargetPropertyOpacity)));
+ OwnPtr<CompositorAnimation> floatAnimation(adoptPtr(CompositorFactory::current().createAnimation(*curve, CompositorTargetProperty::OPACITY)));
int animationId = floatAnimation->id();
if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
diff --git a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp
index 8f576ea..99f58fd 100644
--- a/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ProgrammaticScrollAnimator.cpp
@@ -124,7 +124,7 @@
bool sentToCompositor = false;
if (!m_scrollableArea->shouldScrollOnMainThread()) {
- OwnPtr<CompositorAnimation> animation = adoptPtr(CompositorFactory::current().createAnimation(*m_animationCurve, CompositorAnimation::TargetPropertyScrollOffset));
+ OwnPtr<CompositorAnimation> animation = adoptPtr(CompositorFactory::current().createAnimation(*m_animationCurve, CompositorTargetProperty::SCROLL_OFFSET));
int animationId = animation->id();
int animationGroupId = animation->group();
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp
index bb9b623..3425f1fd 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp
@@ -265,7 +265,7 @@
OwnPtr<CompositorAnimation> animation = adoptPtr(
CompositorFactory::current().createAnimation(
*m_animationCurve,
- CompositorAnimation::TargetPropertyScrollOffset));
+ CompositorTargetProperty::SCROLL_OFFSET));
// Being here means that either there is an animation that needs
// to be sent to the compositor, or an animation that needs to
// be updated (a new scroll event before the previous animation
diff --git a/third_party/WebKit/Source/web/LinkHighlightImpl.cpp b/third_party/WebKit/Source/web/LinkHighlightImpl.cpp
index 20b0fe77..4b4d726 100644
--- a/third_party/WebKit/Source/web/LinkHighlightImpl.cpp
+++ b/third_party/WebKit/Source/web/LinkHighlightImpl.cpp
@@ -305,7 +305,7 @@
// For layout tests we don't fade out.
curve->add(CompositorFloatKeyframe(fadeDuration + extraDurationRequired, layoutTestMode() ? startOpacity : 0));
- OwnPtr<CompositorAnimation> animation = adoptPtr(CompositorFactory::current().createAnimation(*curve, CompositorAnimation::TargetPropertyOpacity));
+ OwnPtr<CompositorAnimation> animation = adoptPtr(CompositorFactory::current().createAnimation(*curve, CompositorTargetProperty::OPACITY));
m_contentLayer->layer()->setDrawsContent(true);
if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled())
diff --git a/ui/compositor/layer_animation_element.cc b/ui/compositor/layer_animation_element.cc
index 29aa7fa..edf5bdc8 100644
--- a/ui/compositor/layer_animation_element.cc
+++ b/ui/compositor/layer_animation_element.cc
@@ -423,9 +423,9 @@
start_,
target_,
duration()));
- scoped_ptr<cc::Animation> animation(
- cc::Animation::Create(std::move(animation_curve), animation_id(),
- animation_group_id(), cc::Animation::OPACITY));
+ scoped_ptr<cc::Animation> animation(cc::Animation::Create(
+ std::move(animation_curve), animation_id(), animation_group_id(),
+ cc::TargetProperty::OPACITY));
return animation;
}
@@ -476,9 +476,9 @@
start_,
target_,
duration()));
- scoped_ptr<cc::Animation> animation(
- cc::Animation::Create(std::move(animation_curve), animation_id(),
- animation_group_id(), cc::Animation::TRANSFORM));
+ scoped_ptr<cc::Animation> animation(cc::Animation::Create(
+ std::move(animation_curve), animation_id(), animation_group_id(),
+ cc::TargetProperty::TRANSFORM));
return animation;
}
@@ -548,9 +548,9 @@
}
scoped_ptr<cc::Animation> CreateCCAnimation() override {
- scoped_ptr<cc::Animation> animation(
- cc::Animation::Create(animation_curve_->Clone(), animation_id(),
- animation_group_id(), cc::Animation::TRANSFORM));
+ scoped_ptr<cc::Animation> animation(cc::Animation::Create(
+ animation_curve_->Clone(), animation_id(), animation_group_id(),
+ cc::TargetProperty::TRANSFORM));
return animation;
}
@@ -742,12 +742,11 @@
// static
LayerAnimationElement::AnimatableProperty
-LayerAnimationElement::ToAnimatableProperty(
- cc::Animation::TargetProperty property) {
+LayerAnimationElement::ToAnimatableProperty(cc::TargetProperty::Type property) {
switch (property) {
- case cc::Animation::TRANSFORM:
+ case cc::TargetProperty::TRANSFORM:
return TRANSFORM;
- case cc::Animation::OPACITY:
+ case cc::TargetProperty::OPACITY:
return OPACITY;
default:
NOTREACHED();
diff --git a/ui/compositor/layer_animation_element.h b/ui/compositor/layer_animation_element.h
index dc08f90..111f254 100644
--- a/ui/compositor/layer_animation_element.h
+++ b/ui/compositor/layer_animation_element.h
@@ -45,7 +45,7 @@
};
static AnimatableProperty ToAnimatableProperty(
- cc::Animation::TargetProperty property);
+ cc::TargetProperty::Type property);
struct COMPOSITOR_EXPORT TargetValue {
TargetValue();
diff --git a/ui/compositor/layer_animation_sequence_unittest.cc b/ui/compositor/layer_animation_sequence_unittest.cc
index 708cc0a..0a62ddb 100644
--- a/ui/compositor/layer_animation_sequence_unittest.cc
+++ b/ui/compositor/layer_animation_sequence_unittest.cc
@@ -94,7 +94,7 @@
effective_start = start_time + delta;
sequence.OnThreadedAnimationStarted(cc::AnimationEvent(
cc::AnimationEvent::STARTED, 0, sequence.animation_group_id(),
- cc::Animation::OPACITY, effective_start));
+ cc::TargetProperty::OPACITY, effective_start));
sequence.Progress(effective_start + delta/2, &delegate);
EXPECT_FLOAT_EQ(middle, sequence.last_progressed_fraction());
EXPECT_TRUE(sequence.IsFinished(effective_start + delta));
@@ -148,7 +148,7 @@
EXPECT_EQ(starting_group_id, sequence.animation_group_id());
sequence.OnThreadedAnimationStarted(cc::AnimationEvent(
cc::AnimationEvent::STARTED, 0, sequence.animation_group_id(),
- cc::Animation::OPACITY, opacity_effective_start));
+ cc::TargetProperty::OPACITY, opacity_effective_start));
sequence.Progress(opacity_effective_start + delta/2, &delegate);
EXPECT_FLOAT_EQ(0.5, sequence.last_progressed_fraction());
sequence.Progress(opacity_effective_start + delta, &delegate);
@@ -176,7 +176,7 @@
EXPECT_NE(starting_group_id, sequence.animation_group_id());
sequence.OnThreadedAnimationStarted(cc::AnimationEvent(
cc::AnimationEvent::STARTED, 0, sequence.animation_group_id(),
- cc::Animation::TRANSFORM, transform_effective_start));
+ cc::TargetProperty::TRANSFORM, transform_effective_start));
sequence.Progress(transform_effective_start + delta/2, &delegate);
EXPECT_FLOAT_EQ(0.5, sequence.last_progressed_fraction());
EXPECT_TRUE(sequence.IsFinished(transform_effective_start + delta));
diff --git a/ui/compositor/layer_animator_unittest.cc b/ui/compositor/layer_animator_unittest.cc
index 30f008b..f15bb4a 100644
--- a/ui/compositor/layer_animator_unittest.cc
+++ b/ui/compositor/layer_animator_unittest.cc
@@ -375,7 +375,7 @@
cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::OPACITY, effective_start));
+ cc::TargetProperty::OPACITY, effective_start));
animator->Step(effective_start + delta / 2);
@@ -484,7 +484,7 @@
cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::OPACITY, effective_start));
+ cc::TargetProperty::OPACITY, effective_start));
animator->Step(effective_start + delta / 2);
@@ -746,7 +746,7 @@
cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::OPACITY, effective_start));
+ cc::TargetProperty::OPACITY, effective_start));
animator->Step(effective_start + delta / 2);
@@ -870,7 +870,7 @@
cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::OPACITY, effective_start));
+ cc::TargetProperty::OPACITY, effective_start));
animator->Step(effective_start + delta / 2);
@@ -893,7 +893,7 @@
cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::OPACITY, second_effective_start));
+ cc::TargetProperty::OPACITY, second_effective_start));
animator->Step(second_effective_start + delta / 2);
@@ -1193,7 +1193,7 @@
cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::OPACITY, effective_start));
+ cc::TargetProperty::OPACITY, effective_start));
animator->Step(effective_start + delta / 2);
@@ -1221,7 +1221,7 @@
cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::OPACITY, second_effective_start));
+ cc::TargetProperty::OPACITY, second_effective_start));
animator->Step(second_effective_start + delta / 2);
@@ -1465,7 +1465,7 @@
cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::OPACITY, effective_start));
+ cc::TargetProperty::OPACITY, effective_start));
animator->Step(effective_start + delta);
EXPECT_TRUE(test_controller.animator()->is_animating());
@@ -1476,7 +1476,7 @@
cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::OPACITY, second_effective_start));
+ cc::TargetProperty::OPACITY, second_effective_start));
animator->Step(second_effective_start + delta);
@@ -1488,7 +1488,7 @@
cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::OPACITY, third_effective_start));
+ cc::TargetProperty::OPACITY, third_effective_start));
animator->Step(third_effective_start + delta);
EXPECT_TRUE(test_controller.animator()->is_animating());
@@ -1499,7 +1499,7 @@
cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::OPACITY, fourth_effective_start));
+ cc::TargetProperty::OPACITY, fourth_effective_start));
// Skip ahead by a lot.
animator->Step(fourth_effective_start + 1000 * delta);
@@ -1512,7 +1512,7 @@
cc::AnimationEvent::STARTED, 0,
test_controller.GetRunningSequence(LayerAnimationElement::OPACITY)
->animation_group_id(),
- cc::Animation::OPACITY, fifth_effective_start));
+ cc::TargetProperty::OPACITY, fifth_effective_start));
// Skip ahead by a lot.
animator->Step(fifth_effective_start + 999 * delta);
diff --git a/ui/compositor/test/layer_animator_test_controller.cc b/ui/compositor/test/layer_animator_test_controller.cc
index 6ec2cf3..497cb92 100644
--- a/ui/compositor/test/layer_animator_test_controller.cc
+++ b/ui/compositor/test/layer_animator_test_controller.cc
@@ -31,9 +31,9 @@
}
void LayerAnimatorTestController::StartThreadedAnimationsIfNeeded() {
- std::vector<cc::Animation::TargetProperty> threaded_properties;
- threaded_properties.push_back(cc::Animation::OPACITY);
- threaded_properties.push_back(cc::Animation::TRANSFORM);
+ std::vector<cc::TargetProperty::Type> threaded_properties;
+ threaded_properties.push_back(cc::TargetProperty::OPACITY);
+ threaded_properties.push_back(cc::TargetProperty::TRANSFORM);
for (size_t i = 0; i < threaded_properties.size(); i++) {
LayerAnimationElement::AnimatableProperty animatable_property =