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

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: Fix codereview issues. 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
« no previous file with comments | « cc/test/animation_test_common.h ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..48a515bcc89e10bc4ba6d552640ef3f9284e7dfe 100644
--- a/cc/test/animation_test_common.cc
+++ b/cc/test/animation_test_common.cc
@@ -211,30 +211,50 @@ float FakeFloatTransition::GetValue(base::TimeDelta time) const {
return (1.0 - progress) * from_ + progress * to_;
}
+gfx::ScrollOffset FakeLayerAnimationValueProvider::ScrollOffsetForAnimation()
+ const {
+ return scroll_offset_;
+}
+
FakeLayerAnimationValueObserver::FakeLayerAnimationValueObserver()
- : opacity_(0.0f),
- animation_waiting_for_deletion_(false),
- transform_is_animating_(false) {}
+ : 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;
+}
FakeLayerAnimationValueObserver::~FakeLayerAnimationValueObserver() {}
+int FakeLayerAnimationValueObserver::ToIndex(LayerTreeType tree_type) {
+ int index = static_cast<int>(tree_type);
+ DCHECK_GE(index, 0);
+ DCHECK_LE(index, 1);
+ return index;
+}
+
void FakeLayerAnimationValueObserver::OnFilterAnimated(
+ LayerTreeType tree_type,
const FilterOperations& filters) {
- filters_ = filters;
+ filters_[ToIndex(tree_type)] = filters;
}
-void FakeLayerAnimationValueObserver::OnOpacityAnimated(float opacity) {
- opacity_ = opacity;
+void FakeLayerAnimationValueObserver::OnOpacityAnimated(LayerTreeType tree_type,
+ float opacity) {
+ opacity_[ToIndex(tree_type)] = opacity;
}
void FakeLayerAnimationValueObserver::OnTransformAnimated(
+ LayerTreeType tree_type,
const gfx::Transform& transform) {
- transform_ = transform;
+ transform_[ToIndex(tree_type)] = transform;
}
void FakeLayerAnimationValueObserver::OnScrollOffsetAnimated(
+ LayerTreeType tree_type,
const gfx::ScrollOffset& scroll_offset) {
- scroll_offset_ = scroll_offset;
+ scroll_offset_[ToIndex(tree_type)] = scroll_offset;
}
void FakeLayerAnimationValueObserver::OnAnimationWaitingForDeletion() {
@@ -242,21 +262,9 @@ void FakeLayerAnimationValueObserver::OnAnimationWaitingForDeletion() {
}
void FakeLayerAnimationValueObserver::OnTransformIsPotentiallyAnimatingChanged(
+ LayerTreeType tree_type,
bool is_animating) {
- transform_is_animating_ = is_animating;
-}
-
-bool FakeLayerAnimationValueObserver::IsActive() const {
- return true;
-}
-
-bool FakeInactiveLayerAnimationValueObserver::IsActive() const {
- return false;
-}
-
-gfx::ScrollOffset FakeLayerAnimationValueProvider::ScrollOffsetForAnimation()
- const {
- return scroll_offset_;
+ transform_is_animating_[ToIndex(tree_type)] = is_animating;
}
std::unique_ptr<AnimationCurve> FakeFloatTransition::Clone() const {
« no previous file with comments | « cc/test/animation_test_common.h ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698