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 <memory> | 10 #include <memory> |
(...skipping 10647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10658 property_trees.is_main_thread = true; | 10658 property_trees.is_main_thread = true; |
10659 property_trees.is_active = false; | 10659 property_trees.is_active = false; |
10660 ScrollTree& expected_scroll_tree = property_trees.scroll_tree; | 10660 ScrollTree& expected_scroll_tree = property_trees.scroll_tree; |
10661 ScrollNode* property_tree_root = expected_scroll_tree.Node(0); | 10661 ScrollNode* property_tree_root = expected_scroll_tree.Node(0); |
10662 property_tree_root->id = kRootPropertyTreeNodeId; | 10662 property_tree_root->id = kRootPropertyTreeNodeId; |
10663 property_tree_root->parent_id = ScrollTree::kInvalidNodeId; | 10663 property_tree_root->parent_id = ScrollTree::kInvalidNodeId; |
10664 property_tree_root->owning_layer_id = Layer::INVALID_ID; | 10664 property_tree_root->owning_layer_id = Layer::INVALID_ID; |
10665 property_tree_root->scrollable = false; | 10665 property_tree_root->scrollable = false; |
10666 property_tree_root->main_thread_scrolling_reasons = | 10666 property_tree_root->main_thread_scrolling_reasons = |
10667 MainThreadScrollingReason::kNotScrollingOnMain; | 10667 MainThreadScrollingReason::kNotScrollingOnMain; |
10668 property_tree_root->contains_non_fast_scrollable_region = false; | 10668 property_tree_root->non_fast_scrollable_region = Region(); |
10669 property_tree_root->transform_id = kRootPropertyTreeNodeId; | 10669 property_tree_root->transform_id = kRootPropertyTreeNodeId; |
10670 | 10670 |
10671 // The node owned by root1 | 10671 // The node owned by root1 |
10672 ScrollNode scroll_root1; | 10672 ScrollNode scroll_root1; |
10673 scroll_root1.id = 1; | 10673 scroll_root1.id = 1; |
10674 scroll_root1.owning_layer_id = root1->id(); | 10674 scroll_root1.owning_layer_id = root1->id(); |
10675 scroll_root1.user_scrollable_horizontal = true; | 10675 scroll_root1.user_scrollable_horizontal = true; |
10676 scroll_root1.user_scrollable_vertical = true; | 10676 scroll_root1.user_scrollable_vertical = true; |
10677 scroll_root1.transform_id = root1->transform_tree_index(); | 10677 scroll_root1.transform_id = root1->transform_tree_index(); |
10678 expected_scroll_tree.Insert(scroll_root1, 0); | 10678 expected_scroll_tree.Insert(scroll_root1, 0); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10724 scroll_grand_child11.scrollable = true; | 10724 scroll_grand_child11.scrollable = true; |
10725 scroll_grand_child11.user_scrollable_horizontal = true; | 10725 scroll_grand_child11.user_scrollable_horizontal = true; |
10726 scroll_grand_child11.user_scrollable_vertical = true; | 10726 scroll_grand_child11.user_scrollable_vertical = true; |
10727 scroll_grand_child11.transform_id = grand_child11->transform_tree_index(); | 10727 scroll_grand_child11.transform_id = grand_child11->transform_tree_index(); |
10728 expected_scroll_tree.Insert(scroll_grand_child11, 4); | 10728 expected_scroll_tree.Insert(scroll_grand_child11, 4); |
10729 | 10729 |
10730 // The node owned by parent5 | 10730 // The node owned by parent5 |
10731 ScrollNode scroll_parent5; | 10731 ScrollNode scroll_parent5; |
10732 scroll_parent5.id = 8; | 10732 scroll_parent5.id = 8; |
10733 scroll_parent5.owning_layer_id = parent5->id(); | 10733 scroll_parent5.owning_layer_id = parent5->id(); |
10734 scroll_parent5.contains_non_fast_scrollable_region = true; | 10734 scroll_parent5.non_fast_scrollable_region = gfx::Rect(0, 0, 50, 50); |
10735 scroll_parent5.bounds = gfx::Size(10, 10); | 10735 scroll_parent5.bounds = gfx::Size(10, 10); |
10736 scroll_parent5.should_flatten = true; | 10736 scroll_parent5.should_flatten = true; |
10737 scroll_parent5.user_scrollable_horizontal = true; | 10737 scroll_parent5.user_scrollable_horizontal = true; |
10738 scroll_parent5.user_scrollable_vertical = true; | 10738 scroll_parent5.user_scrollable_vertical = true; |
10739 scroll_parent5.transform_id = parent5->transform_tree_index(); | 10739 scroll_parent5.transform_id = parent5->transform_tree_index(); |
10740 expected_scroll_tree.Insert(scroll_parent5, 1); | 10740 expected_scroll_tree.Insert(scroll_parent5, 1); |
10741 | 10741 |
10742 expected_scroll_tree.SetScrollOffset(parent2->id(), gfx::ScrollOffset(0, 0)); | 10742 expected_scroll_tree.SetScrollOffset(parent2->id(), gfx::ScrollOffset(0, 0)); |
10743 expected_scroll_tree.SetScrollOffset(child7->id(), gfx::ScrollOffset(0, 0)); | 10743 expected_scroll_tree.SetScrollOffset(child7->id(), gfx::ScrollOffset(0, 0)); |
10744 expected_scroll_tree.SetScrollOffset(grand_child11->id(), | 10744 expected_scroll_tree.SetScrollOffset(grand_child11->id(), |
10745 gfx::ScrollOffset(0, 0)); | 10745 gfx::ScrollOffset(0, 0)); |
10746 expected_scroll_tree.set_needs_update(false); | 10746 expected_scroll_tree.set_needs_update(false); |
10747 | 10747 |
10748 EXPECT_EQ(expected_scroll_tree, scroll_tree); | 10748 EXPECT_EQ(expected_scroll_tree, scroll_tree); |
10749 | 10749 |
10750 // Check other layers' scroll_tree_index | 10750 // Check other layers' scroll_tree_index |
10751 EXPECT_EQ(scroll_root1.id, page_scale_layer->scroll_tree_index()); | 10751 EXPECT_EQ(scroll_root1.id, page_scale_layer->scroll_tree_index()); |
10752 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10752 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
10753 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10753 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
10754 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10754 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
10755 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10755 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
10756 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10756 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
10757 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10757 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
10758 } | 10758 } |
10759 | 10759 |
10760 } // namespace | 10760 } // namespace |
10761 } // namespace cc | 10761 } // namespace cc |
OLD | NEW |