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

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

Issue 1643053002: cc :: Fix sublayer scale bug when we have scroll parents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 <set> 10 #include <set>
(...skipping 6546 matching lines...) Expand 10 before | Expand all | Expand 10 after
6557 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), 6557 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50),
6558 true, false, true); 6558 true, false, true);
6559 SetLayerPropertiesForTesting(scroll_child, identity_transform, gfx::Point3F(), 6559 SetLayerPropertiesForTesting(scroll_child, identity_transform, gfx::Point3F(),
6560 gfx::PointF(), gfx::Size(50, 50), true, false, 6560 gfx::PointF(), gfx::Size(50, 50), true, false,
6561 false); 6561 false);
6562 SetLayerPropertiesForTesting(scroll_parent_target, identity_transform, 6562 SetLayerPropertiesForTesting(scroll_parent_target, identity_transform,
6563 gfx::Point3F(), gfx::PointF(10, 10), 6563 gfx::Point3F(), gfx::PointF(10, 10),
6564 gfx::Size(50, 50), true, false, true); 6564 gfx::Size(50, 50), true, false, true);
6565 SetLayerPropertiesForTesting(scroll_parent, identity_transform, 6565 SetLayerPropertiesForTesting(scroll_parent, identity_transform,
6566 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), 6566 gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50),
6567 true, false, true); 6567 true, false, false);
6568 scroll_parent_target->SetMasksToBounds(true);
6568 6569
6569 ExecuteCalculateDrawProperties(root); 6570 float device_scale_factor = 1.5f;
6570 EXPECT_EQ(scroll_child->DrawTransform(), identity_transform); 6571 LayerImplList render_surface_layer_list_impl;
6572 root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting();
6573 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
6574 root, root->bounds(), identity_transform, &render_surface_layer_list_impl,
6575 root->layer_tree_impl()->current_render_surface_list_id());
6576 inputs.device_scale_factor = device_scale_factor;
6577 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
6578
6579 EXPECT_EQ(scroll_child->visible_layer_rect(), gfx::Rect(10, 10, 40, 40));
6580 EXPECT_EQ(scroll_child->clip_rect(), gfx::Rect(15, 15, 75, 75));
6581 gfx::Transform scale;
6582 scale.Scale(1.5f, 1.5f);
6583 EXPECT_EQ(scroll_child->DrawTransform(), scale);
6571 } 6584 }
6572 6585
6573 TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) { 6586 TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) {
6574 LayerImpl* root = root_layer(); 6587 LayerImpl* root = root_layer();
6575 root->SetDrawsContent(true); 6588 root->SetDrawsContent(true);
6576 LayerImpl* parent = AddChildToRoot<LayerImpl>(); 6589 LayerImpl* parent = AddChildToRoot<LayerImpl>();
6577 parent->SetDrawsContent(true); 6590 parent->SetDrawsContent(true);
6578 LayerImpl* child = AddChild<LayerImpl>(parent); 6591 LayerImpl* child = AddChild<LayerImpl>(parent);
6579 child->SetDrawsContent(true); 6592 child->SetDrawsContent(true);
6580 6593
(...skipping 3251 matching lines...) Expand 10 before | Expand all | Expand 10 after
9832 proto::ScrollAndScaleSet proto; 9845 proto::ScrollAndScaleSet proto;
9833 scroll_and_scale_set.ToProtobuf(&proto); 9846 scroll_and_scale_set.ToProtobuf(&proto);
9834 ScrollAndScaleSet new_scroll_and_scale_set; 9847 ScrollAndScaleSet new_scroll_and_scale_set;
9835 new_scroll_and_scale_set.FromProtobuf(proto); 9848 new_scroll_and_scale_set.FromProtobuf(proto);
9836 9849
9837 EXPECT_TRUE(scroll_and_scale_set.EqualsForTesting(new_scroll_and_scale_set)); 9850 EXPECT_TRUE(scroll_and_scale_set.EqualsForTesting(new_scroll_and_scale_set));
9838 } 9851 }
9839 9852
9840 } // namespace 9853 } // namespace
9841 } // namespace cc 9854 } // 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