| Index: cc/trees/layer_tree_host_impl_unittest.cc
|
| diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
|
| index a9e5a559a68a02739e4a0aea73abb2d1255eccb2..0e07a66280bbf447b9c2e6bc13b55a8f11fc06aa 100644
|
| --- a/cc/trees/layer_tree_host_impl_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_impl_unittest.cc
|
| @@ -12396,5 +12396,77 @@ TEST_F(LayerTreeHostImplTest, RasterColorSpace) {
|
| EXPECT_EQ(host_impl_->GetRasterColorSpace(), gfx::ColorSpace::CreateSRGB());
|
| }
|
|
|
| +TEST_F(LayerTreeHostImplTest, RasterTilePrioritizationForNonDrawingLayers) {
|
| + gfx::Size layer_bounds(500, 500);
|
| +
|
| + host_impl_->SetViewportSize(layer_bounds);
|
| + host_impl_->CreatePendingTree();
|
| + std::unique_ptr<LayerImpl> scoped_root =
|
| + LayerImpl::Create(host_impl_->pending_tree(), 1);
|
| + scoped_root->SetBounds(layer_bounds);
|
| + LayerImpl* root = scoped_root.get();
|
| + host_impl_->pending_tree()->SetRootLayerForTesting(std::move(scoped_root));
|
| +
|
| + scoped_refptr<FakeRasterSource> raster_source(
|
| + FakeRasterSource::CreateFilled(layer_bounds));
|
| +
|
| + std::unique_ptr<FakePictureLayerImpl> scoped_hidden_layer =
|
| + FakePictureLayerImpl::CreateWithRasterSource(host_impl_->pending_tree(),
|
| + 2, raster_source);
|
| + scoped_hidden_layer->SetBounds(layer_bounds);
|
| + scoped_hidden_layer->SetDrawsContent(true);
|
| + scoped_hidden_layer->set_contributes_to_drawn_render_surface(true);
|
| + FakePictureLayerImpl* hidden_layer = scoped_hidden_layer.get();
|
| + root->test_properties()->AddChild(std::move(scoped_hidden_layer));
|
| +
|
| + std::unique_ptr<FakePictureLayerImpl> scoped_drawing_layer =
|
| + FakePictureLayerImpl::CreateWithRasterSource(host_impl_->pending_tree(),
|
| + 3, raster_source);
|
| + scoped_drawing_layer->SetBounds(layer_bounds);
|
| + scoped_drawing_layer->SetDrawsContent(true);
|
| + scoped_drawing_layer->set_contributes_to_drawn_render_surface(true);
|
| + FakePictureLayerImpl* drawing_layer = scoped_drawing_layer.get();
|
| + root->test_properties()->AddChild(std::move(scoped_drawing_layer));
|
| +
|
| + gfx::Rect layer_rect(0, 0, 500, 500);
|
| + gfx::Rect empty_rect(0, 0, 0, 0);
|
| + host_impl_->pending_tree()->BuildPropertyTreesForTesting();
|
| +
|
| + hidden_layer->tilings()->AddTiling(gfx::AxisTransform2d(), raster_source);
|
| + PictureLayerTiling* hidden_tiling = hidden_layer->tilings()->tiling_at(0);
|
| + hidden_tiling->set_resolution(TileResolution::LOW_RESOLUTION);
|
| + hidden_tiling->CreateAllTilesForTesting();
|
| + hidden_tiling->SetTilePriorityRectsForTesting(
|
| + layer_rect, // Visible rect.
|
| + layer_rect, // Skewport rect.
|
| + layer_rect, // Soon rect.
|
| + layer_rect); // Eventually rect.
|
| +
|
| + drawing_layer->tilings()->AddTiling(gfx::AxisTransform2d(), raster_source);
|
| + PictureLayerTiling* drawing_tiling = drawing_layer->tilings()->tiling_at(0);
|
| + drawing_tiling->set_resolution(TileResolution::HIGH_RESOLUTION);
|
| + drawing_tiling->CreateAllTilesForTesting();
|
| + drawing_tiling->SetTilePriorityRectsForTesting(
|
| + layer_rect, // Visible rect.
|
| + layer_rect, // Skewport rect.
|
| + layer_rect, // Soon rect.
|
| + layer_rect); // Eventually rect.
|
| +
|
| + // Both layers are drawn. Since the hidden layer has a low resolution tiling,
|
| + // in smoothness priority mode its tile is higher priority.
|
| + std::unique_ptr<RasterTilePriorityQueue> queue =
|
| + host_impl_->BuildRasterQueue(TreePriority::SMOOTHNESS_TAKES_PRIORITY,
|
| + RasterTilePriorityQueue::Type::ALL);
|
| + EXPECT_EQ(queue->Top().tile()->layer_id(), 2);
|
| +
|
| + // Hide the hidden layer and set it to so it still rasters. Now the drawing
|
| + // layer should be prioritized over the hidden layer.
|
| + hidden_layer->set_contributes_to_drawn_render_surface(false);
|
| + hidden_layer->set_raster_even_if_not_in_rsll(true);
|
| + queue = host_impl_->BuildRasterQueue(TreePriority::SMOOTHNESS_TAKES_PRIORITY,
|
| + RasterTilePriorityQueue::Type::ALL);
|
| + EXPECT_EQ(queue->Top().tile()->layer_id(), 3);
|
| +}
|
| +
|
| } // namespace
|
| } // namespace cc
|
|
|