Index: cc/layers/picture_layer_impl_unittest.cc |
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc |
index 9b4533a753cb2f483def9bc1a9d51392e0fd1ace..79eb1b6e4c913f12a29baf2465e0e3e1ea69b023 100644 |
--- a/cc/layers/picture_layer_impl_unittest.cc |
+++ b/cc/layers/picture_layer_impl_unittest.cc |
@@ -1095,6 +1095,7 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) { |
// Page scale animation, new high res, but not new low res because animating. |
contents_scale = 2.f; |
page_scale = 2.f; |
+ maximum_animation_scale = 2.f; |
animating_transform = true; |
SetContentsScaleOnBothLayers(contents_scale, |
device_scale, |
@@ -2315,7 +2316,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) { |
EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); |
// When animating with an unknown maximum animation scale factor, a new |
- // high-res tiling should be created at the animation's initial scale. |
+ // high-res tiling should be created at a source scale of 1. |
animating_transform = true; |
contents_scale = 2.f; |
maximum_animation_scale = 0.f; |
@@ -2325,7 +2326,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) { |
page_scale, |
maximum_animation_scale, |
animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale); |
// Further changes to scale during the animation should not cause a new |
// high-res tiling to get created. |
@@ -2336,7 +2337,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) { |
page_scale, |
maximum_animation_scale, |
animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale); |
// Once we stop animating, a new high-res tiling should be created. |
animating_transform = false; |
@@ -2351,8 +2352,8 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) { |
// When animating with a maxmium animation scale factor that is so large |
// that the layer grows larger than the viewport at this scale, a new |
- // high-res tiling should get created at the animation's initial scale, not |
- // at its maximum scale. |
+ // high-res tiling should get created at a source scale of 1, not at its |
+ // maximum scale. |
animating_transform = true; |
contents_scale = 2.f; |
maximum_animation_scale = 11.f; |
@@ -2362,7 +2363,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) { |
page_scale, |
maximum_animation_scale, |
animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale); |
// Once we stop animating, a new high-res tiling should be created. |
animating_transform = false; |
@@ -2392,6 +2393,31 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimationForCpuRasterization) { |
// Once we stop animating, a new high-res tiling should be created. |
animating_transform = false; |
+ contents_scale = 12.f; |
+ |
+ SetContentsScaleOnBothLayers(contents_scale, |
+ device_scale, |
+ page_scale, |
+ maximum_animation_scale, |
+ animating_transform); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 12.f); |
+ |
+ // When animating toward a smaller scale, but that is still so large that the |
+ // layer grows larger than the viewport at this scale, a new high-res tiling |
+ // should get created at source scale 1. |
+ animating_transform = true; |
+ contents_scale = 11.f; |
+ maximum_animation_scale = 11.f; |
+ |
+ SetContentsScaleOnBothLayers(contents_scale, |
+ device_scale, |
+ page_scale, |
+ maximum_animation_scale, |
+ animating_transform); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), device_scale * page_scale); |
+ |
+ // Once we stop animating, a new high-res tiling should be created. |
+ animating_transform = false; |
contents_scale = 11.f; |
SetContentsScaleOnBothLayers(contents_scale, |