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 9021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9032 | 9032 |
9033 gfx::Transform identity; | 9033 gfx::Transform identity; |
9034 | 9034 |
9035 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), | 9035 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), |
9036 gfx::Size(100, 100), true, false, true); | 9036 gfx::Size(100, 100), true, false, true); |
9037 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), | 9037 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), |
9038 gfx::Size(100, 100), true, false, false); | 9038 gfx::Size(100, 100), true, false, false); |
9039 | 9039 |
9040 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false); | 9040 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false); |
9041 | 9041 |
9042 child->SetHaveWheelEventHandlers(true); | 9042 child->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 100, 100)); |
9043 ExecuteCalculateDrawProperties(root); | 9043 ExecuteCalculateDrawProperties(root); |
9044 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), true); | 9044 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), true); |
9045 | 9045 |
9046 child->SetHaveWheelEventHandlers(false); | 9046 child->SetTouchEventHandlerRegion(gfx::Rect()); |
9047 ExecuteCalculateDrawProperties(root); | 9047 ExecuteCalculateDrawProperties(root); |
9048 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false); | 9048 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false); |
9049 } | 9049 } |
9050 | 9050 |
9051 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { | 9051 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { |
9052 gfx::Transform identity; | 9052 gfx::Transform identity; |
9053 gfx::Transform translate_z; | 9053 gfx::Transform translate_z; |
9054 translate_z.Translate3d(0, 0, 10); | 9054 translate_z.Translate3d(0, 0, 10); |
9055 | 9055 |
9056 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 9056 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9532 SetLayerPropertiesForTesting(render_surface, identity_matrix, gfx::Point3F(), | 9532 SetLayerPropertiesForTesting(render_surface, identity_matrix, gfx::Point3F(), |
9533 gfx::PointF(), gfx::Size(30, 30), true, false, | 9533 gfx::PointF(), gfx::Size(30, 30), true, false, |
9534 true); | 9534 true); |
9535 SetLayerPropertiesForTesting(test_layer, identity_matrix, gfx::Point3F(), | 9535 SetLayerPropertiesForTesting(test_layer, identity_matrix, gfx::Point3F(), |
9536 gfx::PointF(), gfx::Size(20, 20), true, false, | 9536 gfx::PointF(), gfx::Size(20, 20), true, false, |
9537 false); | 9537 false); |
9538 | 9538 |
9539 render_surface->SetMasksToBounds(true); | 9539 render_surface->SetMasksToBounds(true); |
9540 test_layer->SetDrawsContent(true); | 9540 test_layer->SetDrawsContent(true); |
9541 test_layer->SetOpacity(0); | 9541 test_layer->SetOpacity(0); |
9542 test_layer->SetHaveWheelEventHandlers(true); | 9542 test_layer->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 20, 20)); |
9543 | 9543 |
9544 ExecuteCalculateDrawProperties(root); | 9544 ExecuteCalculateDrawProperties(root); |
9545 EXPECT_EQ(gfx::Rect(20, 20), test_layer->drawable_content_rect()); | 9545 EXPECT_EQ(gfx::Rect(20, 20), test_layer->drawable_content_rect()); |
9546 EXPECT_EQ(gfx::RectF(20, 20), | 9546 EXPECT_EQ(gfx::RectF(20, 20), |
9547 render_surface->render_surface()->DrawableContentRect()); | 9547 render_surface->render_surface()->DrawableContentRect()); |
9548 } | 9548 } |
9549 | 9549 |
9550 TEST_F(LayerTreeHostCommonTest, ClipChildVisibleRect) { | 9550 TEST_F(LayerTreeHostCommonTest, ClipChildVisibleRect) { |
9551 LayerImpl* root = root_layer(); | 9551 LayerImpl* root = root_layer(); |
9552 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); | 9552 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9788 proto::ScrollAndScaleSet proto; | 9788 proto::ScrollAndScaleSet proto; |
9789 scroll_and_scale_set.ToProtobuf(&proto); | 9789 scroll_and_scale_set.ToProtobuf(&proto); |
9790 ScrollAndScaleSet new_scroll_and_scale_set; | 9790 ScrollAndScaleSet new_scroll_and_scale_set; |
9791 new_scroll_and_scale_set.FromProtobuf(proto); | 9791 new_scroll_and_scale_set.FromProtobuf(proto); |
9792 | 9792 |
9793 EXPECT_TRUE(scroll_and_scale_set.EqualsForTesting(new_scroll_and_scale_set)); | 9793 EXPECT_TRUE(scroll_and_scale_set.EqualsForTesting(new_scroll_and_scale_set)); |
9794 } | 9794 } |
9795 | 9795 |
9796 } // namespace | 9796 } // namespace |
9797 } // namespace cc | 9797 } // namespace cc |
OLD | NEW |