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

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: . 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
« cc/layer_impl.cc ('K') | « 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 c3c20136cbfd85ef365d90995719de9657b96752..d860c685849ace291fda0c984fd345cc09303f44 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,61 @@ 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->layerAnimationController()->setAnimationRegistrar(registrar.get());
+
+ addAnimatedTransformToController(*implLayer->layerAnimationController(), 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->layerAnimationController(), 1.0, 0, 100);
+ implLayer->layerAnimationController()->getAnimation(Animation::Transform)->setIsImplOnly(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->layerAnimationController()->setAnimationRegistrar(registrar.get());
+
+ addOpacityTransitionToController(*implLayer->layerAnimationController(), 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->layerAnimationController(), 1.0, 0.3f, 0.7f, false);
+ implLayer->layerAnimationController()->getAnimation(Animation::Opacity)->setIsImplOnly(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();
« cc/layer_impl.cc ('K') | « cc/layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698