Index: cc/trees/layer_tree_impl_unittest.cc |
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc |
index 3b0cbeec66371a3212dfb877d0752c6364c65618..b6501afb83b1bc9a078bc49ace2626e61e2f942e 100644 |
--- a/cc/trees/layer_tree_impl_unittest.cc |
+++ b/cc/trees/layer_tree_impl_unittest.cc |
@@ -36,8 +36,8 @@ class LayerTreeImplTest : public testing::Test { |
LayerImpl* root_layer() { return impl_test_.root_layer_for_testing(); } |
- const LayerImplList& RenderSurfaceLayerList() const { |
- return host_impl().active_tree()->RenderSurfaceLayerList(); |
+ const RenderSurfaceList& GetRenderSurfaceList() const { |
+ return host_impl().active_tree()->GetRenderSurfaceList(); |
} |
void ExecuteCalculateDrawProperties(LayerImpl* root_layer) { |
@@ -45,9 +45,9 @@ class LayerTreeImplTest : public testing::Test { |
// empty. |
DCHECK(!root_layer->bounds().IsEmpty()); |
- render_surface_layer_list_impl_.clear(); |
+ render_surface_list_impl_.clear(); |
LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( |
- root_layer, root_layer->bounds(), &render_surface_layer_list_impl_); |
+ root_layer, root_layer->bounds(), &render_surface_list_impl_); |
inputs.can_adjust_raster_scales = true; |
LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); |
} |
@@ -105,7 +105,7 @@ class LayerTreeImplTest : public testing::Test { |
host_impl().SetViewportSize(root->bounds()); |
host_impl().active_tree()->SetRootLayerForTesting(std::move(root)); |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
- CHECK_EQ(1u, RenderSurfaceLayerList().size()); |
+ CHECK_EQ(1u, GetRenderSurfaceList().size()); |
gfx::PointF test_point = gfx::PointF(1.f, 1.f); |
LayerImpl* result_layer = |
@@ -117,7 +117,7 @@ class LayerTreeImplTest : public testing::Test { |
private: |
LayerTestCommon::LayerImplTest impl_test_; |
- std::vector<LayerImpl*> render_surface_layer_list_impl_; |
+ RenderSurfaceList render_surface_list_impl_; |
}; |
TEST_F(LayerTreeImplTest, HitTestingForSingleLayer) { |
@@ -130,8 +130,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayer) { |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(1u, root_layer()->GetRenderSurface()->layer_list().size()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ ASSERT_EQ(1, root_layer()->GetRenderSurface()->num_contributors()); |
// Hit testing for a point outside the layer should return a null pointer. |
gfx::PointF test_point(101.f, 101.f); |
@@ -199,8 +199,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayerAndHud) { |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(2u, root_layer()->GetRenderSurface()->layer_list().size()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ ASSERT_EQ(2, root_layer()->GetRenderSurface()->num_contributors()); |
// Hit testing for a point inside HUD, but outside root should return null |
gfx::PointF test_point(101.f, 101.f); |
@@ -244,8 +244,8 @@ TEST_F(LayerTreeImplTest, HitTestingForUninvertibleTransform) { |
host_impl().SetViewportSize(root->bounds()); |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(1u, root_layer()->GetRenderSurface()->layer_list().size()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ ASSERT_EQ(1, root_layer()->GetRenderSurface()->num_contributors()); |
ASSERT_FALSE(root_layer()->ScreenSpaceTransform().IsInvertible()); |
// Hit testing any point should not hit the layer. If the invertible matrix is |
@@ -299,8 +299,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSinglePositionedLayer) { |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(1u, root_layer()->GetRenderSurface()->layer_list().size()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ ASSERT_EQ(1, root_layer()->GetRenderSurface()->num_contributors()); |
// Hit testing for a point outside the layer should return a null pointer. |
gfx::PointF test_point(49.f, 49.f); |
@@ -344,8 +344,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleRotatedLayer) { |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(1u, root_layer()->GetRenderSurface()->layer_list().size()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ ASSERT_EQ(1, root_layer()->GetRenderSurface()->num_contributors()); |
// Hit testing for points outside the layer. |
// These corners would have been inside the un-transformed layer, but they |
@@ -512,8 +512,8 @@ TEST_F(LayerTreeImplTest, HitTestingForSinglePerspectiveLayer) { |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(1u, root_layer()->GetRenderSurface()->layer_list().size()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ ASSERT_EQ(1, root_layer()->GetRenderSurface()->num_contributors()); |
// Hit testing for points outside the layer. |
// These corners would have been inside the un-transformed layer, but they |
@@ -570,9 +570,10 @@ TEST_F(LayerTreeImplTest, HitTestingForSimpleClippedLayer) { |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(1u, root_layer()->GetRenderSurface()->layer_list().size()); |
- ASSERT_EQ(456, root_layer()->GetRenderSurface()->layer_list().at(0)->id()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ ASSERT_EQ(1, root_layer()->GetRenderSurface()->num_contributors()); |
+ LayerImpl* child_layer = host_impl().active_tree()->LayerById(456); |
+ EXPECT_TRUE(child_layer->is_drawn_render_surface_layer_list_member()); |
// Hit testing for a point outside the layer should return a null pointer. |
// Despite the child layer being very large, it should be clipped to the root |
@@ -747,9 +748,10 @@ TEST_F(LayerTreeImplTest, HitTestingForNonClippingIntermediateLayer) { |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(1u, root_layer()->GetRenderSurface()->layer_list().size()); |
- ASSERT_EQ(456, root_layer()->GetRenderSurface()->layer_list().at(0)->id()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ ASSERT_EQ(1, root_layer()->GetRenderSurface()->num_contributors()); |
+ LayerImpl* child_layer = host_impl().active_tree()->LayerById(456); |
+ EXPECT_TRUE(child_layer->is_drawn_render_surface_layer_list_member()); |
// Hit testing for a point outside the layer should return a null pointer. |
gfx::PointF test_point(69.f, 69.f); |
@@ -827,14 +829,14 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayers) { |
ASSERT_TRUE(child1); |
ASSERT_TRUE(child2); |
ASSERT_TRUE(grand_child1); |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
RenderSurfaceImpl* root_render_surface = root->GetRenderSurface(); |
- ASSERT_EQ(4u, root_render_surface->layer_list().size()); |
- ASSERT_EQ(1, root_render_surface->layer_list().at(0)->id()); // root layer |
- ASSERT_EQ(2, root_render_surface->layer_list().at(1)->id()); // child1 |
- ASSERT_EQ(4, root_render_surface->layer_list().at(2)->id()); // grand_child1 |
- ASSERT_EQ(3, root_render_surface->layer_list().at(3)->id()); // child2 |
+ ASSERT_EQ(4, root_render_surface->num_contributors()); |
+ EXPECT_TRUE(root_layer()->is_drawn_render_surface_layer_list_member()); |
+ EXPECT_TRUE(child1->is_drawn_render_surface_layer_list_member()); |
+ EXPECT_TRUE(child2->is_drawn_render_surface_layer_list_member()); |
+ EXPECT_TRUE(grand_child1->is_drawn_render_surface_layer_list_member()); |
// Nothing overlaps the root at (1, 1), so hit testing there should find |
// the root layer. |
@@ -979,7 +981,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) { |
ASSERT_TRUE(child1); |
ASSERT_TRUE(child2); |
ASSERT_TRUE(grand_child1); |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
// Nothing overlaps the root_layer at (1, 1), so hit testing there should find |
// the root layer. |
@@ -1179,18 +1181,18 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) { |
ASSERT_TRUE(child1->GetRenderSurface()); |
ASSERT_TRUE(child2->GetRenderSurface()); |
ASSERT_TRUE(grand_child1->GetRenderSurface()); |
- ASSERT_EQ(4u, RenderSurfaceLayerList().size()); |
+ ASSERT_EQ(4u, GetRenderSurfaceList().size()); |
// The root surface has the root layer, and child1's and child2's render |
// surfaces. |
- ASSERT_EQ(3u, root->GetRenderSurface()->layer_list().size()); |
+ ASSERT_EQ(3, root->GetRenderSurface()->num_contributors()); |
// The child1 surface has the child1 layer and grand_child1's render surface. |
- ASSERT_EQ(2u, child1->GetRenderSurface()->layer_list().size()); |
- ASSERT_EQ(1u, child2->GetRenderSurface()->layer_list().size()); |
- ASSERT_EQ(1u, grand_child1->GetRenderSurface()->layer_list().size()); |
- ASSERT_EQ(1, RenderSurfaceLayerList().at(0)->id()); // root layer |
- ASSERT_EQ(2, RenderSurfaceLayerList()[1]->id()); // child1 |
- ASSERT_EQ(4, RenderSurfaceLayerList().at(2)->id()); // grand_child1 |
- ASSERT_EQ(3, RenderSurfaceLayerList()[3]->id()); // child2 |
+ ASSERT_EQ(2, child1->GetRenderSurface()->num_contributors()); |
+ ASSERT_EQ(1, child2->GetRenderSurface()->num_contributors()); |
+ ASSERT_EQ(1, grand_child1->GetRenderSurface()->num_contributors()); |
+ EXPECT_TRUE(root_layer()->is_drawn_render_surface_layer_list_member()); |
+ EXPECT_TRUE(child1->is_drawn_render_surface_layer_list_member()); |
+ EXPECT_TRUE(grand_child1->is_drawn_render_surface_layer_list_member()); |
+ EXPECT_TRUE(child2->is_drawn_render_surface_layer_list_member()); |
// Nothing overlaps the root at (1, 1), so hit testing there should find |
// the root layer. |
@@ -1251,8 +1253,8 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSingleLayer) { |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(1u, root->GetRenderSurface()->layer_list().size()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ ASSERT_EQ(1, root->GetRenderSurface()->num_contributors()); |
// Hit checking for any point should return a null pointer for a layer without |
// any touch event handler regions. |
@@ -1328,8 +1330,8 @@ TEST_F(LayerTreeImplTest, |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(1u, root->GetRenderSurface()->layer_list().size()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ ASSERT_EQ(1, root->GetRenderSurface()->num_contributors()); |
ASSERT_FALSE(root->ScreenSpaceTransform().IsInvertible()); |
// Hit checking any point should not hit the touch handler region on the |
@@ -1395,8 +1397,8 @@ TEST_F(LayerTreeImplTest, |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(1u, root->GetRenderSurface()->layer_list().size()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ ASSERT_EQ(1, root->GetRenderSurface()->num_contributors()); |
// Hit checking for a point outside the layer should return a null pointer. |
gfx::PointF test_point(49.f, 49.f); |
@@ -1480,8 +1482,8 @@ TEST_F(LayerTreeImplTest, |
// The visible content rect for test_layer is actually 100x100, even though |
// its layout size is 50x50, positioned at 25x25. |
LayerImpl* test_layer = root->test_properties()->children[0]; |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(1u, root->GetRenderSurface()->layer_list().size()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ ASSERT_EQ(1, root->GetRenderSurface()->num_contributors()); |
// Check whether the child layer fits into the root after scaled. |
EXPECT_EQ(gfx::Rect(test_layer->bounds()), test_layer->visible_layer_rect()); |
@@ -1607,9 +1609,10 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSimpleClippedLayer) { |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(1u, root->GetRenderSurface()->layer_list().size()); |
- ASSERT_EQ(456, root->GetRenderSurface()->layer_list().at(0)->id()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ ASSERT_EQ(1, root->GetRenderSurface()->num_contributors()); |
+ LayerImpl* child_layer = host_impl().active_tree()->LayerById(456); |
+ EXPECT_TRUE(child_layer->is_drawn_render_surface_layer_list_member()); |
// Hit checking for a point outside the layer should return a null pointer. |
// Despite the child layer being very large, it should be clipped to the root |
@@ -1703,7 +1706,7 @@ TEST_F(LayerTreeImplTest, |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(2u, RenderSurfaceLayerList().size()); |
+ ASSERT_EQ(2u, GetRenderSurfaceList().size()); |
// Hit checking for a point outside the layer should return a null pointer. |
// Despite the child layer being very large, it should be clipped to the root |
@@ -1760,10 +1763,12 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerOverlappingRegions) { |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(2u, root->GetRenderSurface()->layer_list().size()); |
- ASSERT_EQ(123, root->GetRenderSurface()->layer_list().at(0)->id()); |
- ASSERT_EQ(1234, root->GetRenderSurface()->layer_list().at(1)->id()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ ASSERT_EQ(2, root->GetRenderSurface()->num_contributors()); |
+ LayerImpl* touch_layer = host_impl().active_tree()->LayerById(123); |
+ LayerImpl* notouch_layer = host_impl().active_tree()->LayerById(1234); |
+ EXPECT_TRUE(touch_layer->is_drawn_render_surface_layer_list_member()); |
+ EXPECT_TRUE(notouch_layer->is_drawn_render_surface_layer_list_member()); |
gfx::PointF test_point(35.f, 35.f); |
LayerImpl* result_layer = |
@@ -1816,10 +1821,10 @@ TEST_F(LayerTreeImplTest, HitTestingTouchHandlerRegionsForLayerThatIsNotDrawn) { |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
LayerImpl* test_layer = root->test_properties()->children[0]; |
- // As test_layer doesn't draw content, the layer list of root's render surface |
- // should contain only the root layer. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(1u, root->GetRenderSurface()->layer_list().size()); |
+ // As test_layer doesn't draw content, it shouldn't contribute content to the |
+ // root surface. |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ EXPECT_FALSE(test_layer->is_drawn_render_surface_layer_list_member()); |
// Hit testing for a point outside the test layer should return null pointer. |
// We also implicitly check that the updated screen space transform of a layer |
@@ -1876,8 +1881,8 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForSingleLayer) { |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
- ASSERT_EQ(1u, root->GetRenderSurface()->layer_list().size()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
+ ASSERT_EQ(1, root->GetRenderSurface()->num_contributors()); |
LayerSelection input; |
@@ -1957,7 +1962,7 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) { |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
LayerSelection input; |
input.start.type = gfx::SelectionBound::LEFT; |
@@ -2095,7 +2100,7 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) { |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
// Sanity check the scenario we just created. |
- ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
+ ASSERT_EQ(1u, GetRenderSurfaceList().size()); |
LayerSelection input; |
input.start.type = gfx::SelectionBound::LEFT; |
@@ -2263,7 +2268,7 @@ TEST_F(LayerTreeImplTest, HitTestingCorrectLayerWheelListener) { |
host_impl().SetViewportSize(root->bounds()); |
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
- CHECK_EQ(1u, RenderSurfaceLayerList().size()); |
+ CHECK_EQ(1u, GetRenderSurfaceList().size()); |
gfx::PointF test_point = gfx::PointF(1.f, 1.f); |
LayerImpl* result_layer = |