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

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 and fix unit test failures. 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
« no previous file with comments | « cc/proto/property_tree.proto ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 10058 matching lines...) Expand 10 before | Expand all | Expand 10 after
10069 ScrollTree scroll_tree = host()->property_trees()->scroll_tree; 10069 ScrollTree scroll_tree = host()->property_trees()->scroll_tree;
10070 ScrollTree expected_scroll_tree; 10070 ScrollTree expected_scroll_tree;
10071 ScrollNode* property_tree_root = expected_scroll_tree.Node(0); 10071 ScrollNode* property_tree_root = expected_scroll_tree.Node(0);
10072 property_tree_root->id = kRootPropertyTreeNodeId; 10072 property_tree_root->id = kRootPropertyTreeNodeId;
10073 property_tree_root->parent_id = kInvalidPropertyTreeNodeId; 10073 property_tree_root->parent_id = kInvalidPropertyTreeNodeId;
10074 property_tree_root->owner_id = kInvalidPropertyTreeNodeId; 10074 property_tree_root->owner_id = kInvalidPropertyTreeNodeId;
10075 property_tree_root->data.scrollable = false; 10075 property_tree_root->data.scrollable = false;
10076 property_tree_root->data.main_thread_scrolling_reasons = 10076 property_tree_root->data.main_thread_scrolling_reasons =
10077 MainThreadScrollingReason::kNotScrollingOnMain; 10077 MainThreadScrollingReason::kNotScrollingOnMain;
10078 property_tree_root->data.contains_non_fast_scrollable_region = false; 10078 property_tree_root->data.contains_non_fast_scrollable_region = false;
10079 property_tree_root->data.transform_id = kRootPropertyTreeNodeId;
10079 10080
10080 // The node owned by root1 10081 // The node owned by root1
10081 ScrollNode scroll_root1; 10082 ScrollNode scroll_root1;
10082 scroll_root1.id = 1; 10083 scroll_root1.id = 1;
10083 scroll_root1.owner_id = root1->id(); 10084 scroll_root1.owner_id = root1->id();
10085 scroll_root1.data.transform_id = root1->transform_tree_index();
10084 expected_scroll_tree.Insert(scroll_root1, 0); 10086 expected_scroll_tree.Insert(scroll_root1, 0);
10085 10087
10086 // The node owned by parent2 10088 // The node owned by parent2
10087 ScrollNode scroll_parent2; 10089 ScrollNode scroll_parent2;
10088 scroll_parent2.id = 2; 10090 scroll_parent2.id = 2;
10089 scroll_parent2.owner_id = parent2->id(); 10091 scroll_parent2.owner_id = parent2->id();
10090 scroll_parent2.data.scrollable = true; 10092 scroll_parent2.data.scrollable = true;
10091 scroll_parent2.data.main_thread_scrolling_reasons = 10093 scroll_parent2.data.main_thread_scrolling_reasons =
10092 parent2->main_thread_scrolling_reasons(); 10094 parent2->main_thread_scrolling_reasons();
10093 scroll_parent2.data.scroll_clip_layer_bounds = root1->bounds(); 10095 scroll_parent2.data.scroll_clip_layer_bounds = root1->bounds();
10094 scroll_parent2.data.bounds = parent2->bounds(); 10096 scroll_parent2.data.bounds = parent2->bounds();
10095 scroll_parent2.data.max_scroll_offset_affected_by_page_scale = true; 10097 scroll_parent2.data.max_scroll_offset_affected_by_page_scale = true;
10096 scroll_parent2.data.is_inner_viewport_scroll_layer = true; 10098 scroll_parent2.data.is_inner_viewport_scroll_layer = true;
10099 scroll_parent2.data.transform_id = parent2->transform_tree_index();
10097 expected_scroll_tree.Insert(scroll_parent2, 1); 10100 expected_scroll_tree.Insert(scroll_parent2, 1);
10098 10101
10099 // The node owned by child6 10102 // The node owned by child6
10100 ScrollNode scroll_child6; 10103 ScrollNode scroll_child6;
10101 scroll_child6.id = 3; 10104 scroll_child6.id = 3;
10102 scroll_child6.owner_id = child6->id(); 10105 scroll_child6.owner_id = child6->id();
10103 scroll_child6.data.main_thread_scrolling_reasons = 10106 scroll_child6.data.main_thread_scrolling_reasons =
10104 child6->main_thread_scrolling_reasons(); 10107 child6->main_thread_scrolling_reasons();
10108 scroll_child6.data.should_flatten = true;
10109 scroll_child6.data.transform_id = child6->transform_tree_index();
10105 expected_scroll_tree.Insert(scroll_child6, 2); 10110 expected_scroll_tree.Insert(scroll_child6, 2);
10106 10111
10107 // The node owned by child7, child7 also owns a transform node 10112 // The node owned by child7, child7 also owns a transform node
10108 ScrollNode scroll_child7; 10113 ScrollNode scroll_child7;
10109 scroll_child7.id = 4; 10114 scroll_child7.id = 4;
10110 scroll_child7.owner_id = child7->id(); 10115 scroll_child7.owner_id = child7->id();
10111 scroll_child7.data.scrollable = true; 10116 scroll_child7.data.scrollable = true;
10112 scroll_parent2.data.scroll_clip_layer_bounds = parent3->bounds(); 10117 scroll_child7.data.scroll_clip_layer_bounds = parent3->bounds();
10113 scroll_parent2.data.bounds = child7->bounds(); 10118 scroll_child7.data.bounds = child7->bounds();
10119 scroll_child7.data.transform_id = child7->transform_tree_index();
10114 expected_scroll_tree.Insert(scroll_child7, 1); 10120 expected_scroll_tree.Insert(scroll_child7, 1);
10115 10121
10116 // The node owned by grand_child11, grand_child11 also owns a transform node 10122 // The node owned by grand_child11, grand_child11 also owns a transform node
10117 ScrollNode scroll_grand_child11; 10123 ScrollNode scroll_grand_child11;
10118 scroll_grand_child11.id = 5; 10124 scroll_grand_child11.id = 5;
10119 scroll_grand_child11.owner_id = grand_child11->id(); 10125 scroll_grand_child11.owner_id = grand_child11->id();
10120 scroll_grand_child11.data.scrollable = true; 10126 scroll_grand_child11.data.scrollable = true;
10127 scroll_grand_child11.data.transform_id =
10128 grand_child11->transform_tree_index();
10121 expected_scroll_tree.Insert(scroll_grand_child11, 4); 10129 expected_scroll_tree.Insert(scroll_grand_child11, 4);
10122 10130
10123 // The node owned by parent5 10131 // The node owned by parent5
10124 ScrollNode scroll_parent5; 10132 ScrollNode scroll_parent5;
10125 scroll_parent5.id = 8; 10133 scroll_parent5.id = 8;
10126 scroll_parent5.owner_id = parent5->id(); 10134 scroll_parent5.owner_id = parent5->id();
10127 scroll_parent5.data.contains_non_fast_scrollable_region = true; 10135 scroll_parent5.data.contains_non_fast_scrollable_region = true;
10128 scroll_parent5.data.bounds = gfx::Size(10, 10); 10136 scroll_parent5.data.bounds = gfx::Size(10, 10);
10137 scroll_parent5.data.should_flatten = true;
10138 scroll_parent5.data.transform_id = parent5->transform_tree_index();
10129 expected_scroll_tree.Insert(scroll_parent5, 1); 10139 expected_scroll_tree.Insert(scroll_parent5, 1);
10130 10140
10131 expected_scroll_tree.set_needs_update(false); 10141 expected_scroll_tree.set_needs_update(false);
10132 10142
10133 EXPECT_EQ(expected_scroll_tree, scroll_tree); 10143 EXPECT_EQ(expected_scroll_tree, scroll_tree);
10134 10144
10135 // Check other layers' scroll_tree_index 10145 // Check other layers' scroll_tree_index
10136 EXPECT_EQ(scroll_root1.id, page_scale_layer->scroll_tree_index()); 10146 EXPECT_EQ(scroll_root1.id, page_scale_layer->scroll_tree_index());
10137 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10147 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10138 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10148 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10139 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10149 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10140 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10150 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10141 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10151 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10142 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10152 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10143 } 10153 }
10144 10154
10145 } // namespace 10155 } // namespace
10146 } // namespace cc 10156 } // namespace cc
OLDNEW
« no previous file with comments | « cc/proto/property_tree.proto ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698