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

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

Issue 2734983004: cc: Add a helper function for transforming rects between surface spaces (Closed)
Patch Set: Created 3 years, 9 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 4020 matching lines...) Expand 10 before | Expand all | Expand 10 after
4031 clip_child->SetDrawsContent(true); 4031 clip_child->SetDrawsContent(true);
4032 clip_child->test_properties()->clip_parent = clip_parent; 4032 clip_child->test_properties()->clip_parent = clip_parent;
4033 4033
4034 render_surface2->SetBounds(gfx::Size(60, 60)); 4034 render_surface2->SetBounds(gfx::Size(60, 60));
4035 render_surface2->SetDrawsContent(true); 4035 render_surface2->SetDrawsContent(true);
4036 render_surface2->test_properties()->force_render_surface = true; 4036 render_surface2->test_properties()->force_render_surface = true;
4037 4037
4038 clip_parent->SetMasksToBounds(true); 4038 clip_parent->SetMasksToBounds(true);
4039 render_surface1->SetMasksToBounds(true); 4039 render_surface1->SetMasksToBounds(true);
4040 4040
4041 ExecuteCalculateDrawProperties(root); 4041 float device_scale_factor = 1.f;
4042 ExecuteCalculateDrawProperties(root, device_scale_factor);
4042 EXPECT_EQ(gfx::Rect(50, 50), 4043 EXPECT_EQ(gfx::Rect(50, 50),
4043 render_surface2->GetRenderSurface()->clip_rect()); 4044 render_surface2->GetRenderSurface()->clip_rect());
4045 device_scale_factor = 2.f;
4046 ExecuteCalculateDrawProperties(root, device_scale_factor);
4047 EXPECT_EQ(gfx::Rect(100, 100),
4048 render_surface2->GetRenderSurface()->clip_rect());
4044 } 4049 }
4045 4050
4046 TEST_F(LayerTreeHostCommonTest, RenderSurfaceContentRectWhenLayerNotDrawn) { 4051 TEST_F(LayerTreeHostCommonTest, RenderSurfaceContentRectWhenLayerNotDrawn) {
4047 // Test that only drawn layers contribute to render surface content rect. 4052 // Test that only drawn layers contribute to render surface content rect.
4048 LayerImpl* root = root_layer_for_testing(); 4053 LayerImpl* root = root_layer_for_testing();
4049 LayerImpl* surface = AddChildToRoot<LayerImpl>(); 4054 LayerImpl* surface = AddChildToRoot<LayerImpl>();
4050 LayerImpl* test_layer = AddChild<LayerImpl>(surface); 4055 LayerImpl* test_layer = AddChild<LayerImpl>(surface);
4051 4056
4052 root->SetBounds(gfx::Size(200, 200)); 4057 root->SetBounds(gfx::Size(200, 200));
4053 surface->SetBounds(gfx::Size(100, 100)); 4058 surface->SetBounds(gfx::Size(100, 100));
(...skipping 6707 matching lines...) Expand 10 before | Expand all | Expand 10 after
10761 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10766 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10762 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10767 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10763 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10768 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10764 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10769 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10765 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10770 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10766 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10771 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10767 } 10772 }
10768 10773
10769 } // namespace 10774 } // namespace
10770 } // namespace cc 10775 } // 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