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

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

Issue 2032303004: cc : Add layer_list to LayerTreeImpl and build it for tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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_impl_unittest.cc ('k') | cc/trees/layer_tree_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 1148
1149 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 1149 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
1150 LayerImpl* root = impl->active_tree()->root_layer(); 1150 LayerImpl* root = impl->active_tree()->root_layer();
1151 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); 1151 LayerImpl* scroll_layer = impl->OuterViewportScrollLayer();
1152 scroll_layer->SetScrollClipLayer(outer_viewport_container_layer_id_); 1152 scroll_layer->SetScrollClipLayer(outer_viewport_container_layer_id_);
1153 1153
1154 // Set max_scroll_offset = (100, 100). 1154 // Set max_scroll_offset = (100, 100).
1155 scroll_layer->SetBounds( 1155 scroll_layer->SetBounds(
1156 gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100)); 1156 gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100));
1157 impl->active_tree()->property_trees()->needs_rebuild = true; 1157 impl->active_tree()->property_trees()->needs_rebuild = true;
1158 impl->active_tree()->BuildPropertyTreesForTesting(); 1158 impl->active_tree()->BuildLayerListAndPropertyTreesForTesting();
1159 1159
1160 ScrollTree& scroll_tree = 1160 ScrollTree& scroll_tree =
1161 impl->active_tree()->property_trees()->scroll_tree; 1161 impl->active_tree()->property_trees()->scroll_tree;
1162 ScrollNode* scroll_node = 1162 ScrollNode* scroll_node =
1163 scroll_tree.Node(scroll_layer->scroll_tree_index()); 1163 scroll_tree.Node(scroll_layer->scroll_tree_index());
1164 1164
1165 InputHandler::ScrollStatus status = 1165 InputHandler::ScrollStatus status =
1166 impl->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::TOUCHSCREEN, 1166 impl->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::TOUCHSCREEN,
1167 scroll_tree, scroll_node); 1167 scroll_tree, scroll_node);
1168 1168
1169 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread); 1169 EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
1170 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain, 1170 EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
1171 status.main_thread_scrolling_reasons); 1171 status.main_thread_scrolling_reasons);
1172 1172
1173 // Set max_scroll_offset = (0, 0). 1173 // Set max_scroll_offset = (0, 0).
1174 scroll_layer->SetBounds(root->bounds()); 1174 scroll_layer->SetBounds(root->bounds());
1175 impl->active_tree()->property_trees()->needs_rebuild = true; 1175 impl->active_tree()->property_trees()->needs_rebuild = true;
1176 impl->active_tree()->BuildPropertyTreesForTesting(); 1176 impl->active_tree()->BuildLayerListAndPropertyTreesForTesting();
1177 scroll_tree = impl->active_tree()->property_trees()->scroll_tree; 1177 scroll_tree = impl->active_tree()->property_trees()->scroll_tree;
1178 scroll_node = scroll_tree.Node(scroll_layer->scroll_tree_index()); 1178 scroll_node = scroll_tree.Node(scroll_layer->scroll_tree_index());
1179 status = impl->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::TOUCHSCREEN, 1179 status = impl->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::TOUCHSCREEN,
1180 scroll_tree, scroll_node); 1180 scroll_tree, scroll_node);
1181 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread); 1181 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread);
1182 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable, 1182 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable,
1183 status.main_thread_scrolling_reasons); 1183 status.main_thread_scrolling_reasons);
1184 1184
1185 // Set max_scroll_offset = (-100, -100). 1185 // Set max_scroll_offset = (-100, -100).
1186 scroll_layer->SetBounds(gfx::Size()); 1186 scroll_layer->SetBounds(gfx::Size());
1187 impl->active_tree()->property_trees()->needs_rebuild = true; 1187 impl->active_tree()->property_trees()->needs_rebuild = true;
1188 impl->active_tree()->BuildPropertyTreesForTesting(); 1188 impl->active_tree()->BuildLayerListAndPropertyTreesForTesting();
1189 scroll_tree = impl->active_tree()->property_trees()->scroll_tree; 1189 scroll_tree = impl->active_tree()->property_trees()->scroll_tree;
1190 scroll_node = scroll_tree.Node(scroll_layer->scroll_tree_index()); 1190 scroll_node = scroll_tree.Node(scroll_layer->scroll_tree_index());
1191 status = impl->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::TOUCHSCREEN, 1191 status = impl->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::TOUCHSCREEN,
1192 scroll_tree, scroll_node); 1192 scroll_tree, scroll_node);
1193 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread); 1193 EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread);
1194 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable, 1194 EXPECT_EQ(MainThreadScrollingReason::kNotScrollable,
1195 status.main_thread_scrolling_reasons); 1195 status.main_thread_scrolling_reasons);
1196 1196
1197 EndTest(); 1197 EndTest();
1198 } 1198 }
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 RunTest(CompositorMode::THREADED, false); 1508 RunTest(CompositorMode::THREADED, false);
1509 } 1509 }
1510 1510
1511 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { 1511 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) {
1512 scroll_destroy_whole_tree_ = true; 1512 scroll_destroy_whole_tree_ = true;
1513 RunTest(CompositorMode::THREADED, false); 1513 RunTest(CompositorMode::THREADED, false);
1514 } 1514 }
1515 1515
1516 } // namespace 1516 } // namespace
1517 } // namespace cc 1517 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698