Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1689293002: cc: Move TryScroll from LayerImpl to LayerTreeHostImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with master branch Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10025 matching lines...) Expand 10 before | Expand all | Expand 10 after
10036 ScrollTree scroll_tree = host()->property_trees()->scroll_tree; 10036 ScrollTree scroll_tree = host()->property_trees()->scroll_tree;
10037 ScrollTree expected_scroll_tree; 10037 ScrollTree expected_scroll_tree;
10038 ScrollNode* property_tree_root = expected_scroll_tree.Node(0); 10038 ScrollNode* property_tree_root = expected_scroll_tree.Node(0);
10039 property_tree_root->id = kRootPropertyTreeNodeId; 10039 property_tree_root->id = kRootPropertyTreeNodeId;
10040 property_tree_root->parent_id = kInvalidPropertyTreeNodeId; 10040 property_tree_root->parent_id = kInvalidPropertyTreeNodeId;
10041 property_tree_root->owner_id = kInvalidPropertyTreeNodeId; 10041 property_tree_root->owner_id = kInvalidPropertyTreeNodeId;
10042 property_tree_root->data.scrollable = false; 10042 property_tree_root->data.scrollable = false;
10043 property_tree_root->data.main_thread_scrolling_reasons = 10043 property_tree_root->data.main_thread_scrolling_reasons =
10044 MainThreadScrollingReason::kNotScrollingOnMain; 10044 MainThreadScrollingReason::kNotScrollingOnMain;
10045 property_tree_root->data.contains_non_fast_scrollable_region = false; 10045 property_tree_root->data.contains_non_fast_scrollable_region = false;
10046 property_tree_root->data.transform_id = kRootPropertyTreeNodeId;
10046 10047
10047 // The node owned by root1 10048 // The node owned by root1
10048 ScrollNode scroll_root1; 10049 ScrollNode scroll_root1;
10049 scroll_root1.id = 1; 10050 scroll_root1.id = 1;
10050 scroll_root1.owner_id = root1->id(); 10051 scroll_root1.owner_id = root1->id();
10052 scroll_root1.data.transform_id = root1->transform_tree_index();
10051 expected_scroll_tree.Insert(scroll_root1, 0); 10053 expected_scroll_tree.Insert(scroll_root1, 0);
10052 10054
10053 // The node owned by parent2 10055 // The node owned by parent2
10054 ScrollNode scroll_parent2; 10056 ScrollNode scroll_parent2;
10055 scroll_parent2.id = 2; 10057 scroll_parent2.id = 2;
10056 scroll_parent2.owner_id = parent2->id(); 10058 scroll_parent2.owner_id = parent2->id();
10057 scroll_parent2.data.scrollable = true; 10059 scroll_parent2.data.scrollable = true;
10058 scroll_parent2.data.main_thread_scrolling_reasons = 10060 scroll_parent2.data.main_thread_scrolling_reasons =
10059 parent2->main_thread_scrolling_reasons(); 10061 parent2->main_thread_scrolling_reasons();
10060 scroll_parent2.data.scroll_clip_layer_bounds = root1->bounds(); 10062 scroll_parent2.data.scroll_clip_layer_bounds = root1->bounds();
10061 scroll_parent2.data.bounds = parent2->bounds(); 10063 scroll_parent2.data.bounds = parent2->bounds();
10062 scroll_parent2.data.max_scroll_offset_affected_by_page_scale = true; 10064 scroll_parent2.data.max_scroll_offset_affected_by_page_scale = true;
10063 scroll_parent2.data.is_inner_viewport_scroll_layer = true; 10065 scroll_parent2.data.is_inner_viewport_scroll_layer = true;
10066 scroll_parent2.data.transform_id = parent2->transform_tree_index();
10064 expected_scroll_tree.Insert(scroll_parent2, 1); 10067 expected_scroll_tree.Insert(scroll_parent2, 1);
10065 10068
10066 // The node owned by child6 10069 // The node owned by child6
10067 ScrollNode scroll_child6; 10070 ScrollNode scroll_child6;
10068 scroll_child6.id = 3; 10071 scroll_child6.id = 3;
10069 scroll_child6.owner_id = child6->id(); 10072 scroll_child6.owner_id = child6->id();
10070 scroll_child6.data.main_thread_scrolling_reasons = 10073 scroll_child6.data.main_thread_scrolling_reasons =
10071 child6->main_thread_scrolling_reasons(); 10074 child6->main_thread_scrolling_reasons();
10075 scroll_child6.data.transform_id = child6->transform_tree_index();
10072 expected_scroll_tree.Insert(scroll_child6, 2); 10076 expected_scroll_tree.Insert(scroll_child6, 2);
10073 10077
10074 // The node owned by child7, child7 also owns a transform node 10078 // The node owned by child7, child7 also owns a transform node
10075 ScrollNode scroll_child7; 10079 ScrollNode scroll_child7;
10076 scroll_child7.id = 4; 10080 scroll_child7.id = 4;
10077 scroll_child7.owner_id = child7->id(); 10081 scroll_child7.owner_id = child7->id();
10078 scroll_child7.data.scrollable = true; 10082 scroll_child7.data.scrollable = true;
10079 scroll_parent2.data.scroll_clip_layer_bounds = parent3->bounds(); 10083 scroll_child7.data.scroll_clip_layer_bounds = parent3->bounds();
10080 scroll_parent2.data.bounds = child7->bounds(); 10084 scroll_child7.data.bounds = child7->bounds();
10085 scroll_child7.data.transform_id = child7->transform_tree_index();
10081 expected_scroll_tree.Insert(scroll_child7, 1); 10086 expected_scroll_tree.Insert(scroll_child7, 1);
10082 10087
10083 // The node owned by grand_child11, grand_child11 also owns a transform node 10088 // The node owned by grand_child11, grand_child11 also owns a transform node
10084 ScrollNode scroll_grand_child11; 10089 ScrollNode scroll_grand_child11;
10085 scroll_grand_child11.id = 5; 10090 scroll_grand_child11.id = 5;
10086 scroll_grand_child11.owner_id = grand_child11->id(); 10091 scroll_grand_child11.owner_id = grand_child11->id();
10087 scroll_grand_child11.data.scrollable = true; 10092 scroll_grand_child11.data.scrollable = true;
10093 scroll_grand_child11.data.transform_id =
10094 grand_child11->transform_tree_index();
10088 expected_scroll_tree.Insert(scroll_grand_child11, 4); 10095 expected_scroll_tree.Insert(scroll_grand_child11, 4);
10089 10096
10090 // The node owned by parent5 10097 // The node owned by parent5
10091 ScrollNode scroll_parent5; 10098 ScrollNode scroll_parent5;
10092 scroll_parent5.id = 8; 10099 scroll_parent5.id = 8;
10093 scroll_parent5.owner_id = parent5->id(); 10100 scroll_parent5.owner_id = parent5->id();
10094 scroll_parent5.data.contains_non_fast_scrollable_region = true; 10101 scroll_parent5.data.contains_non_fast_scrollable_region = true;
10095 scroll_parent5.data.bounds = gfx::Size(10, 10); 10102 scroll_parent5.data.bounds = gfx::Size(10, 10);
10103 scroll_parent5.data.transform_id = parent5->transform_tree_index();
10096 expected_scroll_tree.Insert(scroll_parent5, 1); 10104 expected_scroll_tree.Insert(scroll_parent5, 1);
10097 10105
10098 expected_scroll_tree.set_needs_update(false); 10106 expected_scroll_tree.set_needs_update(false);
10099 10107
10100 EXPECT_EQ(expected_scroll_tree, scroll_tree); 10108 EXPECT_EQ(expected_scroll_tree, scroll_tree);
10101 10109
10102 // Check other layers' scroll_tree_index 10110 // Check other layers' scroll_tree_index
10103 EXPECT_EQ(scroll_root1.id, page_scale_layer->scroll_tree_index()); 10111 EXPECT_EQ(scroll_root1.id, page_scale_layer->scroll_tree_index());
10104 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10112 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10105 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10113 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10106 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10114 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10107 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10115 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10108 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10116 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10109 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10117 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10110 } 10118 }
10111 10119
10112 } // namespace 10120 } // namespace
10113 } // namespace cc 10121 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698