diff options
author | sunxd <sunxd@chromium.org> | 2016-01-07 08:28:30 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-07 16:29:28 +0000 |
commit | 676696574f4ca27c40528a07c803c4fb3b728041 (patch) | |
tree | adc3949db6173fcb2063dad5cf84d39b4d397c84 /cc | |
parent | 0e35f1c49a0f195c0579e5a2867ce01d0f78393e (diff) | |
download | chromium_src-676696574f4ca27c40528a07c803c4fb3b728041.zip chromium_src-676696574f4ca27c40528a07c803c4fb3b728041.tar.gz chromium_src-676696574f4ca27c40528a07c803c4fb3b728041.tar.bz2 |
Determine MaxScrollOffset without using 'tree' structure of LayerTree
* Use IsAffectedByPageScale instead of the tree structure to determine the scale factor in MaxScrollOffset();
* Fix related unit tests
* Fix a variable name issue of the previous changelist (Issue 1544103002)
BUG=568777
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1552803002
Cr-Commit-Position: refs/heads/master@{#368087}
Diffstat (limited to 'cc')
-rw-r--r-- | cc/layers/heads_up_display_layer_impl_unittest.cc | 16 | ||||
-rw-r--r-- | cc/layers/layer_impl.cc | 9 | ||||
-rw-r--r-- | cc/layers/layer_impl_unittest.cc | 8 | ||||
-rw-r--r-- | cc/layers/scrollbar_layer_unittest.cc | 2 | ||||
-rw-r--r-- | cc/test/layer_tree_test.cc | 3 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl_unittest.cc | 100 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest.cc | 16 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_picture.cc | 11 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_scroll.cc | 4 |
9 files changed, 103 insertions, 66 deletions
diff --git a/cc/layers/heads_up_display_layer_impl_unittest.cc b/cc/layers/heads_up_display_layer_impl_unittest.cc index 1535787..cb69b1b 100644 --- a/cc/layers/heads_up_display_layer_impl_unittest.cc +++ b/cc/layers/heads_up_display_layer_impl_unittest.cc @@ -43,23 +43,23 @@ TEST(HeadsUpDisplayLayerImplTest, ResourcelessSoftwareDrawAfterResourceLoss) { host_impl.CreatePendingTree(); host_impl.SetVisible(true); host_impl.InitializeRenderer(output_surface.get()); - scoped_ptr<HeadsUpDisplayLayerImpl> layer = - HeadsUpDisplayLayerImpl::Create(host_impl.pending_tree(), 1); - layer->SetBounds(gfx::Size(100, 100)); + scoped_ptr<HeadsUpDisplayLayerImpl> layer_ptr = + HeadsUpDisplayLayerImpl::Create(host_impl.pending_tree(), 1); + layer_ptr->SetBounds(gfx::Size(100, 100)); - HeadsUpDisplayLayerImpl* layer_ptr = layer.get(); + HeadsUpDisplayLayerImpl* layer = layer_ptr.get(); - host_impl.pending_tree()->SetRootLayer(std::move(layer)); + host_impl.pending_tree()->SetRootLayer(std::move(layer_ptr)); host_impl.pending_tree()->BuildPropertyTreesForTesting(); // Check regular hardware draw is ok. - CheckDrawLayer(layer_ptr, host_impl.resource_provider(), DRAW_MODE_HARDWARE); + CheckDrawLayer(layer, host_impl.resource_provider(), DRAW_MODE_HARDWARE); // Simulate a resource loss on transitioning to resourceless software mode. - layer_ptr->ReleaseResources(); + layer->ReleaseResources(); // Should skip resourceless software draw and not crash in UpdateHudTexture. - CheckDrawLayer(layer_ptr, host_impl.resource_provider(), + CheckDrawLayer(layer, host_impl.resource_provider(), DRAW_MODE_RESOURCELESS_SOFTWARE); } diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index b590f71..f36215d 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc @@ -1600,12 +1600,9 @@ gfx::ScrollOffset LayerImpl::MaxScrollOffset() const { IsContainerForFixedPositionLayers()); float scale_factor = 1.f; - for (LayerImpl const* current_layer = this; - current_layer != scroll_clip_layer->parent(); - current_layer = current_layer->parent()) { - if (current_layer == page_scale_layer) - scale_factor = layer_tree_impl()->current_page_scale_factor(); - } + DCHECK(scroll_clip_layer != page_scale_layer); + if (!scroll_clip_layer->IsAffectedByPageScale() && IsAffectedByPageScale()) + scale_factor = layer_tree_impl()->current_page_scale_factor(); gfx::SizeF scaled_scroll_bounds = gfx::ScaleSize(BoundsForScrolling(), scale_factor); diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc index 7666794..b9fb767 100644 --- a/cc/layers/layer_impl_unittest.cc +++ b/cc/layers/layer_impl_unittest.cc @@ -100,12 +100,13 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) { &task_graph_runner); host_impl.SetVisible(true); EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); - scoped_ptr<LayerImpl> root_clip = + scoped_ptr<LayerImpl> root_clip_ptr = LayerImpl::Create(host_impl.active_tree(), 1); + LayerImpl* root_clip = root_clip_ptr.get(); scoped_ptr<LayerImpl> root_ptr = LayerImpl::Create(host_impl.active_tree(), 2); LayerImpl* root = root_ptr.get(); - root_clip->AddChild(std::move(root_ptr)); + root_clip_ptr->AddChild(std::move(root_ptr)); scoped_ptr<LayerImpl> scroll_parent = LayerImpl::Create(host_impl.active_tree(), 3); LayerImpl* scroll_child = LayerImpl::Create(host_impl.active_tree(), 4).get(); @@ -125,6 +126,8 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) { LayerImpl* child = root->children()[0].get(); child->AddChild(LayerImpl::Create(host_impl.active_tree(), 8)); LayerImpl* grand_child = child->children()[0].get(); + host_impl.active_tree()->SetRootLayer(std::move(root_clip_ptr)); + host_impl.active_tree()->BuildPropertyTreesForTesting(); root->SetScrollClipLayer(root_clip->id()); @@ -464,6 +467,7 @@ class LayerImplScrollTest : public testing::Test { LayerImpl::Create(host_impl_.active_tree(), root_id_)); host_impl_.active_tree()->root_layer()->AddChild( LayerImpl::Create(host_impl_.active_tree(), root_id_ + 1)); + host_impl_.active_tree()->BuildPropertyTreesForTesting(); layer()->SetScrollClipLayer(root_id_); // Set the max scroll offset by noting that the root layer has bounds (1,1), // thus whatever bounds are set for the layer will be the max scroll diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc index 0202f4b4..b9fc9ae 100644 --- a/cc/layers/scrollbar_layer_unittest.cc +++ b/cc/layers/scrollbar_layer_unittest.cc @@ -223,6 +223,7 @@ TEST_F(ScrollbarLayerTest, ScrollOffsetSynchronization) { content_layer->SetBounds(gfx::Size(1000, 2000)); content_layer->SavePaintProperties(); + layer_tree_host_->UpdateLayers(); layer_impl_tree_root = layer_tree_host_->CommitAndCreateLayerImplTree(); EXPECT_EQ(100.f, cc_scrollbar_layer->current_pos()); @@ -448,6 +449,7 @@ TEST_F(ScrollbarLayerTest, LayerDrivenSolidColorDrawQuads) { scroll_layer->InsertChild(child2, 1); layer_tree_root->AddChild(scroll_layer); layer_tree_host_->SetRootLayer(layer_tree_root); + layer_tree_host_->UpdateLayers(); } LayerImpl* layer_impl_tree_root = layer_tree_host_->CommitAndCreateLayerImplTree(); diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index 3234d45..06822e3 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc @@ -70,8 +70,7 @@ void CreateVirtualViewportLayers(Layer* root_layer, inner_viewport_scroll_layer->SetIsContainerForFixedPositionLayers(true); outer_scroll_layer->SetIsContainerForFixedPositionLayers(true); - host->RegisterViewportLayers(NULL, - root_layer, + host->RegisterViewportLayers(NULL, page_scale_layer, inner_viewport_scroll_layer, outer_scroll_layer); } diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 2fc38a0..1d422e8 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -368,6 +368,7 @@ class LayerTreeHostImplTest : public testing::Test, host_impl_->InnerViewportScrollLayer()->parent()->parent(); inner_clip_layer->SetBounds(viewport_size); host_impl_->InnerViewportScrollLayer()->SetBounds(viewport_size); + host_impl_->active_tree()->BuildPropertyTreesForTesting(); host_impl_->SetViewportSize(viewport_size); host_impl_->active_tree()->DidBecomeActive(); @@ -571,9 +572,11 @@ TEST_F(LayerTreeHostImplTest, ScrollDeltaRepeatedScrolls) { root_layer->SetBounds(gfx::Size(110, 110)); root_layer->SetScrollClipLayer(root_clip->id()); root_layer->PushScrollOffsetFromMainThread(scroll_offset); - root_layer->ScrollBy(scroll_delta); host_impl_->active_tree()->SetRootLayer(std::move(root_clip)); + host_impl_->active_tree()->BuildPropertyTreesForTesting(); + root_layer->ScrollBy(scroll_delta); } + LayerImpl* root = host_impl_->active_tree()->root_layer()->children()[0].get(); @@ -1088,7 +1091,7 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) { ASSERT_EQ(1u, scroll_layer->children().size()); LayerImpl* overflow = scroll_layer->children()[0].get(); overflow->SetBounds(overflow_size); - overflow->SetScrollClipLayer(scroll_layer->parent()->id()); + overflow->SetScrollClipLayer(scroll_layer->parent()->parent()->id()); overflow->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); overflow->SetPosition(gfx::PointF()); @@ -2224,6 +2227,7 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimationTransferedOnSyncTreeActivate) { CreateScrollAndContentsLayers( host_impl_->pending_tree(), gfx::Size(100, 100)); + host_impl_->pending_tree()->BuildPropertyTreesForTesting(); host_impl_->ActivateSyncTree(); DrawFrame(); @@ -3547,6 +3551,7 @@ TEST_F(LayerTreeHostImplTest, ClampingAfterActivation) { host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); CreateScrollAndContentsLayers(host_impl_->pending_tree(), gfx::Size(100, 100)); + host_impl_->pending_tree()->BuildPropertyTreesForTesting(); host_impl_->ActivateSyncTree(); host_impl_->CreatePendingTree(); @@ -3635,6 +3640,7 @@ class LayerTreeHostImplTopControlsTest : public LayerTreeHostImplTest { host_impl_->active_tree()->SetViewportLayersFromIds( Layer::INVALID_ID, page_scale_layer_id, inner_viewport_scroll_layer_id, outer_viewport_scroll_layer_id); + host_impl_->active_tree()->BuildPropertyTreesForTesting(); host_impl_->SetViewportSize(inner_viewport_size); LayerImpl* root_clip_ptr = host_impl_->active_tree()->root_layer(); @@ -4634,26 +4640,30 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) { // the scroll doesn't bubble up to the parent layer. gfx::Size surface_size(20, 20); gfx::Size viewport_size(10, 10); - scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); - root->SetForceRenderSurface(true); + scoped_ptr<LayerImpl> root_ptr = + LayerImpl::Create(host_impl_->active_tree(), 1); + scoped_ptr<LayerImpl> root_clip = + LayerImpl::Create(host_impl_->active_tree(), 2); + root_clip->SetForceRenderSurface(true); scoped_ptr<LayerImpl> root_scrolling = - CreateScrollableLayer(2, surface_size, root.get()); + CreateScrollableLayer(3, surface_size, root_clip.get()); root_scrolling->SetIsContainerForFixedPositionLayers(true); scoped_ptr<LayerImpl> grand_child = - CreateScrollableLayer(4, surface_size, root.get()); + CreateScrollableLayer(5, surface_size, root_clip.get()); scoped_ptr<LayerImpl> child = - CreateScrollableLayer(3, surface_size, root.get()); + CreateScrollableLayer(4, surface_size, root_clip.get()); LayerImpl* grand_child_layer = grand_child.get(); child->AddChild(std::move(grand_child)); LayerImpl* child_layer = child.get(); root_scrolling->AddChild(std::move(child)); - root->AddChild(std::move(root_scrolling)); - EXPECT_EQ(viewport_size, root->bounds()); - host_impl_->active_tree()->SetRootLayer(std::move(root)); - host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 2, + root_clip->AddChild(std::move(root_scrolling)); + EXPECT_EQ(viewport_size, root_clip->bounds()); + root_ptr->AddChild(std::move(root_clip)); + host_impl_->active_tree()->SetRootLayer(std::move(root_ptr)); + host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 3, Layer::INVALID_ID); host_impl_->active_tree()->DidBecomeActive(); host_impl_->SetViewportSize(viewport_size); @@ -4674,9 +4684,12 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) { host_impl_->ProcessScrollDeltas(); // The grand child should have scrolled up to its limit. - LayerImpl* child = - host_impl_->active_tree()->root_layer()->children()[0]->children() - [0].get(); + LayerImpl* child = host_impl_->active_tree() + ->root_layer() + ->children()[0] + ->children()[0] + ->children()[0] + .get(); LayerImpl* grand_child = child->children()[0].get(); EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), grand_child->id(), gfx::Vector2d(0, -2))); @@ -4749,25 +4762,28 @@ TEST_F(LayerTreeHostImplTest, ScrollEventBubbling) { // should be applied to one of its ancestors if possible. gfx::Size surface_size(10, 10); gfx::Size content_size(20, 20); + scoped_ptr<LayerImpl> root_ptr = + LayerImpl::Create(host_impl_->active_tree(), 4); scoped_ptr<LayerImpl> root_clip = LayerImpl::Create(host_impl_->active_tree(), 3); root_clip->SetForceRenderSurface(true); - scoped_ptr<LayerImpl> root = + scoped_ptr<LayerImpl> root_scroll = CreateScrollableLayer(1, content_size, root_clip.get()); // Make 'root' the clip layer for child: since they have the same sizes the // child will have zero max_scroll_offset and scrolls will bubble. scoped_ptr<LayerImpl> child = - CreateScrollableLayer(2, content_size, root.get()); + CreateScrollableLayer(2, content_size, root_scroll.get()); child->SetIsContainerForFixedPositionLayers(true); - root->SetBounds(content_size); + root_scroll->SetBounds(content_size); - int root_scroll_id = root->id(); - root->AddChild(std::move(child)); - root_clip->AddChild(std::move(root)); + int root_scroll_id = root_scroll->id(); + root_scroll->AddChild(std::move(child)); + root_clip->AddChild(std::move(root_scroll)); + root_ptr->AddChild(std::move(root_clip)); host_impl_->SetViewportSize(surface_size); - host_impl_->active_tree()->SetRootLayer(std::move(root_clip)); - host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 3, 2, + host_impl_->active_tree()->SetRootLayer(std::move(root_ptr)); + host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 4, 2, Layer::INVALID_ID); host_impl_->active_tree()->DidBecomeActive(); DrawFrame(); @@ -4790,15 +4806,18 @@ TEST_F(LayerTreeHostImplTest, ScrollEventBubbling) { TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) { gfx::Size surface_size(10, 10); - scoped_ptr<LayerImpl> root_clip = + scoped_ptr<LayerImpl> root_ptr = LayerImpl::Create(host_impl_->active_tree(), 1); + scoped_ptr<LayerImpl> root_clip = + LayerImpl::Create(host_impl_->active_tree(), 2); scoped_ptr<LayerImpl> root_scroll = - CreateScrollableLayer(2, surface_size, root_clip.get()); + CreateScrollableLayer(3, surface_size, root_clip.get()); root_scroll->SetIsContainerForFixedPositionLayers(true); root_clip->SetForceRenderSurface(true); root_clip->AddChild(std::move(root_scroll)); - host_impl_->active_tree()->SetRootLayer(std::move(root_clip)); - host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 2, + root_ptr->AddChild(std::move(root_clip)); + host_impl_->active_tree()->SetRootLayer(std::move(root_ptr)); + host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 1, 3, Layer::INVALID_ID); host_impl_->active_tree()->DidBecomeActive(); host_impl_->SetViewportSize(surface_size); @@ -4807,15 +4826,18 @@ TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) { // synchronization. DrawFrame(); host_impl_->active_tree()->DetachLayerTree(); + scoped_ptr<LayerImpl> root_ptr2 = + LayerImpl::Create(host_impl_->active_tree(), 4); scoped_ptr<LayerImpl> root_clip2 = - LayerImpl::Create(host_impl_->active_tree(), 3); + LayerImpl::Create(host_impl_->active_tree(), 5); scoped_ptr<LayerImpl> root_scroll2 = - CreateScrollableLayer(4, surface_size, root_clip2.get()); + CreateScrollableLayer(6, surface_size, root_clip2.get()); root_scroll2->SetIsContainerForFixedPositionLayers(true); root_clip2->AddChild(std::move(root_scroll2)); root_clip2->SetForceRenderSurface(true); - host_impl_->active_tree()->SetRootLayer(std::move(root_clip2)); - host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 3, 4, + root_ptr2->AddChild(std::move(root_clip2)); + host_impl_->active_tree()->SetRootLayer(std::move(root_ptr2)); + host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 4, 6, Layer::INVALID_ID); host_impl_->active_tree()->DidBecomeActive(); @@ -5220,6 +5242,7 @@ TEST_F(LayerTreeHostImplTest, RootLayerScrollOffsetDelegation) { host_impl_->CreatePendingTree(); host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); CreateScrollAndContentsLayers(host_impl_->pending_tree(), new_size); + host_impl_->pending_tree()->BuildPropertyTreesForTesting(); host_impl_->ActivateSyncTree(); EXPECT_EQ(gfx::SizeF(new_size), scroll_watcher.scrollable_size()); @@ -7213,23 +7236,26 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldNotBubble) { // bubble). gfx::Size surface_size(10, 10); gfx::Size content_size(20, 20); + scoped_ptr<LayerImpl> root_ptr = + LayerImpl::Create(host_impl_->active_tree(), 4); scoped_ptr<LayerImpl> root_clip = LayerImpl::Create(host_impl_->active_tree(), 3); root_clip->SetForceRenderSurface(true); - scoped_ptr<LayerImpl> root = + scoped_ptr<LayerImpl> root_scroll = CreateScrollableLayer(1, content_size, root_clip.get()); - root->SetIsContainerForFixedPositionLayers(true); + root_scroll->SetIsContainerForFixedPositionLayers(true); scoped_ptr<LayerImpl> child = CreateScrollableLayer(2, content_size, root_clip.get()); - root->AddChild(std::move(child)); - int root_id = root->id(); - root_clip->AddChild(std::move(root)); + root_scroll->AddChild(std::move(child)); + int root_id = root_scroll->id(); + root_clip->AddChild(std::move(root_scroll)); + root_ptr->AddChild(std::move(root_clip)); host_impl_->SetViewportSize(surface_size); - host_impl_->active_tree()->SetRootLayer(std::move(root_clip)); - host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 3, 1, + host_impl_->active_tree()->SetRootLayer(std::move(root_ptr)); + host_impl_->active_tree()->SetViewportLayersFromIds(Layer::INVALID_ID, 4, 1, Layer::INVALID_ID); host_impl_->active_tree()->DidBecomeActive(); DrawFrame(); diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 6974c92..4a4246a 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -5188,12 +5188,15 @@ class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest { scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(500, 500)); + scoped_refptr<Layer> clip = Layer::Create(layer_settings()); + clip->SetBounds(gfx::Size(500, 500)); scoped_refptr<Layer> pinch = Layer::Create(layer_settings()); pinch->SetBounds(gfx::Size(500, 500)); - pinch->SetScrollClipLayerId(root->id()); + pinch->SetScrollClipLayerId(clip->id()); pinch->SetIsContainerForFixedPositionLayers(true); - root->AddChild(pinch); + clip->AddChild(pinch); + root->AddChild(clip); scoped_ptr<FakeDisplayListRecordingSource> recording( new FakeDisplayListRecordingSource); @@ -5489,12 +5492,15 @@ class LayerTreeHostTestContinuousDrawWhenCreatingVisibleTiles scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(500, 500)); + scoped_refptr<Layer> clip = Layer::Create(layer_settings()); + clip->SetBounds(gfx::Size(500, 500)); scoped_refptr<Layer> pinch = Layer::Create(layer_settings()); pinch->SetBounds(gfx::Size(500, 500)); - pinch->SetScrollClipLayerId(root->id()); + pinch->SetScrollClipLayerId(clip->id()); pinch->SetIsContainerForFixedPositionLayers(true); - root->AddChild(pinch); + clip->AddChild(pinch); + root->AddChild(clip); scoped_ptr<FakeDisplayListRecordingSource> recording( new FakeDisplayListRecordingSource); @@ -5512,7 +5518,7 @@ class LayerTreeHostTestContinuousDrawWhenCreatingVisibleTiles layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); layer_tree_host()->SetRootLayer(root); LayerTreeHostTest::SetupTree(); - client_.set_bounds(root->bounds()); + client_.set_bounds(clip->bounds()); } // Returns the delta scale of all quads in the frame's root pass from their diff --git a/cc/trees/layer_tree_host_unittest_picture.cc b/cc/trees/layer_tree_host_unittest_picture.cc index 8dec586..4a1a641 100644 --- a/cc/trees/layer_tree_host_unittest_picture.cc +++ b/cc/trees/layer_tree_host_unittest_picture.cc @@ -402,12 +402,15 @@ class LayerTreeHostPictureTestRSLLMembershipWithScale void SetupTree() override { scoped_refptr<Layer> root = Layer::Create(layer_settings()); root->SetBounds(gfx::Size(100, 100)); + scoped_refptr<Layer> clip = Layer::Create(layer_settings()); + clip->SetBounds(gfx::Size(100, 100)); pinch_ = Layer::Create(layer_settings()); pinch_->SetBounds(gfx::Size(500, 500)); - pinch_->SetScrollClipLayerId(root->id()); + pinch_->SetScrollClipLayerId(clip->id()); pinch_->SetIsContainerForFixedPositionLayers(true); - root->AddChild(pinch_); + clip->AddChild(pinch_); + root->AddChild(clip); // Don't be solid color so the layer has tilings/tiles. client_.set_fill_with_nonsolid_color(true); @@ -436,7 +439,7 @@ class LayerTreeHostPictureTestRSLLMembershipWithScale void WillActivateTreeOnThread(LayerTreeHostImpl* impl) override { LayerImpl* root = impl->sync_tree()->root_layer(); - LayerImpl* pinch = root->children()[0].get(); + LayerImpl* pinch = root->children()[0]->children()[0].get(); LayerImpl* gchild = pinch->children()[0].get(); FakePictureLayerImpl* picture = static_cast<FakePictureLayerImpl*>(gchild); ready_to_draw_ = false; @@ -463,7 +466,7 @@ class LayerTreeHostPictureTestRSLLMembershipWithScale void DrawLayersOnThread(LayerTreeHostImpl* impl) override { LayerImpl* root = impl->active_tree()->root_layer(); - LayerImpl* pinch = root->children()[0].get(); + LayerImpl* pinch = root->children()[0]->children()[0].get(); LayerImpl* gchild = pinch->children()[0].get(); FakePictureLayerImpl* picture = static_cast<FakePictureLayerImpl*>(gchild); diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc index d7f8c32..380a0c2 100644 --- a/cc/trees/layer_tree_host_unittest_scroll.cc +++ b/cc/trees/layer_tree_host_unittest_scroll.cc @@ -80,7 +80,7 @@ class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest { LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); EXPECT_VECTOR_EQ(gfx::Vector2d(), scroll_layer->ScrollDelta()); - scroll_layer->SetScrollClipLayer(root->id()); + scroll_layer->SetScrollClipLayer(root->children()[0]->id()); scroll_layer->SetBounds( gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100)); scroll_layer->ScrollBy(scroll_amount_); @@ -1011,7 +1011,7 @@ class LayerTreeHostScrollTestScrollZeroMaxScrollOffset void DrawLayersOnThread(LayerTreeHostImpl* impl) override { LayerImpl* root = impl->active_tree()->root_layer(); LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); - scroll_layer->SetScrollClipLayer(root->id()); + scroll_layer->SetScrollClipLayer(root->children()[0]->id()); // Set max_scroll_offset = (100, 100). scroll_layer->SetBounds( |