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

Unified Diff: cc/test/animation_test_common.cc

Issue 1882733005: CC Animation: Make LayerAnimationController to have just one value observer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@privatelac
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/test/animation_test_common.cc
diff --git a/cc/test/animation_test_common.cc b/cc/test/animation_test_common.cc
index 58d737ea171b8da9b2897ee9577e3a1547eb94f3..4fc8d774779a9deead2626d40c88d2c452af5039 100644
--- a/cc/test/animation_test_common.cc
+++ b/cc/test/animation_test_common.cc
@@ -219,20 +219,24 @@ FakeLayerAnimationValueObserver::FakeLayerAnimationValueObserver()
FakeLayerAnimationValueObserver::~FakeLayerAnimationValueObserver() {}
void FakeLayerAnimationValueObserver::OnFilterAnimated(
+ LayerTreeType tree_type,
const FilterOperations& filters) {
filters_ = filters;
}
-void FakeLayerAnimationValueObserver::OnOpacityAnimated(float opacity) {
+void FakeLayerAnimationValueObserver::OnOpacityAnimated(LayerTreeType tree_type,
+ float opacity) {
opacity_ = opacity;
}
void FakeLayerAnimationValueObserver::OnTransformAnimated(
+ LayerTreeType tree_type,
const gfx::Transform& transform) {
transform_ = transform;
}
void FakeLayerAnimationValueObserver::OnScrollOffsetAnimated(
+ LayerTreeType tree_type,
const gfx::ScrollOffset& scroll_offset) {
scroll_offset_ = scroll_offset;
}
@@ -242,21 +246,66 @@ void FakeLayerAnimationValueObserver::OnAnimationWaitingForDeletion() {
}
void FakeLayerAnimationValueObserver::OnTransformIsPotentiallyAnimatingChanged(
+ LayerTreeType tree_type,
bool is_animating) {
transform_is_animating_ = is_animating;
}
-bool FakeLayerAnimationValueObserver::IsActive() const {
- return true;
+gfx::ScrollOffset FakeLayerAnimationValueProvider::ScrollOffsetForAnimation()
+ const {
+ return scroll_offset_;
}
-bool FakeInactiveLayerAnimationValueObserver::IsActive() const {
- return false;
+FakeTypedLayerAnimationValueObserver::FakeTypedLayerAnimationValueObserver()
+ : animation_waiting_for_deletion_(false) {
+ opacity_[ToIndex(LayerTreeType::ACTIVE)] = 0.0f;
+ opacity_[ToIndex(LayerTreeType::PENDING)] = 0.0f;
+
+ transform_is_animating_[ToIndex(LayerTreeType::ACTIVE)] = false;
+ transform_is_animating_[ToIndex(LayerTreeType::PENDING)] = false;
}
-gfx::ScrollOffset FakeLayerAnimationValueProvider::ScrollOffsetForAnimation()
- const {
- return scroll_offset_;
+FakeTypedLayerAnimationValueObserver::~FakeTypedLayerAnimationValueObserver() {}
+
+int FakeTypedLayerAnimationValueObserver::ToIndex(LayerTreeType tree_type) {
+ int index = static_cast<int>(tree_type);
+ DCHECK_GE(index, 0);
+ DCHECK_LE(index, 1);
+ return index;
+}
+
+void FakeTypedLayerAnimationValueObserver::OnFilterAnimated(
+ LayerTreeType tree_type,
+ const FilterOperations& filters) {
+ filters_[ToIndex(tree_type)] = filters;
+}
+
+void FakeTypedLayerAnimationValueObserver::OnOpacityAnimated(
+ LayerTreeType tree_type,
+ float opacity) {
+ opacity_[ToIndex(tree_type)] = opacity;
+}
+
+void FakeTypedLayerAnimationValueObserver::OnTransformAnimated(
+ LayerTreeType tree_type,
+ const gfx::Transform& transform) {
+ transform_[ToIndex(tree_type)] = transform;
+}
+
+void FakeTypedLayerAnimationValueObserver::OnScrollOffsetAnimated(
+ LayerTreeType tree_type,
+ const gfx::ScrollOffset& scroll_offset) {
+ scroll_offset_[ToIndex(tree_type)] = scroll_offset;
+}
+
+void FakeTypedLayerAnimationValueObserver::OnAnimationWaitingForDeletion() {
+ animation_waiting_for_deletion_ = true;
+}
+
+void FakeTypedLayerAnimationValueObserver::
+ OnTransformIsPotentiallyAnimatingChanged(LayerTreeType tree_type,
+ bool is_animating) {
+ transform_is_animating_[ToIndex(tree_type)] = is_animating;
}
std::unique_ptr<AnimationCurve> FakeFloatTransition::Clone() const {

Powered by Google App Engine
This is Rietveld 408576698