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

Unified Diff: cc/trees/layer_tree_host_unittest_scroll.cc

Issue 2051013002: cc : Push layer lists instead of layer tree at commit and activation (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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest_scroll.cc
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc
index 6e685a5959b0bc68d3f404ada0608d9fa285971c..f1b06e4f8c38725c3294ccfb4da8a28c117e24bb 100644
--- a/cc/trees/layer_tree_host_unittest_scroll.cc
+++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -1147,55 +1147,57 @@ class LayerTreeHostScrollTestScrollZeroMaxScrollOffset
PostSetNeedsCommitToMainThread();
}
+ void UpdateLayerTreeHost() override {
+ Layer* root = layer_tree_host()->root_layer();
+ Layer* scroll_layer = layer_tree_host()->outer_viewport_scroll_layer();
+ switch (layer_tree_host()->source_frame_number()) {
+ case 0:
+ scroll_layer->SetScrollClipLayerId(outer_viewport_container_layer_id_);
+ // Set max_scroll_offset = (100, 100).
+ scroll_layer->SetBounds(gfx::Size(root->bounds().width() + 100,
+ root->bounds().height() + 100));
+ break;
+ case 1:
+ // Set max_scroll_offset = (0, 0).
+ scroll_layer->SetBounds(root->bounds());
+ break;
+ case 2:
+ // Set max_scroll_offset = (-100, -100).
+ scroll_layer->SetBounds(gfx::Size());
+ break;
+ }
+ }
+
void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
- LayerImpl* root = impl->active_tree()->root_layer();
LayerImpl* scroll_layer = impl->OuterViewportScrollLayer();
- scroll_layer->SetScrollClipLayer(outer_viewport_container_layer_id_);
-
- // Set max_scroll_offset = (100, 100).
- scroll_layer->SetBounds(
- gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100));
- impl->active_tree()->property_trees()->needs_rebuild = true;
- impl->active_tree()->BuildLayerListAndPropertyTreesForTesting();
ScrollTree& scroll_tree =
impl->active_tree()->property_trees()->scroll_tree;
ScrollNode* scroll_node =
scroll_tree.Node(scroll_layer->scroll_tree_index());
-
InputHandler::ScrollStatus status =
impl->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::TOUCHSCREEN,
scroll_tree, scroll_node);
-
- EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
- EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
- status.main_thread_scrolling_reasons);
-
- // Set max_scroll_offset = (0, 0).
- scroll_layer->SetBounds(root->bounds());
- impl->active_tree()->property_trees()->needs_rebuild = true;
- impl->active_tree()->BuildLayerListAndPropertyTreesForTesting();
- scroll_tree = impl->active_tree()->property_trees()->scroll_tree;
- scroll_node = scroll_tree.Node(scroll_layer->scroll_tree_index());
- status = impl->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::TOUCHSCREEN,
- scroll_tree, scroll_node);
- EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread);
- EXPECT_EQ(MainThreadScrollingReason::kNotScrollable,
- status.main_thread_scrolling_reasons);
-
- // Set max_scroll_offset = (-100, -100).
- scroll_layer->SetBounds(gfx::Size());
- impl->active_tree()->property_trees()->needs_rebuild = true;
- impl->active_tree()->BuildLayerListAndPropertyTreesForTesting();
- scroll_tree = impl->active_tree()->property_trees()->scroll_tree;
- scroll_node = scroll_tree.Node(scroll_layer->scroll_tree_index());
- status = impl->TryScroll(gfx::PointF(0.0f, 1.0f), InputHandler::TOUCHSCREEN,
- scroll_tree, scroll_node);
- EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread);
- EXPECT_EQ(MainThreadScrollingReason::kNotScrollable,
- status.main_thread_scrolling_reasons);
-
- EndTest();
+ switch (impl->active_tree()->source_frame_number()) {
+ case 0:
+ EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, status.thread);
+ EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
+ status.main_thread_scrolling_reasons);
+ PostSetNeedsCommitToMainThread();
+ break;
+ case 1:
+ EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread);
+ EXPECT_EQ(MainThreadScrollingReason::kNotScrollable,
+ status.main_thread_scrolling_reasons);
+ PostSetNeedsCommitToMainThread();
+ break;
+ case 2:
+ EXPECT_EQ(InputHandler::SCROLL_IGNORED, status.thread);
+ EXPECT_EQ(MainThreadScrollingReason::kNotScrollable,
+ status.main_thread_scrolling_reasons);
+ EndTest();
+ break;
+ }
}
void AfterTest() override {}
« 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