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

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

Issue 1736073002: cc: Move SyncedScrollOffset to scroll tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and add comment Created 4 years, 9 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/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('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 10049 matching lines...) Expand 10 before | Expand all | Expand 10 after
10060 parent5->SetBounds(gfx::Size(10, 10)); 10060 parent5->SetBounds(gfx::Size(10, 10));
10061 10061
10062 host()->RegisterViewportLayers(NULL, page_scale_layer, parent2, NULL); 10062 host()->RegisterViewportLayers(NULL, page_scale_layer, parent2, NULL);
10063 ExecuteCalculateDrawPropertiesWithPropertyTrees(root1.get()); 10063 ExecuteCalculateDrawPropertiesWithPropertyTrees(root1.get());
10064 10064
10065 const int kInvalidPropertyTreeNodeId = -1; 10065 const int kInvalidPropertyTreeNodeId = -1;
10066 const int kRootPropertyTreeNodeId = 0; 10066 const int kRootPropertyTreeNodeId = 0;
10067 10067
10068 // Property tree root 10068 // Property tree root
10069 ScrollTree scroll_tree = host()->property_trees()->scroll_tree; 10069 ScrollTree scroll_tree = host()->property_trees()->scroll_tree;
10070 ScrollTree expected_scroll_tree; 10070 PropertyTrees property_trees;
10071 ScrollTree expected_scroll_tree = property_trees.scroll_tree;
10071 ScrollNode* property_tree_root = expected_scroll_tree.Node(0); 10072 ScrollNode* property_tree_root = expected_scroll_tree.Node(0);
10072 property_tree_root->id = kRootPropertyTreeNodeId; 10073 property_tree_root->id = kRootPropertyTreeNodeId;
10073 property_tree_root->parent_id = kInvalidPropertyTreeNodeId; 10074 property_tree_root->parent_id = kInvalidPropertyTreeNodeId;
10074 property_tree_root->owner_id = kInvalidPropertyTreeNodeId; 10075 property_tree_root->owner_id = kInvalidPropertyTreeNodeId;
10075 property_tree_root->data.scrollable = false; 10076 property_tree_root->data.scrollable = false;
10076 property_tree_root->data.main_thread_scrolling_reasons = 10077 property_tree_root->data.main_thread_scrolling_reasons =
10077 MainThreadScrollingReason::kNotScrollingOnMain; 10078 MainThreadScrollingReason::kNotScrollingOnMain;
10078 property_tree_root->data.contains_non_fast_scrollable_region = false; 10079 property_tree_root->data.contains_non_fast_scrollable_region = false;
10079 property_tree_root->data.transform_id = kRootPropertyTreeNodeId; 10080 property_tree_root->data.transform_id = kRootPropertyTreeNodeId;
10080 10081
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
10143 scroll_parent5.id = 8; 10144 scroll_parent5.id = 8;
10144 scroll_parent5.owner_id = parent5->id(); 10145 scroll_parent5.owner_id = parent5->id();
10145 scroll_parent5.data.contains_non_fast_scrollable_region = true; 10146 scroll_parent5.data.contains_non_fast_scrollable_region = true;
10146 scroll_parent5.data.bounds = gfx::Size(10, 10); 10147 scroll_parent5.data.bounds = gfx::Size(10, 10);
10147 scroll_parent5.data.should_flatten = true; 10148 scroll_parent5.data.should_flatten = true;
10148 scroll_parent5.data.user_scrollable_horizontal = true; 10149 scroll_parent5.data.user_scrollable_horizontal = true;
10149 scroll_parent5.data.user_scrollable_vertical = true; 10150 scroll_parent5.data.user_scrollable_vertical = true;
10150 scroll_parent5.data.transform_id = parent5->transform_tree_index(); 10151 scroll_parent5.data.transform_id = parent5->transform_tree_index();
10151 expected_scroll_tree.Insert(scroll_parent5, 1); 10152 expected_scroll_tree.Insert(scroll_parent5, 1);
10152 10153
10154 expected_scroll_tree.synced_scroll_offset(parent2->id())
10155 ->PushFromMainThread(gfx::ScrollOffset(0, 0));
10156 expected_scroll_tree.synced_scroll_offset(child7->id())
10157 ->PushFromMainThread(gfx::ScrollOffset(0, 0));
10158 expected_scroll_tree.synced_scroll_offset(grand_child11->id())
10159 ->PushFromMainThread(gfx::ScrollOffset(0, 0));
10153 expected_scroll_tree.set_needs_update(false); 10160 expected_scroll_tree.set_needs_update(false);
10154 10161
10155 EXPECT_EQ(expected_scroll_tree, scroll_tree); 10162 EXPECT_EQ(expected_scroll_tree, scroll_tree);
10156 10163
10157 // Check other layers' scroll_tree_index 10164 // Check other layers' scroll_tree_index
10158 EXPECT_EQ(scroll_root1.id, page_scale_layer->scroll_tree_index()); 10165 EXPECT_EQ(scroll_root1.id, page_scale_layer->scroll_tree_index());
10159 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10166 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10160 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10167 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10161 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10168 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10162 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10169 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10163 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10170 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10164 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10171 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10165 } 10172 }
10166 10173
10167 } // namespace 10174 } // namespace
10168 } // namespace cc 10175 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698