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

Unified Diff: cc/layer_unittest.cc

Issue 12413020: Do not push properties that are animated on impl only. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 9 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/layer_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_unittest.cc
diff --git a/cc/layer_unittest.cc b/cc/layer_unittest.cc
index 847288f08e7212b80bf98d98e3462b4067d5565d..008026d8745417536de68ea81acbdd8444dec151 100644
--- a/cc/layer_unittest.cc
+++ b/cc/layer_unittest.cc
@@ -10,6 +10,7 @@
#include "cc/layer_tree_host.h"
#include "cc/math_util.h"
#include "cc/single_thread_proxy.h"
+#include "cc/test/animation_test_common.h"
#include "cc/test/fake_impl_proxy.h"
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/test/fake_layer_tree_host_impl.h"
@@ -643,6 +644,62 @@ TEST_F(LayerTest, verifyPushPropertiesCausesSurfacePropertyChangedForOpacity)
EXPECT_TRUE(implLayer->LayerSurfacePropertyChanged());
}
+TEST_F(LayerTest, verifyPushPropertiesDoesNotCauseSurfacePropertyChangedDuringImplOnlyTransformAnimation)
+{
+ scoped_refptr<Layer> testLayer = Layer::Create();
+ scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.activeTree(), 1);
+
+ scoped_ptr<AnimationRegistrar> registrar = AnimationRegistrar::create();
+ implLayer->layer_animation_controller()->SetAnimationRegistrar(registrar.get());
+
+ addAnimatedTransformToController(*implLayer->layer_animation_controller(), 1.0, 0, 100);
+
+ gfx::Transform transform;
+ transform.Rotate(45.0);
+ testLayer->SetTransform(transform);
+
+ EXPECT_FALSE(implLayer->LayerSurfacePropertyChanged());
+ testLayer->PushPropertiesTo(implLayer.get());
+ EXPECT_TRUE(implLayer->LayerSurfacePropertyChanged());
+
+ implLayer->ResetAllChangeTrackingForSubtree();
+ addAnimatedTransformToController(*implLayer->layer_animation_controller(), 1.0, 0, 100);
+ implLayer->layer_animation_controller()->GetAnimation(Animation::Transform)->set_is_impl_only(true);
+ transform.Rotate(45.0);
+ testLayer->SetTransform(transform);
+
+ EXPECT_FALSE(implLayer->LayerSurfacePropertyChanged());
+ testLayer->PushPropertiesTo(implLayer.get());
+ EXPECT_FALSE(implLayer->LayerSurfacePropertyChanged());
+}
+
+TEST_F(LayerTest, verifyPushPropertiesDoesNotCauseSurfacePropertyChangedDuringImplOnlyOpacityAnimation)
+{
+ scoped_refptr<Layer> testLayer = Layer::Create();
+ scoped_ptr<LayerImpl> implLayer = LayerImpl::Create(m_hostImpl.activeTree(), 1);
+
+ scoped_ptr<AnimationRegistrar> registrar = AnimationRegistrar::create();
+ implLayer->layer_animation_controller()->SetAnimationRegistrar(registrar.get());
+
+ addOpacityTransitionToController(*implLayer->layer_animation_controller(), 1.0, 0.3f, 0.7f, false);
+
+ testLayer->SetOpacity(0.5f);
+
+ EXPECT_FALSE(implLayer->LayerSurfacePropertyChanged());
+ testLayer->PushPropertiesTo(implLayer.get());
+ EXPECT_TRUE(implLayer->LayerSurfacePropertyChanged());
+
+ implLayer->ResetAllChangeTrackingForSubtree();
+ addOpacityTransitionToController(*implLayer->layer_animation_controller(), 1.0, 0.3f, 0.7f, false);
+ implLayer->layer_animation_controller()->GetAnimation(Animation::Opacity)->set_is_impl_only(true);
+ testLayer->SetOpacity(0.75f);
+
+ EXPECT_FALSE(implLayer->LayerSurfacePropertyChanged());
+ testLayer->PushPropertiesTo(implLayer.get());
+ EXPECT_FALSE(implLayer->LayerSurfacePropertyChanged());
+}
+
+
TEST_F(LayerTest, maskAndReplicaHasParent)
{
scoped_refptr<Layer> parent = Layer::Create();
« no previous file with comments | « cc/layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698