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 0cd33660c52774d528b8917e67943acffc4174b0..42c83bfdd267f8cdc77f8da36734c6a91c1b7be3 100644 |
--- a/cc/trees/layer_tree_host_impl_unittest.cc |
+++ b/cc/trees/layer_tree_host_impl_unittest.cc |
@@ -7252,12 +7252,16 @@ class BlendStateCheckLayer : public LayerImpl { |
gfx::Size(1, 1), false, false); |
test_blending_draw_quad->visible_rect = quad_visible_rect_; |
EXPECT_EQ(blend_, test_blending_draw_quad->ShouldDrawWithBlending()); |
- EXPECT_EQ(has_render_surface_, !!GetRenderSurface(this)); |
+ EXPECT_EQ(has_render_surface_, |
+ GetRenderSurface(this) != GetRenderSurface(comparison_layer_)); |
} |
- void SetExpectation(bool blend, bool has_render_surface) { |
+ void SetExpectation(bool blend, |
+ bool has_render_surface, |
+ LayerImpl* comparison_layer) { |
blend_ = blend; |
has_render_surface_ = has_render_surface; |
+ comparison_layer_ = comparison_layer; |
quads_appended_ = false; |
} |
@@ -7276,6 +7280,7 @@ class BlendStateCheckLayer : public LayerImpl { |
: LayerImpl(tree_impl, id), |
blend_(false), |
has_render_surface_(false), |
+ comparison_layer_(nullptr), |
quads_appended_(false), |
quad_rect_(5, 5, 5, 5), |
quad_visible_rect_(5, 5, 5, 5), |
@@ -7291,6 +7296,7 @@ class BlendStateCheckLayer : public LayerImpl { |
bool blend_; |
bool has_render_surface_; |
+ LayerImpl* comparison_layer_; |
bool quads_appended_; |
gfx::Rect quad_rect_; |
gfx::Rect opaque_content_rect_; |
@@ -7319,7 +7325,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
// Opaque layer, drawn without blending. |
layer1->SetContentsOpaque(true); |
- layer1->SetExpectation(false, false); |
+ layer1->SetExpectation(false, false, root); |
layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
@@ -7329,7 +7335,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
// Layer with translucent content and painting, so drawn with blending. |
layer1->SetContentsOpaque(false); |
- layer1->SetExpectation(true, false); |
+ layer1->SetExpectation(true, false, root); |
layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
host_impl_->active_tree()->set_needs_update_draw_properties(); |
@@ -7342,7 +7348,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
layer1->SetContentsOpaque(true); |
layer1->test_properties()->opacity = 0.5f; |
layer1->NoteLayerPropertyChanged(); |
- layer1->SetExpectation(true, false); |
+ layer1->SetExpectation(true, false, root); |
layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
@@ -7354,7 +7360,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
layer1->SetContentsOpaque(true); |
layer1->test_properties()->opacity = 0.5f; |
layer1->NoteLayerPropertyChanged(); |
- layer1->SetExpectation(true, false); |
+ layer1->SetExpectation(true, false, root); |
layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
@@ -7372,12 +7378,12 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
layer1->SetContentsOpaque(true); |
layer1->test_properties()->opacity = 1.f; |
layer1->NoteLayerPropertyChanged(); |
- layer1->SetExpectation(false, false); |
+ layer1->SetExpectation(false, false, root); |
layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
layer2->SetContentsOpaque(true); |
layer2->test_properties()->opacity = 1.f; |
layer2->NoteLayerPropertyChanged(); |
- layer2->SetExpectation(false, false); |
+ layer2->SetExpectation(false, false, root); |
layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); |
host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
host_impl_->active_tree()->set_needs_update_draw_properties(); |
@@ -7390,9 +7396,9 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
// Parent layer with translucent content, drawn with blending. |
// Child layer with opaque content, drawn without blending. |
layer1->SetContentsOpaque(false); |
- layer1->SetExpectation(true, false); |
+ layer1->SetExpectation(true, false, root); |
layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
- layer2->SetExpectation(false, false); |
+ layer2->SetExpectation(false, false, root); |
layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); |
host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
host_impl_->active_tree()->set_needs_update_draw_properties(); |
@@ -7406,9 +7412,9 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
// blending. |
// Child layer with opaque content, drawn without blending. |
layer1->SetContentsOpaque(true); |
- layer1->SetExpectation(false, false); |
+ layer1->SetExpectation(false, false, root); |
layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
- layer2->SetExpectation(false, false); |
+ layer2->SetExpectation(false, false, root); |
layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); |
host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
@@ -7426,9 +7432,9 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
layer1->test_properties()->opacity = 0.5f; |
layer1->NoteLayerPropertyChanged(); |
layer1->test_properties()->force_render_surface = true; |
- layer1->SetExpectation(false, true); |
+ layer1->SetExpectation(false, true, root); |
layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
- layer2->SetExpectation(false, false); |
+ layer2->SetExpectation(false, false, layer1); |
layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); |
host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
@@ -7443,12 +7449,12 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
layer1->SetContentsOpaque(true); |
layer1->test_properties()->opacity = 1.f; |
layer1->NoteLayerPropertyChanged(); |
- layer1->SetExpectation(false, false); |
+ layer1->SetExpectation(false, false, root); |
layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
layer2->SetContentsOpaque(true); |
layer2->test_properties()->opacity = 0.5f; |
layer2->NoteLayerPropertyChanged(); |
- layer2->SetExpectation(true, false); |
+ layer2->SetExpectation(true, false, layer1); |
layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); |
host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
@@ -7461,12 +7467,12 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
layer1->SetContentsOpaque(true); |
layer1->test_properties()->opacity = 1.f; |
layer1->NoteLayerPropertyChanged(); |
- layer1->SetExpectation(false, false); |
+ layer1->SetExpectation(false, false, root); |
layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
layer2->SetContentsOpaque(false); |
layer2->test_properties()->opacity = 1.f; |
layer2->NoteLayerPropertyChanged(); |
- layer2->SetExpectation(true, false); |
+ layer2->SetExpectation(true, false, root); |
layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); |
host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
@@ -7480,12 +7486,12 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
layer1->SetContentsOpaque(true); |
layer1->test_properties()->opacity = 1.f; |
layer1->NoteLayerPropertyChanged(); |
- layer1->SetExpectation(false, false); |
+ layer1->SetExpectation(false, false, root); |
layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
layer2->SetContentsOpaque(true); |
layer2->test_properties()->opacity = 1.f; |
layer2->NoteLayerPropertyChanged(); |
- layer2->SetExpectation(false, false); |
+ layer2->SetExpectation(false, false, root); |
layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); |
host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
@@ -7499,7 +7505,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5)); |
layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 5)); |
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); |
- layer1->SetExpectation(true, false); |
+ layer1->SetExpectation(true, false, root); |
layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
host_impl_->active_tree()->set_needs_update_draw_properties(); |
@@ -7513,7 +7519,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5)); |
layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 5, 2)); |
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); |
- layer1->SetExpectation(true, false); |
+ layer1->SetExpectation(true, false, root); |
layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
host_impl_->active_tree()->set_needs_update_draw_properties(); |
@@ -7527,7 +7533,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5)); |
layer1->SetQuadVisibleRect(gfx::Rect(7, 5, 3, 5)); |
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); |
- layer1->SetExpectation(true, false); |
+ layer1->SetExpectation(true, false, root); |
layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
host_impl_->active_tree()->set_needs_update_draw_properties(); |
@@ -7542,7 +7548,7 @@ TEST_F(LayerTreeHostImplTest, BlendingOffWhenDrawingOpaqueLayers) { |
layer1->SetQuadRect(gfx::Rect(5, 5, 5, 5)); |
layer1->SetQuadVisibleRect(gfx::Rect(5, 5, 2, 5)); |
layer1->SetOpaqueContentRect(gfx::Rect(5, 5, 2, 5)); |
- layer1->SetExpectation(false, false); |
+ layer1->SetExpectation(false, false, root); |
layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); |
host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
host_impl_->active_tree()->set_needs_update_draw_properties(); |
@@ -7632,7 +7638,8 @@ class LayerTreeHostImplViewportCoveredTest : public LayerTreeHostImplTest { |
->root_layer_for_testing() |
->test_properties() |
->children[0]); |
- child_->SetExpectation(false, false); |
+ child_->SetExpectation(false, false, |
+ host_impl_->active_tree()->root_layer_for_testing()); |
child_->SetContentsOpaque(true); |
} |