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 61ac6bb99b8dd4d47431757071940e6e5532e8dc..399639bda894334a432038bc39c3cd9405a47979 100644 |
--- a/cc/layers/picture_layer_impl_unittest.cc |
+++ b/cc/layers/picture_layer_impl_unittest.cc |
@@ -925,6 +925,7 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) { |
float page_scale = 1.f; |
SetupDefaultTrees(layer_bounds); |
+ active_layer()->SetHasWillChangeTransformHint(true); |
danakj
2016/06/16 18:15:29
What do you think of the test changes in https://c
|
EXPECT_EQ(2u, active_layer()->tilings()->num_tilings()); |
EXPECT_EQ(1.f, active_layer()->HighResTiling()->contents_scale()); |
@@ -1829,6 +1830,7 @@ TEST_F(PictureLayerImplTest, |
SetInitialDeviceScaleFactor(2.f); |
SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region()); |
+ active_layer()->SetHasWillChangeTransformHint(true); |
// One ideal tile exists, this will get used when drawing. |
std::vector<Tile*> ideal_tiles; |
@@ -3119,22 +3121,53 @@ TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) { |
EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); |
// Changing the source scale without being in an animation will cause |
- // the layer to reset its source scale to 1.f. |
+ // the layer to change scale. |
contents_scale = 3.f; |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f); |
+ |
+ contents_scale = 0.5f; |
+ |
+ SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
+ maximum_animation_scale, |
+ starting_animation_scale, animating_transform); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f); |
+ |
+ // However, if the layer has a will-change property, then the raster scale |
+ // will get fixed at the last value. |
+ active_layer()->SetHasWillChangeTransformHint(true); |
+ pending_layer()->SetHasWillChangeTransformHint(true); |
+ |
+ contents_scale = 3.f; |
+ |
+ SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
+ maximum_animation_scale, |
+ starting_animation_scale, animating_transform); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f); |
// Further changes to the source scale will no longer be reflected in the |
// contents scale. |
- contents_scale = 0.5f; |
+ contents_scale = 1.f; |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f); |
+ |
+ // Disabling the will-change hint will once again make the raster scale update |
+ // with the ideal scale. |
+ active_layer()->SetHasWillChangeTransformHint(false); |
+ pending_layer()->SetHasWillChangeTransformHint(false); |
+ |
+ contents_scale = 3.f; |
+ |
+ SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
+ maximum_animation_scale, |
+ starting_animation_scale, animating_transform); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f); |
} |
TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) { |
@@ -3385,6 +3418,7 @@ TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) { |
float page_scale = 3.2f; |
float scale = 1.f; |
+ active_layer()->SetHasWillChangeTransformHint(true); |
ResetTilingsAndRasterScales(); |
SetContentsScaleOnBothLayers(scale, device_scale, page_scale, 1.f, 0.f, |