| Index: cc/trees/layer_tree_host_common_unittest.cc
|
| diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
|
| index 4ef38d696076ddb37348994ed531613da80fbc2c..161bb982310a47532c4858f709b3ceb74b9845c9 100644
|
| --- a/cc/trees/layer_tree_host_common_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_common_unittest.cc
|
| @@ -210,7 +210,9 @@ class LayerTreeHostCommonTestBase : public LayerTestCommon::LayerImplTest {
|
| property_trees->effect_tree, &update_layer_list_);
|
| }
|
|
|
| - void ExecuteCalculateDrawPropertiesWithPropertyTrees(LayerImpl* root_layer) {
|
| + void ExecuteCalculateDrawPropertiesWithPropertyTrees(
|
| + LayerImpl* root_layer,
|
| + bool skip_verify_visible_rect_calculations = false) {
|
| DCHECK(root_layer->layer_tree_impl());
|
| PropertyTreeBuilder::PreCalculateMetaInformationForTesting(root_layer);
|
|
|
| @@ -233,15 +235,20 @@ class LayerTreeHostCommonTestBase : public LayerTestCommon::LayerImplTest {
|
| root_layer->bounds().height() * device_scale_factor);
|
| update_layer_list_impl_.reset(new LayerImplList);
|
| root_layer->layer_tree_impl()->BuildLayerListForTesting();
|
| - bool verify_visible_rect_calculations = true;
|
| + PropertyTrees* property_trees =
|
| + root_layer->layer_tree_impl()->property_trees();
|
| draw_property_utils::BuildPropertyTreesAndComputeVisibleRects(
|
| root_layer, page_scale_layer, inner_viewport_scroll_layer,
|
| outer_viewport_scroll_layer, overscroll_elasticity_layer,
|
| elastic_overscroll, page_scale_factor, device_scale_factor,
|
| gfx::Rect(device_viewport_size), gfx::Transform(),
|
| - can_render_to_separate_surface, verify_visible_rect_calculations,
|
| - root_layer->layer_tree_impl()->property_trees(),
|
| + can_render_to_separate_surface, property_trees,
|
| update_layer_list_impl_.get());
|
| + draw_property_utils::VerifyClipTreeCalculations(*update_layer_list_impl_,
|
| + property_trees);
|
| + if (!skip_verify_visible_rect_calculations)
|
| + draw_property_utils::VerifyVisibleRectsCalculations(
|
| + *update_layer_list_impl_, property_trees);
|
| }
|
|
|
| void ExecuteCalculateDrawPropertiesWithoutSeparateSurfaces(
|
| @@ -1189,7 +1196,16 @@ TEST_F(LayerTreeHostCommonTest, LayerFullyContainedWithinClipInTargetSpace) {
|
| grand_child->SetBounds(gfx::Size(100, 100));
|
| grand_child->test_properties()->should_flatten_transform = false;
|
| grand_child->SetDrawsContent(true);
|
| - ExecuteCalculateDrawProperties(root);
|
| + float device_scale_factor = 1.f;
|
| + float page_scale_factor = 1.f;
|
| + LayerImpl* page_scale_layer = nullptr;
|
| + // Visible rects computed by combining clips in target space and root space
|
| + // don't match because of rotation transforms. So, we skip
|
| + // verify_visible_rect_calculations.
|
| + bool skip_verify_visible_rect_calculations = true;
|
| + ExecuteCalculateDrawProperties(root, device_scale_factor, page_scale_factor,
|
| + page_scale_layer,
|
| + skip_verify_visible_rect_calculations);
|
|
|
| // Mapping grand_child's bounds to target space produces a non-empty rect
|
| // that is fully contained within the target's bounds, so grand_child should
|
| @@ -7988,12 +8004,25 @@ TEST_F(LayerTreeHostCommonTest,
|
| zero_matrix.Scale3d(0.f, 0.f, 0.f);
|
| root->layer_tree_impl()->property_trees()->transform_tree.OnTransformAnimated(
|
| zero_matrix, animated->transform_tree_index(), root->layer_tree_impl());
|
| - ExecuteCalculateDrawPropertiesWithPropertyTrees(root);
|
| + // While computing visible rects by combining clips in screen space, we set
|
| + // the entire layer as visible if the screen space transform is singular. This
|
| + // is not always true when we combine clips in target space because if the
|
| + // intersection of combined_clip in taret space with layer_rect projected to
|
| + // target space is empty, we set it to an empty rect.
|
| + bool skip_verify_visible_rect_calculations = true;
|
| + ExecuteCalculateDrawPropertiesWithPropertyTrees(
|
| + root, skip_verify_visible_rect_calculations);
|
|
|
| // The animated layer maps to the empty rect in clipped target space, so is
|
| // treated as having an empty visible rect.
|
| EXPECT_EQ(gfx::Rect(), animated->visible_layer_rect());
|
|
|
| + // The animated layer will be treated as fully visible when we combine clips
|
| + // in screen space.
|
| + gfx::Rect visible_rect = draw_property_utils::ComputeLayerVisibleRectDynamic(
|
| + root->layer_tree_impl()->property_trees(), animated);
|
| + EXPECT_EQ(gfx::Rect(120, 120), visible_rect);
|
| +
|
| // This time, flattening does not make |animated|'s transform invertible. This
|
| // means the clip cannot be projected into |surface|'s space, so we treat
|
| // |surface| and layers that draw into it as having empty visible rect.
|
|
|