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 86039dfb672ff6c0a3e9b29c31d58e298738fc39..68b304a6784af82ab456c2b3431c39c2014c608f 100644 |
--- a/cc/layers/picture_layer_impl_unittest.cc |
+++ b/cc/layers/picture_layer_impl_unittest.cc |
@@ -191,7 +191,7 @@ class PictureLayerImplTest : public TestLayerTreeHostBase { |
auto prioritized_tiles = |
tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
for (PictureLayerTiling::CoverageIterator iter( |
- tiling, tiling->contents_scale(), |
+ tiling, tiling->contents_scale_key(), |
gfx::Rect(tiling->tiling_size())); |
iter; ++iter) { |
EXPECT_TRUE(*iter); |
@@ -323,7 +323,7 @@ TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) { |
EXPECT_EQ( |
tiling->GetCurrentVisibleRectForTesting(), |
gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space, |
- tiling->contents_scale())); |
+ tiling->contents_scale_key())); |
} |
// Update tiles with viewport for tile priority as (200, 200, 100, 100) in |
@@ -359,7 +359,7 @@ TEST_F(PictureLayerImplTest, ExternalViewportRectForPrioritizingTiles) { |
EXPECT_EQ( |
tiling->GetCurrentVisibleRectForTesting(), |
gfx::ScaleToEnclosingRect(viewport_rect_for_tile_priority_in_view_space, |
- tiling->contents_scale())); |
+ tiling->contents_scale_key())); |
} |
} |
@@ -435,12 +435,12 @@ TEST_F(PictureLayerImplTest, ClonePartialInvalidation) { |
EXPECT_GT(tilings->num_tilings(), 0u); |
for (size_t i = 0; i < tilings->num_tilings(); ++i) { |
const PictureLayerTiling* tiling = tilings->tiling_at(i); |
- gfx::Rect content_invalidation = |
- gfx::ScaleToEnclosingRect(layer_invalidation, tiling->contents_scale()); |
+ gfx::Rect content_invalidation = gfx::ScaleToEnclosingRect( |
+ layer_invalidation, tiling->contents_scale_key()); |
auto prioritized_tiles = |
tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
for (PictureLayerTiling::CoverageIterator iter( |
- tiling, tiling->contents_scale(), |
+ tiling, tiling->contents_scale_key(), |
gfx::Rect(tiling->tiling_size())); |
iter; ++iter) { |
// We don't always have a tile, but when we do it's because it was |
@@ -464,7 +464,7 @@ TEST_F(PictureLayerImplTest, ClonePartialInvalidation) { |
auto prioritized_tiles = |
tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
for (PictureLayerTiling::CoverageIterator iter( |
- tiling, tiling->contents_scale(), |
+ tiling, tiling->contents_scale_key(), |
gfx::Rect(tiling->tiling_size())); |
iter; ++iter) { |
EXPECT_TRUE(*iter); |
@@ -518,10 +518,11 @@ TEST_F(PictureLayerImplTest, UpdateTilesCreatesTilings) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(2u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(6.f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(6.f * low_res_factor, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 6.f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 6.f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
// If we change the page scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(active_layer(), |
@@ -532,10 +533,11 @@ TEST_F(PictureLayerImplTest, UpdateTilesCreatesTilings) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(4u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(6.6f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(6.6f * low_res_factor, |
- active_layer()->tilings()->tiling_at(2)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 6.6f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 6.6f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(2)->contents_scale_key()); |
// If we change the device scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(active_layer(), |
@@ -546,10 +548,11 @@ TEST_F(PictureLayerImplTest, UpdateTilesCreatesTilings) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(6u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(7.26f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(7.26f * low_res_factor, |
- active_layer()->tilings()->tiling_at(3)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(3)->contents_scale_key()); |
// If we change the device scale factor, but end up at the same total scale |
// factor somehow, then we don't get new tilings. |
@@ -561,10 +564,11 @@ TEST_F(PictureLayerImplTest, UpdateTilesCreatesTilings) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(6u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(7.26f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(7.26f * low_res_factor, |
- active_layer()->tilings()->tiling_at(3)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(3)->contents_scale_key()); |
} |
TEST_F(PictureLayerImplTest, PendingLayerOnlyHasHighResTiling) { |
@@ -587,8 +591,8 @@ TEST_F(PictureLayerImplTest, PendingLayerOnlyHasHighResTiling) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(6.f, |
- pending_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 6.f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the page scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(pending_layer(), |
@@ -599,8 +603,8 @@ TEST_F(PictureLayerImplTest, PendingLayerOnlyHasHighResTiling) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(6.6f, |
- pending_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 6.6f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the device scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(pending_layer(), |
@@ -611,8 +615,8 @@ TEST_F(PictureLayerImplTest, PendingLayerOnlyHasHighResTiling) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(7.26f, |
- pending_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the device scale factor, but end up at the same total scale |
// factor somehow, then we don't get new tilings. |
@@ -624,8 +628,8 @@ TEST_F(PictureLayerImplTest, PendingLayerOnlyHasHighResTiling) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(7.26f, |
- pending_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
} |
TEST_F(PictureLayerImplTest, CreateTilingsEvenIfTwinHasNone) { |
@@ -692,7 +696,7 @@ TEST_F(PictureLayerImplTest, ZoomOutCrash) { |
ResetTilingsAndRasterScales(); |
EXPECT_EQ(0u, active_layer()->tilings()->num_tilings()); |
SetContentsScaleOnBothLayers(32.0f, 1.0f, 32.0f, 1.0f, 0.f, false); |
- EXPECT_EQ(32.f, active_layer()->HighResTiling()->contents_scale()); |
+ EXPECT_EQ(32.f, active_layer()->HighResTiling()->contents_scale_key()); |
host_impl()->PinchGestureBegin(); |
SetContentsScaleOnBothLayers(1.0f, 1.0f, 1.0f, 1.0f, 0.f, false); |
SetContentsScaleOnBothLayers(1.0f, 1.0f, 1.0f, 1.0f, 0.f, false); |
@@ -717,7 +721,7 @@ TEST_F(PictureLayerImplTest, ScaledBoundsOverflowInt) { |
static_cast<float>(std::numeric_limits<int>::max())); |
SetContentsScaleOnBothLayers(scale, 1.0f, scale, 1.0f, 0.f, false); |
- float adjusted_scale = active_layer()->HighResTiling()->contents_scale(); |
+ float adjusted_scale = active_layer()->HighResTiling()->contents_scale_key(); |
EXPECT_LT(adjusted_scale, scale); |
// PopulateSharedQuadState CHECKs for overflows. |
@@ -740,8 +744,8 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) { |
SetContentsScaleOnBothLayers(2.f, 1.0f, 2.f, 1.0f, 0.f, false); |
EXPECT_EQ(active_layer()->num_tilings(), 2u); |
EXPECT_EQ(pending_layer()->num_tilings(), 1u); |
- EXPECT_EQ(active_layer()->tilings()->tiling_at(0)->contents_scale(), 2.f); |
- EXPECT_EQ(active_layer()->tilings()->tiling_at(1)->contents_scale(), |
+ EXPECT_EQ(active_layer()->tilings()->tiling_at(0)->contents_scale_key(), 2.f); |
+ EXPECT_EQ(active_layer()->tilings()->tiling_at(1)->contents_scale_key(), |
2.f * low_res_factor); |
// One of the tilings has to be a low resolution one. |
EXPECT_EQ(LOW_RESOLUTION, |
@@ -757,12 +761,13 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) { |
// the scale (2/kMaxScaleRatioDuringPinch). |
SetContentsScaleOnBothLayers(1.8f, 1.0f, 1.8f, 1.0f, 0.f, false); |
EXPECT_EQ(3u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(2.0f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.0f, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
- EXPECT_FLOAT_EQ(2.0f * low_res_factor, |
- active_layer()->tilings()->tiling_at(2)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 2.0f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.0f, active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 2.0f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(2)->contents_scale_key()); |
// Since we're pinching, we shouldn't create a low resolution tiling. |
EXPECT_FALSE( |
active_layer()->tilings()->FindTilingWithResolution(LOW_RESOLUTION)); |
@@ -782,8 +787,8 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) { |
// kMaxScaleRatioDuringPinch, this will create a new tiling at 4.0. |
SetContentsScaleOnBothLayers(3.8f, 1.0f, 3.8f, 1.f, 0.f, false); |
EXPECT_EQ(4u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(4.0f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 4.0f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// Although one of the tilings matches the low resolution scale, it still |
// shouldn't be marked as low resolution since we're pinching. |
auto* low_res_tiling = |
@@ -801,8 +806,8 @@ TEST_F(PictureLayerImplTest, PinchGestureTilings) { |
// (checked above). |
SetContentsScaleOnBothLayers(4.0f, 1.0f, 4.0f, 1.f, 0.f, false); |
EXPECT_EQ(4u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(4.0f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 4.0f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// Now that we stopped pinching, the low resolution tiling that existed should |
// now be marked as low resolution. |
low_res_tiling = |
@@ -821,10 +826,10 @@ TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) { |
// Set up the high and low res tilings before pinch zoom. |
SetContentsScaleOnBothLayers(0.24f, 1.0f, 0.24f, 1.0f, 0.f, false); |
EXPECT_EQ(2u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(0.24f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(0.0625f, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 0.24f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 0.0625f, active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
// Ensure UpdateTiles won't remove any tilings. |
active_layer()->MarkAllTilingsUsed(); |
@@ -836,12 +841,12 @@ TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) { |
// the scale (1/kMaxScaleRatioDuringPinch). |
SetContentsScaleOnBothLayers(0.2f, 1.0f, 0.2f, 1.0f, 0.f, false); |
EXPECT_EQ(3u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(0.24f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(0.12f, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
- EXPECT_FLOAT_EQ(0.0625, |
- active_layer()->tilings()->tiling_at(2)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 0.24f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 0.12f, active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 0.0625, active_layer()->tilings()->tiling_at(2)->contents_scale_key()); |
// Ensure UpdateTiles won't remove any tilings. |
active_layer()->MarkAllTilingsUsed(); |
@@ -860,8 +865,8 @@ TEST_F(PictureLayerImplTest, SnappedTilingDuringZoom) { |
// is a power of 2 times 0.24. |
SetContentsScaleOnBothLayers(1.f, 1.0f, 1.f, 1.0f, 0.f, false); |
EXPECT_EQ(4u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(1.92f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 1.92f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
} |
TEST_F(PictureLayerImplTest, CleanUpTilings) { |
@@ -878,10 +883,11 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) { |
SetupDefaultTrees(layer_bounds); |
active_layer()->SetHasWillChangeTransformHint(true); |
EXPECT_FLOAT_EQ(2u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(1.f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.f * low_res_factor, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
// Ensure UpdateTiles won't remove any tilings. Note this is unrelated to |
// |used_tilings| variable, and it's here only to ensure that active_layer() |
@@ -892,10 +898,11 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) { |
used_tilings.clear(); |
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
EXPECT_FLOAT_EQ(2u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(1.f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.f * low_res_factor, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
host_impl()->PinchGestureBegin(); |
@@ -904,19 +911,21 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) { |
page_scale = 1.5f; |
SetContentsScaleOnBothLayers(scale, 1.f, page_scale, 1.f, 0.f, false); |
EXPECT_FLOAT_EQ(2u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(1.f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.f * low_res_factor, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
// The tilings are still our target scale, so they aren't removed. |
used_tilings.clear(); |
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
ASSERT_EQ(2u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(1.f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.f * low_res_factor, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
host_impl()->PinchGestureEnd(); |
@@ -925,14 +934,16 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) { |
page_scale = 1.2f; |
SetContentsScaleOnBothLayers(1.2f, 1.f, page_scale, 1.f, 0.f, false); |
ASSERT_EQ(4u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(1.2f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.f, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.2f * low_res_factor, |
- active_layer()->tilings()->tiling_at(2)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.f * low_res_factor, |
- active_layer()->tilings()->tiling_at(3)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 1.2f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.2f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(2)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(3)->contents_scale_key()); |
// Ensure UpdateTiles won't remove any tilings. |
active_layer()->MarkAllTilingsUsed(); |
@@ -943,14 +954,16 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) { |
used_tilings.push_back(active_layer()->tilings()->tiling_at(3)); |
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
ASSERT_EQ(4u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(1.2f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.f, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.2f * low_res_factor, |
- active_layer()->tilings()->tiling_at(2)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.f * low_res_factor, |
- active_layer()->tilings()->tiling_at(3)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 1.2f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.2f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(2)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(3)->contents_scale_key()); |
// Now move the ideal scale to 0.5. Our target stays 1.2. |
SetContentsScaleOnBothLayers(0.5f, 1.f, page_scale, 1.f, 0.f, false); |
@@ -960,12 +973,13 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) { |
used_tilings.clear(); |
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(1.2f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.f, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.2f * low_res_factor, |
- active_layer()->tilings()->tiling_at(2)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 1.2f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.2f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(2)->contents_scale_key()); |
// Now move the ideal scale to 1.0. Our target stays 1.2. |
SetContentsScaleOnBothLayers(1.f, 1.f, page_scale, 1.f, 0.f, false); |
@@ -975,12 +989,13 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) { |
used_tilings.clear(); |
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(1.2f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.f, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.2f * low_res_factor, |
- active_layer()->tilings()->tiling_at(2)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 1.2f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.2f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(2)->contents_scale_key()); |
// Now move the ideal scale to 1.1 on the active layer. Our target stays 1.2. |
SetupDrawPropertiesAndUpdateTiles(active_layer(), 1.1f, 1.f, page_scale, 1.f, |
@@ -991,12 +1006,13 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) { |
used_tilings.clear(); |
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(1.2f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.f, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.2f * low_res_factor, |
- active_layer()->tilings()->tiling_at(2)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 1.2f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.2f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(2)->contents_scale_key()); |
// Move the ideal scale on the pending layer to 1.1 as well. Our target stays |
// 1.2 still. |
@@ -1010,22 +1026,24 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) { |
used_tilings.push_back(active_layer()->tilings()->tiling_at(1)); |
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(1.2f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.f, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.2f * low_res_factor, |
- active_layer()->tilings()->tiling_at(2)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 1.2f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.2f * low_res_factor, |
+ active_layer()->tilings()->tiling_at(2)->contents_scale_key()); |
// If we remove it from our used tilings set, it is outside the range to keep |
// so it is deleted. |
used_tilings.clear(); |
active_layer()->CleanUpTilingsOnActiveLayer(used_tilings); |
ASSERT_EQ(2u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(1.2f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_FLOAT_EQ(1.2 * low_res_factor, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 1.2f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_FLOAT_EQ( |
+ 1.2 * low_res_factor, |
+ active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
} |
TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) { |
@@ -1050,7 +1068,7 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) { |
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_key(), 1.f); |
EXPECT_BOTH_EQ(num_tilings(), 1u); |
// Stop animating, low res gets created. |
@@ -1058,8 +1076,9 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); |
- EXPECT_EQ(active_layer()->LowResTiling()->contents_scale(), low_res_factor); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 1.f); |
+ EXPECT_EQ(active_layer()->LowResTiling()->contents_scale_key(), |
+ low_res_factor); |
EXPECT_EQ(active_layer()->num_tilings(), 2u); |
EXPECT_EQ(pending_layer()->num_tilings(), 1u); |
@@ -1076,7 +1095,7 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 2.f); |
EXPECT_FALSE(active_layer()->LowResTiling()); |
EXPECT_FALSE(pending_layer()->LowResTiling()); |
EXPECT_EQ(3u, active_layer()->num_tilings()); |
@@ -1087,8 +1106,8 @@ TEST_F(PictureLayerImplTest, DontAddLowResDuringAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); |
- EXPECT_EQ(active_layer()->LowResTiling()->contents_scale(), |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 2.f); |
+ EXPECT_EQ(active_layer()->LowResTiling()->contents_scale_key(), |
2.f * low_res_factor); |
EXPECT_EQ(4u, active_layer()->num_tilings()); |
EXPECT_EQ(1u, pending_layer()->num_tilings()); |
@@ -1116,7 +1135,7 @@ TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), contents_scale); |
EXPECT_BOTH_EQ(num_tilings(), 1u); |
ResetTilingsAndRasterScales(); |
@@ -1126,7 +1145,7 @@ TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), contents_scale); |
EXPECT_BOTH_EQ(num_tilings(), 1u); |
// TODO(danakj): Remove these when raster scale doesn't get fixed? |
@@ -1138,8 +1157,8 @@ TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale); |
- EXPECT_EQ(active_layer()->LowResTiling()->contents_scale(), |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), contents_scale); |
+ EXPECT_EQ(active_layer()->LowResTiling()->contents_scale_key(), |
contents_scale * low_res_factor); |
EXPECT_FALSE(pending_layer()->LowResTiling()); |
EXPECT_EQ(active_layer()->num_tilings(), 2u); |
@@ -1166,7 +1185,7 @@ TEST_F(PictureLayerImplTest, DontAddLowResForSmallLayers) { |
SetupDrawPropertiesAndUpdateTiles( |
mask_raw, contents_scale, device_scale, page_scale, |
maximum_animation_scale, starting_animation_scale, animating_transform); |
- EXPECT_EQ(mask_raw->HighResTiling()->contents_scale(), contents_scale); |
+ EXPECT_EQ(mask_raw->HighResTiling()->contents_scale_key(), contents_scale); |
EXPECT_EQ(mask_raw->num_tilings(), 1u); |
} |
@@ -1195,7 +1214,7 @@ TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) { |
FakePictureLayerImpl* pending_mask = static_cast<FakePictureLayerImpl*>( |
pending_layer()->test_properties()->mask_layer); |
- EXPECT_EQ(1.f, pending_mask->HighResTiling()->contents_scale()); |
+ EXPECT_EQ(1.f, pending_mask->HighResTiling()->contents_scale_key()); |
EXPECT_EQ(1u, pending_mask->num_tilings()); |
host_impl()->tile_manager()->InitializeTilesWithResourcesForTesting( |
@@ -1241,7 +1260,7 @@ TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) { |
host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); |
// The mask tiling gets scaled down. |
- EXPECT_LT(pending_mask->HighResTiling()->contents_scale(), 1.f); |
+ EXPECT_LT(pending_mask->HighResTiling()->contents_scale_key(), 1.f); |
EXPECT_EQ(1u, pending_mask->num_tilings()); |
host_impl()->tile_manager()->InitializeTilesWithResourcesForTesting( |
@@ -1325,7 +1344,7 @@ TEST_F(PictureLayerImplTest, ScaledMaskLayer) { |
pending_layer()->test_properties()->mask_layer); |
// Masks are scaled, and do not have a low res tiling. |
- EXPECT_EQ(1.3f, pending_mask->HighResTiling()->contents_scale()); |
+ EXPECT_EQ(1.3f, pending_mask->HighResTiling()->contents_scale_key()); |
EXPECT_EQ(1u, pending_mask->num_tilings()); |
host_impl()->tile_manager()->InitializeTilesWithResourcesForTesting( |
@@ -1660,7 +1679,7 @@ TEST_F(NoLowResPictureLayerImplTest, |
SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size, Region()); |
ASSERT_EQ(1u, pending_layer()->num_tilings()); |
- ASSERT_EQ(1.f, pending_layer()->HighResTiling()->contents_scale()); |
+ ASSERT_EQ(1.f, pending_layer()->HighResTiling()->contents_scale_key()); |
// Set external viewport for tile priority. |
gfx::Transform transform; |
@@ -1858,7 +1877,7 @@ TEST_F(PictureLayerImplTest, |
// One ideal tile exists, this will get used when drawing. |
std::vector<Tile*> ideal_tiles; |
- EXPECT_EQ(2.f, active_layer()->HighResTiling()->contents_scale()); |
+ EXPECT_EQ(2.f, active_layer()->HighResTiling()->contents_scale_key()); |
ideal_tiles.push_back(active_layer()->HighResTiling()->TileAt(0, 0)); |
host_impl()->tile_manager()->InitializeTilesWithResourcesForTesting( |
ideal_tiles); |
@@ -1870,13 +1889,13 @@ TEST_F(PictureLayerImplTest, |
SetupDrawPropertiesAndUpdateTiles(active_layer(), 2.f, 1.f, 1.f, 1.f, 0.f, |
false); |
- EXPECT_EQ(1.f, active_layer()->HighResTiling()->contents_scale()); |
+ EXPECT_EQ(1.f, active_layer()->HighResTiling()->contents_scale_key()); |
EXPECT_EQ(1.f, active_layer()->raster_contents_scale()); |
EXPECT_EQ(2.f, active_layer()->ideal_contents_scale()); |
// Both tilings still exist. |
- EXPECT_EQ(2.f, active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_EQ(1.f, active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ EXPECT_EQ(2.f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_EQ(1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
// All high res tiles have resources. |
std::vector<Tile*> high_tiles = |
@@ -2450,7 +2469,7 @@ TEST_F(PictureLayerImplTest, FirstTilingDuringPinch) { |
SetupDefaultTrees(gfx::Size(10, 10)); |
// We start with a tiling at scale 1. |
- EXPECT_EQ(1.f, pending_layer()->HighResTiling()->contents_scale()); |
+ EXPECT_EQ(1.f, pending_layer()->HighResTiling()->contents_scale_key()); |
// When we page scale up by 2.3, we get a new tiling that is a power of 2, in |
// this case 4. |
@@ -2458,14 +2477,14 @@ TEST_F(PictureLayerImplTest, FirstTilingDuringPinch) { |
float high_res_scale = 2.3f; |
SetContentsScaleOnBothLayers(high_res_scale, 1.f, high_res_scale, 1.f, 0.f, |
false); |
- EXPECT_EQ(4.f, pending_layer()->HighResTiling()->contents_scale()); |
+ EXPECT_EQ(4.f, pending_layer()->HighResTiling()->contents_scale_key()); |
} |
TEST_F(PictureLayerImplTest, PinchingTooSmall) { |
SetupDefaultTrees(gfx::Size(10, 10)); |
// We start with a tiling at scale 1. |
- EXPECT_EQ(1.f, pending_layer()->HighResTiling()->contents_scale()); |
+ EXPECT_EQ(1.f, pending_layer()->HighResTiling()->contents_scale_key()); |
host_impl()->PinchGestureBegin(); |
float high_res_scale = 0.0001f; |
@@ -2474,7 +2493,7 @@ TEST_F(PictureLayerImplTest, PinchingTooSmall) { |
SetContentsScaleOnBothLayers(high_res_scale, 1.f, high_res_scale, 1.f, 0.f, |
false); |
EXPECT_FLOAT_EQ(pending_layer()->MinimumContentsScale(), |
- pending_layer()->HighResTiling()->contents_scale()); |
+ pending_layer()->HighResTiling()->contents_scale_key()); |
} |
TEST_F(PictureLayerImplTest, PinchingTooSmallWithContentsScale) { |
@@ -2487,7 +2506,7 @@ TEST_F(PictureLayerImplTest, PinchingTooSmallWithContentsScale) { |
ASSERT_GE(pending_layer()->num_tilings(), 0u); |
EXPECT_FLOAT_EQ(contents_scale, |
- pending_layer()->HighResTiling()->contents_scale()); |
+ pending_layer()->HighResTiling()->contents_scale_key()); |
host_impl()->PinchGestureBegin(); |
@@ -2499,7 +2518,7 @@ TEST_F(PictureLayerImplTest, PinchingTooSmallWithContentsScale) { |
1.f, 0.f, false); |
ASSERT_GE(pending_layer()->num_tilings(), 0u); |
EXPECT_FLOAT_EQ(pending_layer()->MinimumContentsScale(), |
- pending_layer()->HighResTiling()->contents_scale()); |
+ pending_layer()->HighResTiling()->contents_scale_key()); |
} |
TEST_F(PictureLayerImplTest, ConsiderAnimationStartScaleForRasterScale) { |
@@ -2516,13 +2535,13 @@ TEST_F(PictureLayerImplTest, ConsiderAnimationStartScaleForRasterScale) { |
float starting_animation_scale = 1.f; |
bool animating_transform = true; |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 1.f); |
// Maximum animation scale is greater than starting animation scale |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f); |
animating_transform = false; |
@@ -2530,7 +2549,7 @@ TEST_F(PictureLayerImplTest, ConsiderAnimationStartScaleForRasterScale) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 2.f); |
// Starting animation scale greater than maximum animation scale |
// Bounds at starting scale within the viewport |
@@ -2540,14 +2559,14 @@ TEST_F(PictureLayerImplTest, ConsiderAnimationStartScaleForRasterScale) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 5.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 5.f); |
// Once we stop animating, a new high-res tiling should be created. |
animating_transform = false; |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 2.f); |
// Starting Animation scale greater than maximum animation scale |
// Bounds at starting scale outisde the viewport |
@@ -2557,7 +2576,7 @@ TEST_F(PictureLayerImplTest, ConsiderAnimationStartScaleForRasterScale) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f); |
} |
TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
@@ -2574,7 +2593,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
float starting_animation_scale = 0.f; |
bool animating_transform = false; |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 1.f); |
// Starting an animation should cause tiling resolution to get set to the |
// maximum animation scale factor. |
@@ -2585,7 +2604,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f); |
// Further changes to scale during the animation should not cause a new |
// high-res tiling to get created. |
@@ -2595,7 +2614,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f); |
// Once we stop animating, a new high-res tiling should be created. |
animating_transform = false; |
@@ -2603,7 +2622,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 4.f); |
// When animating with an unknown maximum animation scale factor, a new |
// high-res tiling should be created at a source scale of 1. |
@@ -2614,7 +2633,8 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), |
+ page_scale * device_scale); |
// Further changes to scale during the animation should not cause a new |
// high-res tiling to get created. |
@@ -2623,7 +2643,8 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), |
+ page_scale * device_scale); |
// Once we stop animating, a new high-res tiling should be created. |
animating_transform = false; |
@@ -2632,7 +2653,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 4.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 4.f); |
// 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 |
@@ -2645,7 +2666,8 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), page_scale * device_scale); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), |
+ page_scale * device_scale); |
// Once we stop animating, a new high-res tiling should be created. |
animating_transform = false; |
@@ -2654,7 +2676,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 11.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 11.f); |
// When animating with a maxmium animation scale factor that is so large |
// that the layer grows larger than the viewport at this scale, and where |
@@ -2667,7 +2689,8 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), device_scale * page_scale); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), |
+ device_scale * page_scale); |
// Once we stop animating, a new high-res tiling should be created. |
animating_transform = false; |
@@ -2676,7 +2699,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 12.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 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 |
@@ -2688,7 +2711,8 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), device_scale * page_scale); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), |
+ device_scale * page_scale); |
// Once we stop animating, a new high-res tiling should be created. |
animating_transform = false; |
@@ -2697,7 +2721,7 @@ TEST_F(PictureLayerImplTest, HighResTilingDuringAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 11.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 11.f); |
} |
TEST_F(PictureLayerImplTest, TilingSetRasterQueue) { |
@@ -2962,18 +2986,19 @@ TEST_F(PictureLayerImplTest, TilingSetEvictionQueue) { |
EXPECT_FALSE(tile->required_for_activation()); |
- while (std::abs(tile->contents_scale() - expected_scales[scale_index]) > |
+ while (std::abs(tile->contents_scale_key() - expected_scales[scale_index]) > |
std::numeric_limits<float>::epsilon()) { |
++scale_index; |
ASSERT_LT(scale_index, arraysize(expected_scales)); |
} |
- EXPECT_FLOAT_EQ(tile->contents_scale(), expected_scales[scale_index]); |
+ EXPECT_FLOAT_EQ(tile->contents_scale_key(), expected_scales[scale_index]); |
unique_tiles.insert(tile); |
if (tile->required_for_activation() == |
last_tile.tile()->required_for_activation() && |
- std::abs(tile->contents_scale() - last_tile.tile()->contents_scale()) < |
+ std::abs(tile->contents_scale_key() - |
+ last_tile.tile()->contents_scale_key()) < |
std::numeric_limits<float>::epsilon()) { |
if (priority.distance_to_visible <= |
last_tile.priority().distance_to_visible) |
@@ -3009,13 +3034,13 @@ TEST_F(PictureLayerImplTest, TilingSetEvictionQueue) { |
scale_index = 0; |
} |
- while (std::abs(tile->contents_scale() - expected_scales[scale_index]) > |
+ while (std::abs(tile->contents_scale_key() - expected_scales[scale_index]) > |
std::numeric_limits<float>::epsilon()) { |
++scale_index; |
ASSERT_LT(scale_index, arraysize(expected_scales)); |
} |
- EXPECT_FLOAT_EQ(tile->contents_scale(), expected_scales[scale_index]); |
+ EXPECT_FLOAT_EQ(tile->contents_scale_key(), expected_scales[scale_index]); |
unique_tiles.insert(tile); |
queue->Pop(); |
} |
@@ -3090,7 +3115,7 @@ TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 2.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 2.f); |
// Changing the source scale without being in an animation will cause |
// the layer to change scale. |
@@ -3099,14 +3124,14 @@ TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 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); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 0.5f); |
// However, if the layer has a will-change property, then the raster scale |
// will get fixed at the last value. |
@@ -3118,7 +3143,7 @@ TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 0.5f); |
// Further changes to the source scale will no longer be reflected in the |
// contents scale. |
@@ -3127,7 +3152,7 @@ TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 0.5f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 0.5f); |
// Disabling the will-change hint will once again make the raster scale update |
// with the ideal scale. |
@@ -3139,7 +3164,7 @@ TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) { |
SetContentsScaleOnBothLayers(contents_scale, device_scale, page_scale, |
maximum_animation_scale, |
starting_animation_scale, animating_transform); |
- EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 3.f); |
+ EXPECT_BOTH_EQ(HighResTiling()->contents_scale_key(), 3.f); |
} |
TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) { |
@@ -3222,8 +3247,8 @@ TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(1u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(6.f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 6.f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the page scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(active_layer(), |
@@ -3234,8 +3259,8 @@ TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(2u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(6.6f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 6.6f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the device scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(active_layer(), |
@@ -3246,8 +3271,8 @@ TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(7.26f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the device scale factor, but end up at the same total scale |
// factor somehow, then we don't get new tilings. |
@@ -3259,8 +3284,8 @@ TEST_F(NoLowResPictureLayerImplTest, ManageTilingsCreatesTilings) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(3u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(7.26f, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f, active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
} |
TEST_F(NoLowResPictureLayerImplTest, PendingLayerOnlyHasHighResTiling) { |
@@ -3280,8 +3305,8 @@ TEST_F(NoLowResPictureLayerImplTest, PendingLayerOnlyHasHighResTiling) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(6.f, |
- pending_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 6.f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the page scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(pending_layer(), |
@@ -3292,8 +3317,8 @@ TEST_F(NoLowResPictureLayerImplTest, PendingLayerOnlyHasHighResTiling) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(6.6f, |
- pending_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 6.6f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the device scale factor, then we should get new tilings. |
SetupDrawPropertiesAndUpdateTiles(pending_layer(), |
@@ -3304,8 +3329,8 @@ TEST_F(NoLowResPictureLayerImplTest, PendingLayerOnlyHasHighResTiling) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(7.26f, |
- pending_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
// If we change the device scale factor, but end up at the same total scale |
// factor somehow, then we don't get new tilings. |
@@ -3317,8 +3342,8 @@ TEST_F(NoLowResPictureLayerImplTest, PendingLayerOnlyHasHighResTiling) { |
0.f, // starting animation scale |
false); |
ASSERT_EQ(1u, pending_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(7.26f, |
- pending_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 7.26f, pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
} |
TEST_F(NoLowResPictureLayerImplTest, AllHighResRequiredEvenIfNotChanged) { |
@@ -3428,8 +3453,8 @@ TEST_F(NoLowResPictureLayerImplTest, CleanUpTilings) { |
page_scale /= 4.f; |
SetContentsScaleOnBothLayers(1.2f, device_scale, page_scale, 1.f, 0.f, false); |
ASSERT_EQ(2u, active_layer()->tilings()->num_tilings()); |
- EXPECT_FLOAT_EQ(1.f, |
- active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ EXPECT_FLOAT_EQ( |
+ 1.f, active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
// Ensure UpdateTiles won't remove any tilings. |
active_layer()->MarkAllTilingsUsed(); |
@@ -3650,8 +3675,8 @@ class OcclusionTrackingPictureLayerImplTest : public PictureLayerImplTest { |
EXPECT_TRUE(tile_priority_bin < last_tile_priority_bin || |
tile->required_for_activation() || |
- tile->contents_scale() != |
- last_tile.tile()->contents_scale()) |
+ tile->contents_scale_key() != |
+ last_tile.tile()->contents_scale_key()) |
<< "line: " << source_line; |
} |
} |
@@ -3929,7 +3954,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, OcclusionForDifferentScales) { |
for (size_t j = 0; j < tiles.size(); ++j) { |
if (prioritized_tiles[tiles[j]].is_occluded()) { |
gfx::Rect scaled_content_rect = ScaleToEnclosingRect( |
- tiles[j]->content_rect(), 1.f / tiles[j]->contents_scale()); |
+ tiles[j]->content_rect(), 1.f / tiles[j]->contents_scale_key()); |
EXPECT_GE(scaled_content_rect.x(), occluding_layer_position.x()); |
occluded_tile_count++; |
} |
@@ -3993,7 +4018,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, DifferentOcclusionOnTrees) { |
const Tile* tile = *iter; |
gfx::Rect scaled_content_rect = ScaleToEnclosingRect( |
- tile->content_rect(), 1.f / tile->contents_scale()); |
+ tile->content_rect(), 1.f / tile->contents_scale_key()); |
// Tiles are occluded on the active tree iff they lie beneath the |
// occluding layer. |
EXPECT_EQ(prioritized_tiles[tile].is_occluded(), |
@@ -4029,7 +4054,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, DifferentOcclusionOnTrees) { |
active_layer()->GetPendingOrActiveTwinTiling(tiling)->TileAt( |
iter.i(), iter.j()); |
gfx::Rect scaled_content_rect = ScaleToEnclosingRect( |
- tile->content_rect(), 1.f / tile->contents_scale()); |
+ tile->content_rect(), 1.f / tile->contents_scale_key()); |
if (scaled_content_rect.Intersects(invalidation_rect)) { |
// Tiles inside the invalidation rect exist on both trees. |
@@ -4137,7 +4162,7 @@ TEST_F(OcclusionTrackingPictureLayerImplTest, |
} |
EXPECT_EQ(expected_occluded_tile_count_on_pending[i], |
occluded_tile_count_on_pending) |
- << tiling->contents_scale(); |
+ << tiling->contents_scale_key(); |
} |
// Verify number of occluded tiles on the active layer for each tiling. |
@@ -4727,7 +4752,7 @@ TEST_F(NoLowResPictureLayerImplTest, LowResWasHighResCollision) { |
float page_scale = 2.f; |
SetContentsScaleOnBothLayers(page_scale, 1.0f, page_scale, 1.0f, 0.f, false); |
EXPECT_BOTH_EQ(num_tilings(), 1u); |
- EXPECT_BOTH_EQ(tilings()->tiling_at(0)->contents_scale(), page_scale); |
+ EXPECT_BOTH_EQ(tilings()->tiling_at(0)->contents_scale_key(), page_scale); |
host_impl()->PinchGestureBegin(); |
@@ -4736,7 +4761,8 @@ TEST_F(NoLowResPictureLayerImplTest, LowResWasHighResCollision) { |
float zoomed = page_scale / low_res_factor; |
SetContentsScaleOnBothLayers(zoomed, 1.0f, zoomed, 1.0f, 0.f, false); |
EXPECT_EQ(1u, pending_layer()->num_tilings()); |
- EXPECT_EQ(zoomed, pending_layer()->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_EQ(zoomed, |
+ pending_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
} |
TEST_F(PictureLayerImplTest, HighResWasLowResCollision) { |
@@ -4754,8 +4780,9 @@ TEST_F(PictureLayerImplTest, HighResWasLowResCollision) { |
page_scale, 1.0f, 0.f, false); |
EXPECT_EQ(2u, active_layer()->tilings()->num_tilings()); |
EXPECT_EQ(page_scale, |
- active_layer()->tilings()->tiling_at(0)->contents_scale()); |
- EXPECT_EQ(low_res, active_layer()->tilings()->tiling_at(1)->contents_scale()); |
+ active_layer()->tilings()->tiling_at(0)->contents_scale_key()); |
+ EXPECT_EQ(low_res, |
+ active_layer()->tilings()->tiling_at(1)->contents_scale_key()); |
// Grab a current low res tile. |
PictureLayerTiling* old_low_res_tiling = |
@@ -4780,9 +4807,9 @@ TEST_F(PictureLayerImplTest, HighResWasLowResCollision) { |
EXPECT_EQ(3u, active_layer()->num_tilings()); |
PictureLayerTilingSet* tilings = active_layer()->tilings(); |
- EXPECT_EQ(page_scale, tilings->tiling_at(0)->contents_scale()); |
- EXPECT_EQ(low_res, tilings->tiling_at(1)->contents_scale()); |
- EXPECT_EQ(extra_low_res, tilings->tiling_at(2)->contents_scale()); |
+ EXPECT_EQ(page_scale, tilings->tiling_at(0)->contents_scale_key()); |
+ EXPECT_EQ(low_res, tilings->tiling_at(1)->contents_scale_key()); |
+ EXPECT_EQ(extra_low_res, tilings->tiling_at(2)->contents_scale_key()); |
EXPECT_EQ(NON_IDEAL_RESOLUTION, tilings->tiling_at(0)->resolution()); |
EXPECT_EQ(HIGH_RESOLUTION, tilings->tiling_at(1)->resolution()); |
@@ -4853,7 +4880,8 @@ TEST_F(PictureLayerImplTest, CompositedImageIgnoreIdealContentsScale) { |
pending_layer_ptr, suggested_ideal_contents_scale, device_scale_factor, |
page_scale_factor, animation_contents_scale, animation_contents_scale, |
animating_transform_to_screen); |
- EXPECT_EQ(1.f, pending_layer_ptr->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_EQ(1.f, |
+ pending_layer_ptr->tilings()->tiling_at(0)->contents_scale_key()); |
// Push to active layer. |
host_impl()->ActivateSyncTree(); |
@@ -4864,7 +4892,7 @@ TEST_F(PictureLayerImplTest, CompositedImageIgnoreIdealContentsScale) { |
active_layer, suggested_ideal_contents_scale, device_scale_factor, |
page_scale_factor, animation_contents_scale, animation_contents_scale, |
animating_transform_to_screen); |
- EXPECT_EQ(1.f, active_layer->tilings()->tiling_at(0)->contents_scale()); |
+ EXPECT_EQ(1.f, active_layer->tilings()->tiling_at(0)->contents_scale_key()); |
active_layer->set_visible_layer_rect(gfx::Rect(layer_bounds)); |
// Create resources for the tiles. |
@@ -4920,7 +4948,7 @@ TEST_F(PictureLayerImplTest, CompositedImageRasterScaleChanges) { |
EXPECT_FLOAT_EQ(expected_contents_scale, |
pending_layer_ptr->picture_layer_tiling_set() |
->FindTilingWithResolution(HIGH_RESOLUTION) |
- ->contents_scale()) |
+ ->contents_scale_key()) |
<< "ideal_contents_scale: " << ideal_contents_scale; |
} |
@@ -4942,7 +4970,7 @@ TEST_F(PictureLayerImplTest, CompositedImageRasterScaleChanges) { |
EXPECT_FLOAT_EQ(expected_contents_scale, |
pending_layer_ptr->picture_layer_tiling_set() |
->FindTilingWithResolution(HIGH_RESOLUTION) |
- ->contents_scale()) |
+ ->contents_scale_key()) |
<< "ideal_contents_scale: " << ideal_contents_scale; |
} |
} |