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 9099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9110 LayerImpl* root = root_layer(); | 9110 LayerImpl* root = root_layer(); |
9111 LayerImpl* child = AddChild<LayerImpl>(root); | 9111 LayerImpl* child = AddChild<LayerImpl>(root); |
9112 | 9112 |
9113 gfx::Transform identity; | 9113 gfx::Transform identity; |
9114 | 9114 |
9115 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), | 9115 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), |
9116 gfx::Size(100, 100), true, false, true); | 9116 gfx::Size(100, 100), true, false, true); |
9117 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), | 9117 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), |
9118 gfx::Size(100, 100), true, false, false); | 9118 gfx::Size(100, 100), true, false, false); |
9119 | 9119 |
9120 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false); | 9120 EXPECT_EQ(root->layer_or_descendant_has_touch_handler(), false); |
9121 | 9121 |
9122 child->SetHaveWheelEventHandlers(true); | 9122 child->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 100, 100)); |
9123 ExecuteCalculateDrawProperties(root); | 9123 ExecuteCalculateDrawProperties(root); |
9124 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), true); | 9124 EXPECT_EQ(root->layer_or_descendant_has_touch_handler(), true); |
9125 | 9125 |
9126 child->SetHaveWheelEventHandlers(false); | 9126 child->SetTouchEventHandlerRegion(gfx::Rect()); |
9127 ExecuteCalculateDrawProperties(root); | 9127 ExecuteCalculateDrawProperties(root); |
9128 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false); | 9128 EXPECT_EQ(root->layer_or_descendant_has_touch_handler(), false); |
9129 } | 9129 } |
9130 | 9130 |
9131 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { | 9131 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { |
9132 gfx::Transform identity; | 9132 gfx::Transform identity; |
9133 gfx::Transform translate_z; | 9133 gfx::Transform translate_z; |
9134 translate_z.Translate3d(0, 0, 10); | 9134 translate_z.Translate3d(0, 0, 10); |
9135 | 9135 |
9136 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 9136 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
9137 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9137 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
9138 gfx::PointF(), gfx::Size(800, 800), true, false); | 9138 gfx::PointF(), gfx::Size(800, 800), true, false); |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9614 true); | 9614 true); |
9615 gfx::Transform translation; | 9615 gfx::Transform translation; |
9616 translation.Translate(10, 10); | 9616 translation.Translate(10, 10); |
9617 SetLayerPropertiesForTesting(test_layer, translation, gfx::Point3F(), | 9617 SetLayerPropertiesForTesting(test_layer, translation, gfx::Point3F(), |
9618 gfx::PointF(), gfx::Size(20, 20), true, false, | 9618 gfx::PointF(), gfx::Size(20, 20), true, false, |
9619 false); | 9619 false); |
9620 | 9620 |
9621 render_surface->SetMasksToBounds(true); | 9621 render_surface->SetMasksToBounds(true); |
9622 test_layer->SetDrawsContent(true); | 9622 test_layer->SetDrawsContent(true); |
9623 test_layer->SetOpacity(0); | 9623 test_layer->SetOpacity(0); |
9624 test_layer->SetHaveWheelEventHandlers(true); | 9624 test_layer->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 20, 20)); |
9625 | 9625 |
9626 ExecuteCalculateDrawProperties(root); | 9626 ExecuteCalculateDrawProperties(root); |
9627 EXPECT_EQ(translation, test_layer->ScreenSpaceTransform()); | 9627 EXPECT_EQ(translation, test_layer->ScreenSpaceTransform()); |
9628 } | 9628 } |
9629 | 9629 |
9630 TEST_F(LayerTreeHostCommonTest, ClipChildVisibleRect) { | 9630 TEST_F(LayerTreeHostCommonTest, ClipChildVisibleRect) { |
9631 LayerImpl* root = root_layer(); | 9631 LayerImpl* root = root_layer(); |
9632 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); | 9632 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); |
9633 LayerImpl* render_surface = AddChild<LayerImpl>(clip_parent); | 9633 LayerImpl* render_surface = AddChild<LayerImpl>(clip_parent); |
9634 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface); | 9634 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface); |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10020 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10020 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
10021 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10021 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
10022 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10022 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
10023 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10023 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
10024 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10024 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
10025 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10025 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
10026 } | 10026 } |
10027 | 10027 |
10028 } // namespace | 10028 } // namespace |
10029 } // namespace cc | 10029 } // namespace cc |
OLD | NEW |