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

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

Issue 2336923002: cc: Include viewport clip in visible rect of clip children (Closed)
Patch Set: comments 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') | no next file » | 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 6355 matching lines...) Expand 10 before | Expand all | Expand 10 after
6366 scroll_child_target->test_properties()->force_render_surface = true; 6366 scroll_child_target->test_properties()->force_render_surface = true;
6367 scroll_child->SetBounds(gfx::Size(50, 50)); 6367 scroll_child->SetBounds(gfx::Size(50, 50));
6368 scroll_parent_target->SetPosition(gfx::PointF(10, 10)); 6368 scroll_parent_target->SetPosition(gfx::PointF(10, 10));
6369 scroll_parent_target->SetBounds(gfx::Size(50, 50)); 6369 scroll_parent_target->SetBounds(gfx::Size(50, 50));
6370 scroll_parent_target->SetMasksToBounds(true); 6370 scroll_parent_target->SetMasksToBounds(true);
6371 scroll_parent_target->test_properties()->force_render_surface = true; 6371 scroll_parent_target->test_properties()->force_render_surface = true;
6372 scroll_parent->SetBounds(gfx::Size(50, 50)); 6372 scroll_parent->SetBounds(gfx::Size(50, 50));
6373 6373
6374 float device_scale_factor = 1.5f; 6374 float device_scale_factor = 1.5f;
6375 LayerImplList render_surface_layer_list_impl; 6375 LayerImplList render_surface_layer_list_impl;
6376 gfx::Size device_viewport_size =
6377 gfx::Size(root->bounds().width() * device_scale_factor,
6378 root->bounds().height() * device_scale_factor);
6376 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 6379 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
6377 root, root->bounds(), gfx::Transform(), &render_surface_layer_list_impl); 6380 root, device_viewport_size, gfx::Transform(),
6381 &render_surface_layer_list_impl);
6378 inputs.device_scale_factor = device_scale_factor; 6382 inputs.device_scale_factor = device_scale_factor;
6379 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); 6383 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
6380 6384
6381 EXPECT_EQ(scroll_child->effect_tree_index(), 6385 EXPECT_EQ(scroll_child->effect_tree_index(),
6382 scroll_child_target->effect_tree_index()); 6386 scroll_child_target->effect_tree_index());
6383 EXPECT_EQ(scroll_child->visible_layer_rect(), gfx::Rect(10, 10, 40, 40)); 6387 EXPECT_EQ(scroll_child->visible_layer_rect(), gfx::Rect(10, 10, 40, 40));
6384 EXPECT_EQ(scroll_child->clip_rect(), gfx::Rect(15, 15, 75, 75)); 6388 EXPECT_EQ(scroll_child->clip_rect(), gfx::Rect(15, 15, 75, 75));
6385 gfx::Transform scale; 6389 gfx::Transform scale;
6386 scale.Scale(1.5f, 1.5f); 6390 scale.Scale(1.5f, 1.5f);
6387 EXPECT_TRANSFORMATION_MATRIX_EQ(scroll_child->DrawTransform(), scale); 6391 EXPECT_TRANSFORMATION_MATRIX_EQ(scroll_child->DrawTransform(), scale);
(...skipping 2753 matching lines...) Expand 10 before | Expand all | Expand 10 after
9141 render_surface->test_properties()->force_render_surface = true; 9145 render_surface->test_properties()->force_render_surface = true;
9142 clip_child->SetBounds(gfx::Size(50, 50)); 9146 clip_child->SetBounds(gfx::Size(50, 50));
9143 clip_child->SetDrawsContent(true); 9147 clip_child->SetDrawsContent(true);
9144 9148
9145 clip_child->test_properties()->clip_parent = clip_parent; 9149 clip_child->test_properties()->clip_parent = clip_parent;
9146 clip_parent->test_properties()->clip_children = 9150 clip_parent->test_properties()->clip_children =
9147 base::MakeUnique<std::set<LayerImpl*>>(); 9151 base::MakeUnique<std::set<LayerImpl*>>();
9148 clip_parent->test_properties()->clip_children->insert(clip_child); 9152 clip_parent->test_properties()->clip_children->insert(clip_child);
9149 9153
9150 ExecuteCalculateDrawProperties(root); 9154 ExecuteCalculateDrawProperties(root);
9151 EXPECT_EQ(gfx::Rect(40, 40), clip_child->visible_layer_rect()); 9155 EXPECT_EQ(gfx::Rect(30, 30), clip_child->visible_layer_rect());
9152 } 9156 }
9153 9157
9154 TEST_F(LayerTreeHostCommonTest, 9158 TEST_F(LayerTreeHostCommonTest,
9155 LayerClipRectLargerThanClippingRenderSurfaceRect) { 9159 LayerClipRectLargerThanClippingRenderSurfaceRect) {
9156 LayerImpl* root = root_layer_for_testing(); 9160 LayerImpl* root = root_layer_for_testing();
9157 LayerImpl* render_surface = AddChild<LayerImpl>(root); 9161 LayerImpl* render_surface = AddChild<LayerImpl>(root);
9158 LayerImpl* test_layer = AddChild<LayerImpl>(render_surface); 9162 LayerImpl* test_layer = AddChild<LayerImpl>(render_surface);
9159 9163
9160 root->SetBounds(gfx::Size(30, 30)); 9164 root->SetBounds(gfx::Size(30, 30));
9161 root->SetMasksToBounds(true); 9165 root->SetMasksToBounds(true);
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
9819 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 9823 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
9820 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 9824 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
9821 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 9825 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
9822 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 9826 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
9823 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 9827 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
9824 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 9828 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
9825 } 9829 }
9826 9830
9827 } // namespace 9831 } // namespace
9828 } // namespace cc 9832 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/draw_property_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698