Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2330)

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 2345793003: Include viewport clip in visible rect of unclipped surfaces (2) (Closed)
Patch Set: delete test Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/draw_property_utils.cc ('k') | cc/trees/property_tree.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 3175 matching lines...) Expand 10 before | Expand all | Expand 10 after
3186 // Layers that do not draw content should have empty visible content rects. 3186 // Layers that do not draw content should have empty visible content rects.
3187 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); 3187 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect());
3188 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), render_surface->visible_layer_rect()); 3188 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), render_surface->visible_layer_rect());
3189 3189
3190 // An unclipped surface grows its DrawableContentRect to include all drawable 3190 // An unclipped surface grows its DrawableContentRect to include all drawable
3191 // regions of the subtree. 3191 // regions of the subtree.
3192 EXPECT_EQ(gfx::RectF(5.f, 5.f, 170.f, 170.f), 3192 EXPECT_EQ(gfx::RectF(5.f, 5.f, 170.f, 170.f),
3193 render_surface->render_surface()->DrawableContentRect()); 3193 render_surface->render_surface()->DrawableContentRect());
3194 3194
3195 // All layers that draw content into the unclipped surface are also unclipped. 3195 // All layers that draw content into the unclipped surface are also unclipped.
3196 // Only the viewport clip should apply
3196 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visible_layer_rect()); 3197 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visible_layer_rect());
3197 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visible_layer_rect()); 3198 EXPECT_EQ(gfx::Rect(0, 0, 25, 25), child2->visible_layer_rect());
3198 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visible_layer_rect()); 3199 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), child3->visible_layer_rect());
3199 3200
3200 EXPECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawable_content_rect()); 3201 EXPECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawable_content_rect());
3201 EXPECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawable_content_rect()); 3202 EXPECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawable_content_rect());
3202 EXPECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect()); 3203 EXPECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect());
3203 } 3204 }
3204 3205
3205 TEST_F(LayerTreeHostCommonTest, 3206 TEST_F(LayerTreeHostCommonTest,
3206 DrawableAndVisibleRectsWhenCannotRenderToSeparateSurface) { 3207 DrawableAndVisibleRectsWhenCannotRenderToSeparateSurface) {
3207 LayerImpl* root = root_layer_for_testing(); 3208 LayerImpl* root = root_layer_for_testing();
3208 LayerImpl* parent = AddChild<LayerImpl>(root); 3209 LayerImpl* parent = AddChild<LayerImpl>(root);
(...skipping 24 matching lines...) Expand all
3233 3234
3234 root->SetDrawsContent(true); 3235 root->SetDrawsContent(true);
3235 parent->SetDrawsContent(true); 3236 parent->SetDrawsContent(true);
3236 child1->SetDrawsContent(true); 3237 child1->SetDrawsContent(true);
3237 child2->SetDrawsContent(true); 3238 child2->SetDrawsContent(true);
3238 grand_child1->SetDrawsContent(true); 3239 grand_child1->SetDrawsContent(true);
3239 grand_child2->SetDrawsContent(true); 3240 grand_child2->SetDrawsContent(true);
3240 leaf_node1->SetDrawsContent(true); 3241 leaf_node1->SetDrawsContent(true);
3241 leaf_node2->SetDrawsContent(true); 3242 leaf_node2->SetDrawsContent(true);
3242 3243
3243 // Case 1: No layers clip. Visible rects are clipped by the viewport, but the 3244 // Case 1: No layers clip. Visible rects are clipped by the viewport.
3244 // viewport clip doesn't apply to layers that draw into unclipped surfaces.
3245 // Each layer's drawable content rect is its bounds in target space; the only 3245 // Each layer's drawable content rect is its bounds in target space; the only
3246 // thing that changes with surfaces disabled is that target space is always 3246 // thing that changes with surfaces disabled is that target space is always
3247 // screen space. 3247 // screen space.
3248 root->SetHasRenderSurface(true); 3248 root->SetHasRenderSurface(true);
3249 child1->SetHasRenderSurface(true); 3249 child1->SetHasRenderSurface(true);
3250 child2->SetHasRenderSurface(true); 3250 child2->SetHasRenderSurface(true);
3251 ExecuteCalculateDrawProperties(root); 3251 ExecuteCalculateDrawProperties(root);
3252 EXPECT_EQ(gfx::Rect(100, 100), root->visible_layer_rect()); 3252 EXPECT_EQ(gfx::Rect(100, 100), root->visible_layer_rect());
3253 EXPECT_EQ(gfx::Rect(0, 0, 98, 98), parent->visible_layer_rect()); 3253 EXPECT_EQ(gfx::Rect(0, 0, 98, 98), parent->visible_layer_rect());
3254 EXPECT_EQ(gfx::Rect(800, 800), child1->visible_layer_rect()); 3254 EXPECT_EQ(gfx::Rect(94, 94), child1->visible_layer_rect());
3255 EXPECT_EQ(gfx::Rect(800, 800), child2->visible_layer_rect()); 3255 EXPECT_EQ(gfx::Rect(95, 95), child2->visible_layer_rect());
3256 EXPECT_EQ(gfx::Rect(1500, 1500), grand_child1->visible_layer_rect()); 3256 EXPECT_EQ(gfx::Rect(86, 86), grand_child1->visible_layer_rect());
3257 EXPECT_EQ(gfx::Rect(1500, 1500), grand_child2->visible_layer_rect()); 3257 EXPECT_EQ(gfx::Rect(88, 88), grand_child2->visible_layer_rect());
3258 EXPECT_EQ(gfx::Rect(2000, 2000), leaf_node1->visible_layer_rect()); 3258 EXPECT_EQ(gfx::Rect(70, 70), leaf_node1->visible_layer_rect());
3259 EXPECT_EQ(gfx::Rect(2000, 2000), leaf_node2->visible_layer_rect()); 3259 EXPECT_EQ(gfx::Rect(79, 79), leaf_node2->visible_layer_rect());
3260 3260
3261 EXPECT_EQ(gfx::Rect(100, 100), root->drawable_content_rect()); 3261 EXPECT_EQ(gfx::Rect(100, 100), root->drawable_content_rect());
3262 EXPECT_EQ(gfx::Rect(2, 2, 400, 400), parent->drawable_content_rect()); 3262 EXPECT_EQ(gfx::Rect(2, 2, 400, 400), parent->drawable_content_rect());
3263 EXPECT_EQ(gfx::Rect(800, 800), child1->drawable_content_rect()); 3263 EXPECT_EQ(gfx::Rect(800, 800), child1->drawable_content_rect());
3264 EXPECT_EQ(gfx::Rect(800, 800), child2->drawable_content_rect()); 3264 EXPECT_EQ(gfx::Rect(800, 800), child2->drawable_content_rect());
3265 EXPECT_EQ(gfx::Rect(8, 8, 1500, 1500), grand_child1->drawable_content_rect()); 3265 EXPECT_EQ(gfx::Rect(8, 8, 1500, 1500), grand_child1->drawable_content_rect());
3266 EXPECT_EQ(gfx::Rect(7, 7, 1500, 1500), grand_child2->drawable_content_rect()); 3266 EXPECT_EQ(gfx::Rect(7, 7, 1500, 1500), grand_child2->drawable_content_rect());
3267 EXPECT_EQ(gfx::Rect(24, 24, 2000, 2000), leaf_node1->drawable_content_rect()); 3267 EXPECT_EQ(gfx::Rect(24, 24, 2000, 2000), leaf_node1->drawable_content_rect());
3268 EXPECT_EQ(gfx::Rect(16, 16, 2000, 2000), leaf_node2->drawable_content_rect()); 3268 EXPECT_EQ(gfx::Rect(16, 16, 2000, 2000), leaf_node2->drawable_content_rect());
3269 3269
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
3339 // Case 3: child1 and grand_child2 clip. In this case, descendants of these 3339 // Case 3: child1 and grand_child2 clip. In this case, descendants of these
3340 // layers have their visible rects clipped by them; Similarly, descendants of 3340 // layers have their visible rects clipped by them; Similarly, descendants of
3341 // these layers have their drawable content rects clipped by them. 3341 // these layers have their drawable content rects clipped by them.
3342 child1->SetMasksToBounds(true); 3342 child1->SetMasksToBounds(true);
3343 grand_child2->SetMasksToBounds(true); 3343 grand_child2->SetMasksToBounds(true);
3344 host_impl()->active_tree()->property_trees()->needs_rebuild = true; 3344 host_impl()->active_tree()->property_trees()->needs_rebuild = true;
3345 ExecuteCalculateDrawProperties(root); 3345 ExecuteCalculateDrawProperties(root);
3346 EXPECT_EQ(gfx::Rect(100, 100), root->visible_layer_rect()); 3346 EXPECT_EQ(gfx::Rect(100, 100), root->visible_layer_rect());
3347 EXPECT_EQ(gfx::Rect(98, 98), parent->visible_layer_rect()); 3347 EXPECT_EQ(gfx::Rect(98, 98), parent->visible_layer_rect());
3348 EXPECT_EQ(gfx::Rect(94, 94), child1->visible_layer_rect()); 3348 EXPECT_EQ(gfx::Rect(94, 94), child1->visible_layer_rect());
3349 EXPECT_EQ(gfx::Rect(800, 800), child2->visible_layer_rect()); 3349 EXPECT_EQ(gfx::Rect(95, 95), child2->visible_layer_rect());
3350 EXPECT_EQ(gfx::Rect(86, 86), grand_child1->visible_layer_rect()); 3350 EXPECT_EQ(gfx::Rect(86, 86), grand_child1->visible_layer_rect());
3351 EXPECT_EQ(gfx::Rect(88, 88), grand_child2->visible_layer_rect()); 3351 EXPECT_EQ(gfx::Rect(88, 88), grand_child2->visible_layer_rect());
3352 EXPECT_EQ(gfx::Rect(70, 70), leaf_node1->visible_layer_rect()); 3352 EXPECT_EQ(gfx::Rect(70, 70), leaf_node1->visible_layer_rect());
3353 EXPECT_EQ(gfx::Rect(79, 79), leaf_node2->visible_layer_rect()); 3353 EXPECT_EQ(gfx::Rect(79, 79), leaf_node2->visible_layer_rect());
3354 3354
3355 EXPECT_EQ(gfx::Rect(100, 100), root->drawable_content_rect()); 3355 EXPECT_EQ(gfx::Rect(100, 100), root->drawable_content_rect());
3356 EXPECT_EQ(gfx::Rect(2, 2, 400, 400), parent->drawable_content_rect()); 3356 EXPECT_EQ(gfx::Rect(2, 2, 400, 400), parent->drawable_content_rect());
3357 EXPECT_EQ(gfx::Rect(800, 800), child1->drawable_content_rect()); 3357 EXPECT_EQ(gfx::Rect(800, 800), child1->drawable_content_rect());
3358 EXPECT_EQ(gfx::Rect(800, 800), child2->drawable_content_rect()); 3358 EXPECT_EQ(gfx::Rect(800, 800), child2->drawable_content_rect());
3359 EXPECT_EQ(gfx::Rect(8, 8, 792, 792), grand_child1->drawable_content_rect()); 3359 EXPECT_EQ(gfx::Rect(8, 8, 792, 792), grand_child1->drawable_content_rect());
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
3752 // regions of the subtree, but also gets clamped by the ancestor's clip. 3752 // regions of the subtree, but also gets clamped by the ancestor's clip.
3753 EXPECT_EQ(gfx::RectF(5.f, 5.f, 95.f, 95.f), 3753 EXPECT_EQ(gfx::RectF(5.f, 5.f, 95.f, 95.f),
3754 render_surface1->render_surface()->DrawableContentRect()); 3754 render_surface1->render_surface()->DrawableContentRect());
3755 3755
3756 // render_surface1 lives in the "unclipped universe" of render_surface1, and 3756 // render_surface1 lives in the "unclipped universe" of render_surface1, and
3757 // is only implicitly clipped by render_surface1's content rect. So, 3757 // is only implicitly clipped by render_surface1's content rect. So,
3758 // render_surface2 grows to enclose all drawable content of its subtree. 3758 // render_surface2 grows to enclose all drawable content of its subtree.
3759 EXPECT_EQ(gfx::RectF(5.f, 5.f, 170.f, 170.f), 3759 EXPECT_EQ(gfx::RectF(5.f, 5.f, 170.f, 170.f),
3760 render_surface2->render_surface()->DrawableContentRect()); 3760 render_surface2->render_surface()->DrawableContentRect());
3761 3761
3762 // All layers that draw content into render_surface2 think they are unclipped. 3762 // All layers that draw content into render_surface2 think they are unclipped
3763 // by the surface. So, only the viewport clip applies.
3763 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visible_layer_rect()); 3764 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visible_layer_rect());
3764 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visible_layer_rect()); 3765 EXPECT_EQ(gfx::Rect(0, 0, 25, 25), child2->visible_layer_rect());
3765 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visible_layer_rect()); 3766 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), child3->visible_layer_rect());
3766 3767
3767 // DrawableContentRects are also unclipped. 3768 // DrawableContentRects are also unclipped.
3768 EXPECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawable_content_rect()); 3769 EXPECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawable_content_rect());
3769 EXPECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawable_content_rect()); 3770 EXPECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawable_content_rect());
3770 EXPECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect()); 3771 EXPECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawable_content_rect());
3771 } 3772 }
3772 3773
3773 TEST_F(LayerTreeHostCommonTest, 3774 TEST_F(LayerTreeHostCommonTest,
3774 VisibleRectsForClippedDescendantsOfUnclippedSurfaces) { 3775 VisibleRectsForClippedDescendantsOfUnclippedSurfaces) {
3775 LayerImpl* root = root_layer_for_testing(); 3776 LayerImpl* root = root_layer_for_testing();
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
3957 clip_child->test_properties()->clip_parent = clip_parent; 3958 clip_child->test_properties()->clip_parent = clip_parent;
3958 3959
3959 clipped_surface->SetBounds(gfx::Size(50, 50)); 3960 clipped_surface->SetBounds(gfx::Size(50, 50));
3960 clipped_surface->SetDrawsContent(true); 3961 clipped_surface->SetDrawsContent(true);
3961 clipped_surface->test_properties()->force_render_surface = true; 3962 clipped_surface->test_properties()->force_render_surface = true;
3962 3963
3963 clip_parent->SetMasksToBounds(true); 3964 clip_parent->SetMasksToBounds(true);
3964 unclipped_desc_surface->SetMasksToBounds(true); 3965 unclipped_desc_surface->SetMasksToBounds(true);
3965 3966
3966 ExecuteCalculateDrawProperties(root); 3967 ExecuteCalculateDrawProperties(root);
3967 EXPECT_EQ(gfx::Rect(50, 50), unclipped_surface->visible_layer_rect()); 3968 EXPECT_EQ(gfx::Rect(10, 10), unclipped_surface->visible_layer_rect());
3968 EXPECT_EQ(gfx::Rect(10, 10), unclipped_desc_surface->visible_layer_rect()); 3969 EXPECT_EQ(gfx::Rect(10, 10), unclipped_desc_surface->visible_layer_rect());
3969 EXPECT_EQ(gfx::Rect(10, 10), clipped_surface->visible_layer_rect()); 3970 EXPECT_EQ(gfx::Rect(10, 10), clipped_surface->visible_layer_rect());
3970 } 3971 }
3971 3972
3972 TEST_F(LayerTreeHostCommonTest, 3973 TEST_F(LayerTreeHostCommonTest,
3973 DrawableAndVisibleContentRectsWithTransformOnUnclippedSurface) { 3974 DrawableAndVisibleContentRectsWithTransformOnUnclippedSurface) {
3974 // Layers that have non-axis aligned bounds (due to transforms) have an 3975 // Layers that have non-axis aligned bounds (due to transforms) have an
3975 // expanded, axis-aligned DrawableContentRect and visible content rect. 3976 // expanded, axis-aligned DrawableContentRect and visible content rect.
3976 LayerImpl* root = root_layer_for_testing(); 3977 LayerImpl* root = root_layer_for_testing();
3977 LayerImpl* render_surface = AddChildToRoot<LayerImpl>(); 3978 LayerImpl* render_surface = AddChildToRoot<LayerImpl>();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
4115 EXPECT_EQ(gfx::Rect(250, 250, 100, 100), child3->drawable_content_rect()); 4116 EXPECT_EQ(gfx::Rect(250, 250, 100, 100), child3->drawable_content_rect());
4116 4117
4117 // The root layer does not actually draw content of its own. 4118 // The root layer does not actually draw content of its own.
4118 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect()); 4119 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root->visible_layer_rect());
4119 4120
4120 // All layer visible content rects are not expressed in content space of each 4121 // All layer visible content rects are not expressed in content space of each
4121 // layer, so they are not scaled by the device_scale_factor. 4122 // layer, so they are not scaled by the device_scale_factor.
4122 EXPECT_EQ(gfx::Rect(0, 0, 3, 4), render_surface1->visible_layer_rect()); 4123 EXPECT_EQ(gfx::Rect(0, 0, 3, 4), render_surface1->visible_layer_rect());
4123 EXPECT_EQ(gfx::Rect(0, 0, 7, 13), render_surface2->visible_layer_rect()); 4124 EXPECT_EQ(gfx::Rect(0, 0, 7, 13), render_surface2->visible_layer_rect());
4124 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visible_layer_rect()); 4125 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visible_layer_rect());
4125 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visible_layer_rect()); 4126 EXPECT_EQ(gfx::Rect(0, 0, 15, 15), child2->visible_layer_rect());
4126 EXPECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visible_layer_rect()); 4127 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), child3->visible_layer_rect());
4127 } 4128 }
4128 4129
4129 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithoutPreserves3d) { 4130 TEST_F(LayerTreeHostCommonTest, BackFaceCullingWithoutPreserves3d) {
4130 // Verify the behavior of back-face culling when there are no preserve-3d 4131 // Verify the behavior of back-face culling when there are no preserve-3d
4131 // layers. Note that 3d transforms still apply in this case, but they are 4132 // layers. Note that 3d transforms still apply in this case, but they are
4132 // "flattened" to each parent layer according to current W3C spec. 4133 // "flattened" to each parent layer according to current W3C spec.
4133 4134
4134 LayerImpl* root = root_layer_for_testing(); 4135 LayerImpl* root = root_layer_for_testing();
4135 LayerImpl* front_facing_child = AddChildToRoot<LayerImpl>(); 4136 LayerImpl* front_facing_child = AddChildToRoot<LayerImpl>();
4136 LayerImpl* back_facing_child = AddChildToRoot<LayerImpl>(); 4137 LayerImpl* back_facing_child = AddChildToRoot<LayerImpl>();
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after
5584 DCHECK(!copy_layer->test_properties()->copy_requests.empty()); 5585 DCHECK(!copy_layer->test_properties()->copy_requests.empty());
5585 ExecuteCalculateDrawProperties(root, device_scale_factor); 5586 ExecuteCalculateDrawProperties(root, device_scale_factor);
5586 DCHECK(copy_layer->test_properties()->copy_requests.empty()); 5587 DCHECK(copy_layer->test_properties()->copy_requests.empty());
5587 5588
5588 EXPECT_EQ(gfx::Rect(50, 50), copy_layer->visible_layer_rect()); 5589 EXPECT_EQ(gfx::Rect(50, 50), copy_layer->visible_layer_rect());
5589 EXPECT_EQ(gfx::Rect(10, 10), copy_child->visible_layer_rect()); 5590 EXPECT_EQ(gfx::Rect(10, 10), copy_child->visible_layer_rect());
5590 EXPECT_EQ(gfx::Rect(10, 10), copy_clipped_child->visible_layer_rect()); 5591 EXPECT_EQ(gfx::Rect(10, 10), copy_clipped_child->visible_layer_rect());
5591 EXPECT_EQ(gfx::Rect(5, 5), copy_surface->visible_layer_rect()); 5592 EXPECT_EQ(gfx::Rect(5, 5), copy_surface->visible_layer_rect());
5592 } 5593 }
5593 5594
5594 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInsideSurface) {
5595 LayerImpl* root = root_layer_for_testing();
5596 LayerImpl* surface = AddChild<LayerImpl>(root);
5597 LayerImpl* surface_child = AddChild<LayerImpl>(surface);
5598
5599 root->SetBounds(gfx::Size(50, 50));
5600 root->SetDrawsContent(true);
5601 surface->SetPosition(gfx::PointF(-10, 20));
5602 surface->test_properties()->force_render_surface = true;
5603 surface_child->SetBounds(gfx::Size(50, 50));
5604 surface_child->SetDrawsContent(true);
5605 ExecuteCalculateDrawProperties(root);
5606
5607 // The visible_layer_rect for the |surface_child| should not be clipped by
5608 // the viewport.
5609 EXPECT_EQ(gfx::Rect(50, 50), surface_child->visible_layer_rect());
5610 }
5611
5612 TEST_F(LayerTreeHostCommonTest, TransformedClipParent) { 5595 TEST_F(LayerTreeHostCommonTest, TransformedClipParent) {
5613 // Ensure that a transform between the layer and its render surface is not a 5596 // Ensure that a transform between the layer and its render surface is not a
5614 // problem. Constructs the following layer tree. 5597 // problem. Constructs the following layer tree.
5615 // 5598 //
5616 // root (a render surface) 5599 // root (a render surface)
5617 // + render_surface 5600 // + render_surface
5618 // + clip_parent (scaled) 5601 // + clip_parent (scaled)
5619 // + intervening_clipping_layer 5602 // + intervening_clipping_layer
5620 // + clip_child 5603 // + clip_child
5621 // 5604 //
(...skipping 3299 matching lines...) Expand 10 before | Expand all | Expand 10 after
8921 clip_child->SetDrawsContent(true); 8904 clip_child->SetDrawsContent(true);
8922 child->SetBounds(gfx::Size(40, 40)); 8905 child->SetBounds(gfx::Size(40, 40));
8923 child->SetDrawsContent(true); 8906 child->SetDrawsContent(true);
8924 8907
8925 clip_child->test_properties()->clip_parent = clip_parent; 8908 clip_child->test_properties()->clip_parent = clip_parent;
8926 clip_parent->test_properties()->clip_children = 8909 clip_parent->test_properties()->clip_children =
8927 base::MakeUnique<std::set<LayerImpl*>>(); 8910 base::MakeUnique<std::set<LayerImpl*>>();
8928 clip_parent->test_properties()->clip_children->insert(clip_child); 8911 clip_parent->test_properties()->clip_children->insert(clip_child);
8929 8912
8930 ExecuteCalculateDrawProperties(root); 8913 ExecuteCalculateDrawProperties(root);
8931 EXPECT_EQ(gfx::Rect(40, 40), child->visible_layer_rect()); 8914 EXPECT_EQ(gfx::Rect(30, 10), child->visible_layer_rect());
8932 } 8915 }
8933 8916
8934 TEST_F(LayerTreeHostCommonTest, 8917 TEST_F(LayerTreeHostCommonTest,
8935 RenderSurfaceClipsSubtreeAndHasUnclippedDescendants) { 8918 RenderSurfaceClipsSubtreeAndHasUnclippedDescendants) {
8936 LayerImpl* root = root_layer_for_testing(); 8919 LayerImpl* root = root_layer_for_testing();
8937 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); 8920 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>();
8938 LayerImpl* render_surface = AddChild<LayerImpl>(clip_parent); 8921 LayerImpl* render_surface = AddChild<LayerImpl>(clip_parent);
8939 LayerImpl* test_layer1 = AddChild<LayerImpl>(render_surface); 8922 LayerImpl* test_layer1 = AddChild<LayerImpl>(render_surface);
8940 LayerImpl* clip_child = AddChild<LayerImpl>(test_layer1); 8923 LayerImpl* clip_child = AddChild<LayerImpl>(test_layer1);
8941 LayerImpl* test_layer2 = AddChild<LayerImpl>(clip_child); 8924 LayerImpl* test_layer2 = AddChild<LayerImpl>(clip_child);
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
9838 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 9821 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
9839 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 9822 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
9840 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 9823 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
9841 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 9824 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
9842 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 9825 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
9843 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 9826 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
9844 } 9827 }
9845 9828
9846 } // namespace 9829 } // namespace
9847 } // namespace cc 9830 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/draw_property_utils.cc ('k') | cc/trees/property_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698