Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 inputs.property_trees->needs_rebuild = true; | |
|
ajuma
2016/01/29 00:40:29
Is this line needed? (It doesn't look like we've b
jaydasika
2016/01/29 00:58:25
That's not required. Sorry for the oversight, I co
| |
| 6578 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | |
| 6579 | |
| 6580 EXPECT_EQ(scroll_child->visible_layer_rect(), gfx::Rect(10, 10, 40, 40)); | |
| 6581 EXPECT_EQ(scroll_child->clip_rect(), gfx::Rect(15, 15, 75, 75)); | |
| 6582 gfx::Transform scale; | |
| 6583 scale.Scale(1.5f, 1.5f); | |
| 6584 EXPECT_EQ(scroll_child->DrawTransform(), scale); | |
| 6571 } | 6585 } |
| 6572 | 6586 |
| 6573 TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) { | 6587 TEST_F(LayerTreeHostCommonTest, SingularTransformSubtreesDoNotDraw) { |
| 6574 LayerImpl* root = root_layer(); | 6588 LayerImpl* root = root_layer(); |
| 6575 root->SetDrawsContent(true); | 6589 root->SetDrawsContent(true); |
| 6576 LayerImpl* parent = AddChildToRoot<LayerImpl>(); | 6590 LayerImpl* parent = AddChildToRoot<LayerImpl>(); |
| 6577 parent->SetDrawsContent(true); | 6591 parent->SetDrawsContent(true); |
| 6578 LayerImpl* child = AddChild<LayerImpl>(parent); | 6592 LayerImpl* child = AddChild<LayerImpl>(parent); |
| 6579 child->SetDrawsContent(true); | 6593 child->SetDrawsContent(true); |
| 6580 | 6594 |
| (...skipping 3251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9832 proto::ScrollAndScaleSet proto; | 9846 proto::ScrollAndScaleSet proto; |
| 9833 scroll_and_scale_set.ToProtobuf(&proto); | 9847 scroll_and_scale_set.ToProtobuf(&proto); |
| 9834 ScrollAndScaleSet new_scroll_and_scale_set; | 9848 ScrollAndScaleSet new_scroll_and_scale_set; |
| 9835 new_scroll_and_scale_set.FromProtobuf(proto); | 9849 new_scroll_and_scale_set.FromProtobuf(proto); |
| 9836 | 9850 |
| 9837 EXPECT_TRUE(scroll_and_scale_set.EqualsForTesting(new_scroll_and_scale_set)); | 9851 EXPECT_TRUE(scroll_and_scale_set.EqualsForTesting(new_scroll_and_scale_set)); |
| 9838 } | 9852 } |
| 9839 | 9853 |
| 9840 } // namespace | 9854 } // namespace |
| 9841 } // namespace cc | 9855 } // namespace cc |
| OLD | NEW |