| 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 9086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9097 LayerImpl* root = root_layer(); | 9097 LayerImpl* root = root_layer(); |
| 9098 LayerImpl* child = AddChild<LayerImpl>(root); | 9098 LayerImpl* child = AddChild<LayerImpl>(root); |
| 9099 | 9099 |
| 9100 gfx::Transform identity; | 9100 gfx::Transform identity; |
| 9101 | 9101 |
| 9102 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), | 9102 SetLayerPropertiesForTesting(root, identity, gfx::Point3F(), gfx::PointF(), |
| 9103 gfx::Size(100, 100), true, false, true); | 9103 gfx::Size(100, 100), true, false, true); |
| 9104 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), | 9104 SetLayerPropertiesForTesting(child, identity, gfx::Point3F(), gfx::PointF(), |
| 9105 gfx::Size(100, 100), true, false, false); | 9105 gfx::Size(100, 100), true, false, false); |
| 9106 | 9106 |
| 9107 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false); | 9107 EXPECT_EQ(root->layer_or_descendant_has_touch_handler(), false); |
| 9108 | 9108 |
| 9109 child->SetHaveWheelEventHandlers(true); | 9109 child->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 100, 100)); |
| 9110 ExecuteCalculateDrawProperties(root); | 9110 ExecuteCalculateDrawProperties(root); |
| 9111 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), true); | 9111 EXPECT_EQ(root->layer_or_descendant_has_touch_handler(), true); |
| 9112 | 9112 |
| 9113 child->SetHaveWheelEventHandlers(false); | 9113 child->SetTouchEventHandlerRegion(gfx::Rect()); |
| 9114 ExecuteCalculateDrawProperties(root); | 9114 ExecuteCalculateDrawProperties(root); |
| 9115 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false); | 9115 EXPECT_EQ(root->layer_or_descendant_has_touch_handler(), false); |
| 9116 } | 9116 } |
| 9117 | 9117 |
| 9118 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { | 9118 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { |
| 9119 gfx::Transform identity; | 9119 gfx::Transform identity; |
| 9120 gfx::Transform translate_z; | 9120 gfx::Transform translate_z; |
| 9121 translate_z.Translate3d(0, 0, 10); | 9121 translate_z.Translate3d(0, 0, 10); |
| 9122 | 9122 |
| 9123 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 9123 scoped_refptr<Layer> root = Layer::Create(layer_settings()); |
| 9124 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), | 9124 SetLayerPropertiesForTesting(root.get(), identity, gfx::Point3F(), |
| 9125 gfx::PointF(), gfx::Size(800, 800), true, false); | 9125 gfx::PointF(), gfx::Size(800, 800), true, false); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9601 true); | 9601 true); |
| 9602 gfx::Transform translation; | 9602 gfx::Transform translation; |
| 9603 translation.Translate(10, 10); | 9603 translation.Translate(10, 10); |
| 9604 SetLayerPropertiesForTesting(test_layer, translation, gfx::Point3F(), | 9604 SetLayerPropertiesForTesting(test_layer, translation, gfx::Point3F(), |
| 9605 gfx::PointF(), gfx::Size(20, 20), true, false, | 9605 gfx::PointF(), gfx::Size(20, 20), true, false, |
| 9606 false); | 9606 false); |
| 9607 | 9607 |
| 9608 render_surface->SetMasksToBounds(true); | 9608 render_surface->SetMasksToBounds(true); |
| 9609 test_layer->SetDrawsContent(true); | 9609 test_layer->SetDrawsContent(true); |
| 9610 test_layer->SetOpacity(0); | 9610 test_layer->SetOpacity(0); |
| 9611 test_layer->SetHaveWheelEventHandlers(true); | 9611 test_layer->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 20, 20)); |
| 9612 | 9612 |
| 9613 ExecuteCalculateDrawProperties(root); | 9613 ExecuteCalculateDrawProperties(root); |
| 9614 EXPECT_EQ(translation, test_layer->ScreenSpaceTransform()); | 9614 EXPECT_EQ(translation, test_layer->ScreenSpaceTransform()); |
| 9615 } | 9615 } |
| 9616 | 9616 |
| 9617 TEST_F(LayerTreeHostCommonTest, ClipChildVisibleRect) { | 9617 TEST_F(LayerTreeHostCommonTest, ClipChildVisibleRect) { |
| 9618 LayerImpl* root = root_layer(); | 9618 LayerImpl* root = root_layer(); |
| 9619 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); | 9619 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); |
| 9620 LayerImpl* render_surface = AddChild<LayerImpl>(clip_parent); | 9620 LayerImpl* render_surface = AddChild<LayerImpl>(clip_parent); |
| 9621 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface); | 9621 LayerImpl* clip_child = AddChild<LayerImpl>(render_surface); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10007 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10007 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 10008 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10008 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 10009 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10009 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 10010 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10010 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 10011 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10011 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 10012 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10012 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 10013 } | 10013 } |
| 10014 | 10014 |
| 10015 } // namespace | 10015 } // namespace |
| 10016 } // namespace cc | 10016 } // namespace cc |
| OLD | NEW |