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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 1675963002: Move MaxScrollOffset to property_trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply comments. 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 600047c81a574844922f1a18491968e58273646d..c98c4c08a7bcd0e9933c4bfbdaf7f785423296c7 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -5241,6 +5241,7 @@ TEST_F(LayerTreeHostImplTest, ScrollViewportRounding) {
SetupScrollAndContentsLayers(gfx::Size(width, height));
host_impl_->active_tree()->InnerViewportContainerLayer()->SetBounds(
gfx::Size(width * scale - 1, height * scale));
+ RebuildPropertyTrees();
host_impl_->active_tree()->SetDeviceScaleFactor(scale);
host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.5f, 4.f);
@@ -5319,6 +5320,7 @@ TEST_F(LayerTreeHostImplTest, RootLayerScrollOffsetDelegation) {
LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100));
LayerImpl* clip_layer = scroll_layer->parent()->parent();
clip_layer->SetBounds(gfx::Size(10, 20));
+ RebuildPropertyTrees();
host_impl_->BindToClient(&scroll_watcher);
@@ -5689,6 +5691,7 @@ TEST_F(LayerTreeHostImplTest, OverscrollAlways) {
LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(50, 50));
LayerImpl* clip_layer = scroll_layer->parent()->parent();
clip_layer->SetBounds(gfx::Size(50, 50));
+ RebuildPropertyTrees();
host_impl_->SetViewportSize(gfx::Size(50, 50));
host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.5f, 4.f);
DrawFrame();
@@ -8413,8 +8416,27 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
host_impl_->SetViewportSize(gfx::Size(100, 100));
ajuma 2016/02/09 22:35:05 If you build property trees here, you shouldn't ne
sunxd 2016/02/10 16:56:36 DrawFrame() forces a rebuild of property trees her
ajuma 2016/02/10 17:54:58 How about making a version of DrawFrame that doesn
host_impl_->top_controls_manager()->UpdateTopControlsState(BOTH, SHOWN,
false);
+
+ LayerImpl* inner_clip_layer = scroll_layer->scroll_clip_layer();
+ LayerImpl* outer_clip_layer = host_impl_->active_tree()
+ ->OuterViewportScrollLayer()
+ ->scroll_clip_layer();
+
+ gfx::Vector2dF scroll_bounds_delta = scroll_layer->bounds_delta();
+ scroll_layer->SetBoundsDelta(gfx::Vector2dF());
+
+ gfx::Vector2dF inner_clip_bounds_delta = inner_clip_layer->bounds_delta();
+ inner_clip_layer->SetBoundsDelta(gfx::Vector2dF());
+
+ gfx::Vector2dF outer_clip_bounds_delta = outer_clip_layer->bounds_delta();
+ outer_clip_layer->SetBoundsDelta(gfx::Vector2dF());
+
DrawFrame();
+ scroll_layer->SetBoundsDelta(scroll_bounds_delta);
+ inner_clip_layer->SetBoundsDelta(inner_clip_bounds_delta);
+ outer_clip_layer->SetBoundsDelta(outer_clip_bounds_delta);
+
EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
InputHandler::GESTURE)
@@ -9902,7 +9924,8 @@ TEST_F(LayerTreeHostImplTest, UpdatePageScaleFactorOnActiveTree) {
TransformNode* active_tree_node =
host_impl_->active_tree()->property_trees()->transform_tree.Node(
page_scale_layer->transform_tree_index());
- EXPECT_EQ(active_tree_node->data.post_local_scale_factor, 1.f);
+ // SetPageScaleOnActiveTree also updates the factors in property trees.
+ EXPECT_EQ(active_tree_node->data.post_local_scale_factor, 2.f);
EXPECT_EQ(host_impl_->active_tree()->current_page_scale_factor(), 2.f);
TransformNode* pending_tree_node =

Powered by Google App Engine
This is Rietveld 408576698