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->SetWheelEventProperties(EventListenerProperties::kBlocking); |
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->SetWheelEventProperties(EventListenerProperties::kPassive); |
| 9047 ExecuteCalculateDrawProperties(root); |
| 9048 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), true); |
| 9049 |
| 9050 child->SetWheelEventProperties(EventListenerProperties::kBlocking | |
| 9051 EventListenerProperties::kPassive); |
| 9052 ExecuteCalculateDrawProperties(root); |
| 9053 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), true); |
| 9054 |
| 9055 child->SetWheelEventProperties(EventListenerProperties::kNone); |
9047 ExecuteCalculateDrawProperties(root); | 9056 ExecuteCalculateDrawProperties(root); |
9048 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false); | 9057 EXPECT_EQ(root->layer_or_descendant_has_input_handler(), false); |
9049 } | 9058 } |
9050 | 9059 |
9051 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { | 9060 TEST_F(LayerTreeHostCommonTest, ResetPropertyTreeIndices) { |
9052 gfx::Transform identity; | 9061 gfx::Transform identity; |
9053 gfx::Transform translate_z; | 9062 gfx::Transform translate_z; |
9054 translate_z.Translate3d(0, 0, 10); | 9063 translate_z.Translate3d(0, 0, 10); |
9055 | 9064 |
9056 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 9065 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(), | 9541 SetLayerPropertiesForTesting(render_surface, identity_matrix, gfx::Point3F(), |
9533 gfx::PointF(), gfx::Size(30, 30), true, false, | 9542 gfx::PointF(), gfx::Size(30, 30), true, false, |
9534 true); | 9543 true); |
9535 SetLayerPropertiesForTesting(test_layer, identity_matrix, gfx::Point3F(), | 9544 SetLayerPropertiesForTesting(test_layer, identity_matrix, gfx::Point3F(), |
9536 gfx::PointF(), gfx::Size(20, 20), true, false, | 9545 gfx::PointF(), gfx::Size(20, 20), true, false, |
9537 false); | 9546 false); |
9538 | 9547 |
9539 render_surface->SetMasksToBounds(true); | 9548 render_surface->SetMasksToBounds(true); |
9540 test_layer->SetDrawsContent(true); | 9549 test_layer->SetDrawsContent(true); |
9541 test_layer->SetOpacity(0); | 9550 test_layer->SetOpacity(0); |
9542 test_layer->SetHaveWheelEventHandlers(true); | 9551 test_layer->SetWheelEventProperties(EventListenerProperties::kBlocking); |
9543 | 9552 |
9544 ExecuteCalculateDrawProperties(root); | 9553 ExecuteCalculateDrawProperties(root); |
9545 EXPECT_EQ(gfx::Rect(20, 20), test_layer->drawable_content_rect()); | 9554 EXPECT_EQ(gfx::Rect(20, 20), test_layer->drawable_content_rect()); |
9546 EXPECT_EQ(gfx::RectF(20, 20), | 9555 EXPECT_EQ(gfx::RectF(20, 20), |
9547 render_surface->render_surface()->DrawableContentRect()); | 9556 render_surface->render_surface()->DrawableContentRect()); |
9548 } | 9557 } |
9549 | 9558 |
9550 TEST_F(LayerTreeHostCommonTest, ClipChildVisibleRect) { | 9559 TEST_F(LayerTreeHostCommonTest, ClipChildVisibleRect) { |
9551 LayerImpl* root = root_layer(); | 9560 LayerImpl* root = root_layer(); |
9552 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); | 9561 LayerImpl* clip_parent = AddChildToRoot<LayerImpl>(); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9788 proto::ScrollAndScaleSet proto; | 9797 proto::ScrollAndScaleSet proto; |
9789 scroll_and_scale_set.ToProtobuf(&proto); | 9798 scroll_and_scale_set.ToProtobuf(&proto); |
9790 ScrollAndScaleSet new_scroll_and_scale_set; | 9799 ScrollAndScaleSet new_scroll_and_scale_set; |
9791 new_scroll_and_scale_set.FromProtobuf(proto); | 9800 new_scroll_and_scale_set.FromProtobuf(proto); |
9792 | 9801 |
9793 EXPECT_TRUE(scroll_and_scale_set.EqualsForTesting(new_scroll_and_scale_set)); | 9802 EXPECT_TRUE(scroll_and_scale_set.EqualsForTesting(new_scroll_and_scale_set)); |
9794 } | 9803 } |
9795 | 9804 |
9796 } // namespace | 9805 } // namespace |
9797 } // namespace cc | 9806 } // namespace cc |
OLD | NEW |