diff options
Diffstat (limited to 'cc/trees')
-rw-r--r-- | cc/trees/layer_tree_host_common_unittest.cc | 60 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl_unittest.cc | 243 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_animation.cc | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_animation_timelines.cc | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_scroll.cc | 186 | ||||
-rw-r--r-- | cc/trees/layer_tree_impl.cc | 6 | ||||
-rw-r--r-- | cc/trees/property_tree.cc | 29 | ||||
-rw-r--r-- | cc/trees/property_tree.h | 5 | ||||
-rw-r--r-- | cc/trees/property_tree_builder.cc | 3 |
10 files changed, 380 insertions, 158 deletions
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc index cb78047..c0786df 100644 --- a/cc/trees/layer_tree_host_common_unittest.cc +++ b/cc/trees/layer_tree_host_common_unittest.cc @@ -345,12 +345,15 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { gfx::Size(scroll_layer->bounds().width() + kMaxScrollOffset.x(), scroll_layer->bounds().height() + kMaxScrollOffset.y())); scroll_layer->SetScrollClipLayer(clip_layer->id()); - scroll_layer->SetScrollDelta(kScrollDelta); + SetScrollOffsetDelta(scroll_layer, kScrollDelta); gfx::Transform impl_transform; scroll_layer->AddChild(std::move(sublayer_scoped_ptr)); LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get(); clip_layer->AddChild(std::move(scroll_layer_scoped_ptr)); - scroll_layer_raw_ptr->PushScrollOffsetFromMainThread(kScrollOffset); + scroll_layer_raw_ptr->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer_raw_ptr->id(), + kScrollOffset); scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), @@ -7113,7 +7116,9 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, &task_graph_runner); host_impl.CreatePendingTree(); - scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); + scoped_ptr<LayerImpl> root_ptr = + LayerImpl::Create(host_impl.active_tree(), 1); + LayerImpl* root = root_ptr.get(); scoped_ptr<LayerImpl> container = LayerImpl::Create(host_impl.active_tree(), 2); LayerImpl* container_layer = container.get(); @@ -7136,7 +7141,7 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { container_transform.Translate3d(10.0, 20.0, 0.0); gfx::Vector2dF container_offset = container_transform.To2dTranslation(); - SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), + SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), true, false, true); SetLayerPropertiesForTesting(container.get(), container_transform, @@ -7159,14 +7164,20 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { // Rounded to integers already. { + root->layer_tree_impl()->SetRootLayer(std::move(root_ptr)); + root->layer_tree_impl()->BuildPropertyTreesForTesting(); + gfx::Vector2dF scroll_delta(3.0, 5.0); - scroll_layer->SetScrollDelta(scroll_delta); + SetScrollOffsetDelta(scroll_layer, scroll_delta); LayerImplList render_surface_layer_list; root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list, + root, root->bounds(), &render_surface_layer_list, root->layer_tree_impl()->current_render_surface_list_id()); + root->layer_tree_impl() + ->property_trees() + ->transform_tree.set_source_to_parent_updates_allowed(false); LayerTreeHostCommon::CalculateDrawProperties(&inputs); EXPECT_TRANSFORMATION_MATRIX_EQ( @@ -7182,15 +7193,17 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { // Scroll delta requiring rounding. { + root->layer_tree_impl()->BuildPropertyTreesForTesting(); + gfx::Vector2dF scroll_delta(4.1f, 8.1f); - scroll_layer->SetScrollDelta(scroll_delta); + SetScrollOffsetDelta(scroll_layer, scroll_delta); gfx::Vector2dF rounded_scroll_delta(4.f, 8.f); LayerImplList render_surface_layer_list; root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list, + root, root->bounds(), &render_surface_layer_list, root->layer_tree_impl()->current_render_surface_list_id()); LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -7207,21 +7220,20 @@ TEST_F(LayerTreeHostCommonTest, ScrollCompensationWithRounding) { // Scale is applied earlier in the tree. { + SetScrollOffsetDelta(scroll_layer, gfx::Vector2dF()); gfx::Transform scaled_container_transform = container_transform; scaled_container_transform.Scale3d(2.0, 2.0, 1.0); container_layer->SetTransform(scaled_container_transform); root->layer_tree_impl()->property_trees()->needs_rebuild = true; - root->layer_tree_impl() - ->property_trees() - ->transform_tree.set_source_to_parent_updates_allowed(true); + root->layer_tree_impl()->BuildPropertyTreesForTesting(); gfx::Vector2dF scroll_delta(4.5f, 8.5f); - scroll_layer->SetScrollDelta(scroll_delta); + SetScrollOffsetDelta(scroll_layer, scroll_delta); LayerImplList render_surface_layer_list; root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list, + root, root->bounds(), &render_surface_layer_list, root->layer_tree_impl()->current_render_surface_list_id()); LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -7252,7 +7264,9 @@ TEST_F(LayerTreeHostCommonTest, FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, &task_graph_runner); host_impl.CreatePendingTree(); - scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl.active_tree(), 1); + scoped_ptr<LayerImpl> root_ptr = + LayerImpl::Create(host_impl.active_tree(), 1); + LayerImpl* root = root_ptr.get(); scoped_ptr<LayerImpl> container = LayerImpl::Create(host_impl.active_tree(), 2); LayerImpl* container_layer = container.get(); @@ -7278,7 +7292,7 @@ TEST_F(LayerTreeHostCommonTest, container_transform.Translate3d(10.0, 20.0, 0.0); gfx::Vector2dF container_offset = container_transform.To2dTranslation(); - SetLayerPropertiesForTesting(root.get(), identity_transform, gfx::Point3F(), + SetLayerPropertiesForTesting(root, identity_transform, gfx::Point3F(), gfx::PointF(), gfx::Size(50, 50), true, false, true); SetLayerPropertiesForTesting(container.get(), container_transform, @@ -7296,18 +7310,26 @@ TEST_F(LayerTreeHostCommonTest, SetLayerPropertiesForTesting(fixed.get(), identity_transform, gfx::Point3F(), gfx::PointF(3.0f, 4.0f), gfx::Size(50, 50), true, false, false); - scroll_layer->PushScrollOffsetFromMainThread(scroll_offset); - scroll_layer->SetScrollDelta(scroll_delta); + scroll_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(), + scroll_offset); + scroll_layer->SetScrollCompensationAdjustment(main_scroll_fractional_part); scroller->AddChild(std::move(fixed)); container->AddChild(std::move(scroller)); root->AddChild(std::move(container)); + root->layer_tree_impl()->SetRootLayer(std::move(root_ptr)); + root->layer_tree_impl()->BuildPropertyTreesForTesting(); + + SetScrollOffsetDelta(scroll_layer, scroll_delta); + LayerImplList render_surface_layer_list; root->layer_tree_impl()->IncrementRenderSurfaceListIdForTesting(); LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( - root.get(), root->bounds(), &render_surface_layer_list, + root, root->bounds(), &render_surface_layer_list, root->layer_tree_impl()->current_render_surface_list_id()); LayerTreeHostCommon::CalculateDrawProperties(&inputs); @@ -7380,7 +7402,7 @@ TEST_F(LayerTreeHostCommonTest, end_operations); } gfx::Vector2dF scroll_delta(5.f, 9.f); - scroller->SetScrollDelta(scroll_delta); + SetScrollOffsetDelta(scroller, scroll_delta); ExecuteCalculateDrawProperties(root); diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index adf570b..19febba 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -255,6 +255,7 @@ LayerTreeHostImpl::LayerTreeHostImpl( active_tree_ = LayerTreeImpl::create(this, new SyncedProperty<ScaleGroup>(), new SyncedTopControls, new SyncedElasticOverscroll); + active_tree_->property_trees()->is_active = true; viewport_ = Viewport::Create(this); @@ -1209,6 +1210,7 @@ void LayerTreeHostImpl::ResetTreesForTesting() { LayerTreeImpl::create(this, active_tree()->page_scale_factor(), active_tree()->top_controls_shown_ratio(), active_tree()->elastic_overscroll()); + active_tree_->property_trees()->is_active = true; if (pending_tree_) pending_tree_->DetachLayerTree(); pending_tree_ = nullptr; diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 8ecfcdf..46b98cf 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -227,8 +227,18 @@ class LayerTreeHostImplTest : public testing::Test, host_impl_->active_tree()->SetRootLayer(std::move(root)); } + static gfx::Vector2dF ScrollDelta(LayerImpl* layer_impl) { + if (layer_impl->IsActive()) + return gfx::Vector2dF(layer_impl->synced_scroll_offset()->Delta().x(), + layer_impl->synced_scroll_offset()->Delta().y()); + else + return gfx::Vector2dF( + layer_impl->synced_scroll_offset()->PendingDelta().get().x(), + layer_impl->synced_scroll_offset()->PendingDelta().get().y()); + } + static void ExpectClearedScrollDeltasRecursive(LayerImpl* layer) { - ASSERT_EQ(layer->ScrollDelta(), gfx::Vector2d()); + ASSERT_EQ(ScrollDelta(layer), gfx::Vector2d()); for (size_t i = 0; i < layer->children().size(); ++i) ExpectClearedScrollDeltasRecursive(layer->children()[i].get()); } @@ -289,7 +299,10 @@ class LayerTreeHostImplTest : public testing::Test, scoped_ptr<LayerImpl> inner_scroll = LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); inner_scroll->SetIsContainerForFixedPositionLayers(true); - inner_scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); + inner_scroll->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(inner_scroll->id(), + gfx::ScrollOffset()); scoped_ptr<LayerImpl> inner_clip = LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); @@ -311,7 +324,10 @@ class LayerTreeHostImplTest : public testing::Test, scoped_ptr<LayerImpl> outer_scroll = LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); outer_scroll->SetScrollClipLayer(outer_clip->id()); - outer_scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); + outer_scroll->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), + gfx::ScrollOffset()); outer_scroll->SetBounds(content_size); outer_scroll->SetPosition(gfx::PointF()); @@ -459,6 +475,13 @@ class LayerTreeHostImplTest : public testing::Test, host_impl_->DidDrawAllLayers(frame_data); } + static void SetScrollOffsetDelta(LayerImpl* layer_impl, + const gfx::Vector2dF& delta) { + layer_impl->SetCurrentScrollOffset( + layer_impl->synced_scroll_offset()->ActiveBase() + + gfx::ScrollOffset(delta)); + } + FakeImplTaskRunnerProvider task_runner_provider_; DebugScopedSetMainThreadBlocked always_main_thread_blocked_; @@ -600,7 +623,10 @@ TEST_F(LayerTreeHostImplTest, ScrollDeltaRepeatedScrolls) { root_clip->AddChild(std::move(root)); root_layer->SetBounds(gfx::Size(110, 110)); root_layer->SetScrollClipLayer(root_clip->id()); - root_layer->PushScrollOffsetFromMainThread(scroll_offset); + root_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(root_layer->id(), + scroll_offset); host_impl_->active_tree()->SetRootLayer(std::move(root_clip)); host_impl_->active_tree()->BuildPropertyTreesForTesting(); root_layer->ScrollBy(scroll_delta); @@ -1118,7 +1144,7 @@ TEST_F(LayerTreeHostImplTest, ScrollVerticallyByPageReturnsCorrectValue) { EXPECT_TRUE(host_impl_->ScrollVerticallyByPage( gfx::Point(), SCROLL_FORWARD)); EXPECT_FLOAT_EQ(875.f, - host_impl_->InnerViewportScrollLayer()->ScrollDelta().y()); + ScrollDelta(host_impl_->InnerViewportScrollLayer()).y()); EXPECT_TRUE(host_impl_->ScrollVerticallyByPage( gfx::Point(), SCROLL_BACKWARD)); } @@ -1132,7 +1158,10 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) { LayerImpl* overflow = scroll_layer->children()[0].get(); overflow->SetBounds(overflow_size); overflow->SetScrollClipLayer(scroll_layer->parent()->parent()->id()); - overflow->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); + overflow->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(overflow->id(), + gfx::ScrollOffset()); overflow->SetPosition(gfx::PointF()); SetNeedsRebuildPropertyTrees(); @@ -1478,7 +1507,7 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoom) { host_impl_->active_tree()->PushPageScaleFromMainThread( page_scale_factor, min_page_scale, max_page_scale); host_impl_->active_tree()->SetPageScaleOnActiveTree(page_scale_factor); - scroll_layer->SetScrollDelta(gfx::Vector2d()); + SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); float page_scale_delta = 2.f; @@ -1507,7 +1536,7 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoom) { host_impl_->active_tree()->PushPageScaleFromMainThread( page_scale_factor, min_page_scale, max_page_scale); host_impl_->active_tree()->SetPageScaleOnActiveTree(page_scale_factor); - scroll_layer->SetScrollDelta(gfx::Vector2d()); + SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); float page_scale_delta = 2.f; host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), @@ -1746,8 +1775,8 @@ TEST_F(LayerTreeHostImplTest, PinchZoomSnapsToScreenEdge) { // Reset. host_impl_->active_tree()->SetPageScaleOnActiveTree(1.f); - host_impl_->InnerViewportScrollLayer()->SetScrollDelta(gfx::Vector2d()); - host_impl_->OuterViewportScrollLayer()->SetScrollDelta(gfx::Vector2d()); + SetScrollOffsetDelta(host_impl_->InnerViewportScrollLayer(), gfx::Vector2d()); + SetScrollOffsetDelta(host_impl_->OuterViewportScrollLayer(), gfx::Vector2d()); // Pinch in within the margins. The scroll should stay exactly locked to the // top and left. @@ -1764,8 +1793,8 @@ TEST_F(LayerTreeHostImplTest, PinchZoomSnapsToScreenEdge) { // Reset. host_impl_->active_tree()->SetPageScaleOnActiveTree(1.f); - host_impl_->InnerViewportScrollLayer()->SetScrollDelta(gfx::Vector2d()); - host_impl_->OuterViewportScrollLayer()->SetScrollDelta(gfx::Vector2d()); + SetScrollOffsetDelta(host_impl_->InnerViewportScrollLayer(), gfx::Vector2d()); + SetScrollOffsetDelta(host_impl_->OuterViewportScrollLayer(), gfx::Vector2d()); // Pinch in just outside the margin. There should be no snapping. offsetFromEdge = Viewport::kPinchZoomSnapMarginDips; @@ -1782,8 +1811,8 @@ TEST_F(LayerTreeHostImplTest, PinchZoomSnapsToScreenEdge) { // Reset. host_impl_->active_tree()->SetPageScaleOnActiveTree(1.f); - host_impl_->InnerViewportScrollLayer()->SetScrollDelta(gfx::Vector2d()); - host_impl_->OuterViewportScrollLayer()->SetScrollDelta(gfx::Vector2d()); + SetScrollOffsetDelta(host_impl_->InnerViewportScrollLayer(), gfx::Vector2d()); + SetScrollOffsetDelta(host_impl_->OuterViewportScrollLayer(), gfx::Vector2d()); // Pinch in just outside the margin. There should be no snapping. offsetFromEdge = Viewport::kPinchZoomSnapMarginDips; @@ -1991,7 +2020,7 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) { { host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, max_page_scale); - scroll_layer->SetScrollDelta(gfx::Vector2d()); + SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); float page_scale_delta = 2.f; host_impl_->ScrollBegin(BeginState(gfx::Point(50, 50)).get(), @@ -2013,7 +2042,7 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) { { host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, max_page_scale); - scroll_layer->SetScrollDelta(gfx::Vector2d()); + SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); float page_scale_delta = 10.f; host_impl_->ScrollBegin(BeginState(gfx::Point(50, 50)).get(), @@ -2032,9 +2061,12 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) { { host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, max_page_scale); - scroll_layer->SetScrollDelta(gfx::Vector2d()); + SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); scroll_layer->synced_scroll_offset()->PullDeltaForMainThread(); - scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); + scroll_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting( + scroll_layer->id(), gfx::ScrollOffset(50, 50)); float page_scale_delta = 0.1f; host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), @@ -2055,9 +2087,12 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) { { host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, max_page_scale); - scroll_layer->SetScrollDelta(gfx::Vector2d()); + SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); scroll_layer->synced_scroll_offset()->PullDeltaForMainThread(); - scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(20, 20)); + scroll_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting( + scroll_layer->id(), gfx::ScrollOffset(20, 20)); float page_scale_delta = 1.f; host_impl_->ScrollBegin(BeginState(gfx::Point(10, 10)).get(), @@ -2078,9 +2113,12 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) { { host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, max_page_scale); - scroll_layer->SetScrollDelta(gfx::Vector2d()); + SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); scroll_layer->synced_scroll_offset()->PullDeltaForMainThread(); - scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(20, 20)); + scroll_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting( + scroll_layer->id(), gfx::ScrollOffset(20, 20)); float page_scale_delta = 1.f; host_impl_->ScrollBegin(BeginState(gfx::Point(10, 10)).get(), @@ -2103,9 +2141,12 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) { // Two-finger panning should work when starting fully zoomed out. { host_impl_->active_tree()->PushPageScaleFromMainThread(0.5f, 0.5f, 4.f); - scroll_layer->SetScrollDelta(gfx::Vector2d()); + SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); scroll_layer->synced_scroll_offset()->PullDeltaForMainThread(); - scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 0)); + scroll_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(), + gfx::ScrollOffset(0, 0)); host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(), InputHandler::GESTURE); @@ -2153,7 +2194,10 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimation) { { host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, max_page_scale); - scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); + scroll_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting( + scroll_layer->id(), gfx::ScrollOffset(50, 50)); did_request_redraw_ = false; did_request_next_frame_ = false; @@ -2210,7 +2254,10 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimation) { { host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, max_page_scale); - scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); + scroll_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting( + scroll_layer->id(), gfx::ScrollOffset(50, 50)); did_request_redraw_ = false; did_request_next_frame_ = false; @@ -2276,7 +2323,10 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimationNoOp) { { host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, max_page_scale); - scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); + scroll_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting( + scroll_layer->id(), gfx::ScrollOffset(50, 50)); host_impl_->active_tree()->SetPendingPageScaleAnimation( scoped_ptr<PendingPageScaleAnimation>(new PendingPageScaleAnimation( @@ -2339,7 +2389,10 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimationTransferedOnSyncTreeActivate) { BeginFrameArgs begin_frame_args = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); - scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); + scroll_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(), + gfx::ScrollOffset(50, 50)); // Make sure TakePageScaleAnimation works properly. @@ -2451,7 +2504,10 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimationCompletedNotification) { CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.5f, 4.f); - scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); + scroll_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(), + gfx::ScrollOffset(50, 50)); did_complete_page_scale_animation_ = false; host_impl_->active_tree()->SetPendingPageScaleAnimation( @@ -2661,8 +2717,12 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest { // Setting the scroll offset outside a scroll should also cause the // scrollbar to appear and to schedule a scrollbar animation. - host_impl_->InnerViewportScrollLayer()->PushScrollOffsetFromMainThread( - gfx::ScrollOffset(5, 5)); + if (host_impl_->active_tree() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting( + host_impl_->InnerViewportScrollLayer()->id(), + gfx::ScrollOffset(5, 5))) + host_impl_->InnerViewportScrollLayer()->DidUpdateScrollOffset(); EXPECT_FALSE(did_request_next_frame_); EXPECT_FALSE(did_request_redraw_); EXPECT_EQ(base::TimeDelta::FromMilliseconds(20), @@ -3692,7 +3752,10 @@ TEST_F(LayerTreeHostImplTest, ClampingAfterActivation) { host_impl_->active_tree()->OuterViewportScrollLayer(); LayerImpl* pending_outer_layer = host_impl_->pending_tree()->OuterViewportScrollLayer(); - pending_outer_layer->PushScrollOffsetFromMainThread(pending_scroll); + pending_outer_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(pending_outer_layer->id(), + pending_scroll); host_impl_->ActivateSyncTree(); // Scrolloffsets on the active tree will be clamped after activation. @@ -4073,7 +4136,7 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollableSublayer) { child->SetIsContainerForFixedPositionLayers(true); // scroll child to limit - child->SetScrollDelta(gfx::Vector2dF(0, 100.f)); + SetScrollOffsetDelta(child.get(), gfx::Vector2dF(0, 100.f)); child_clip->AddChild(std::move(child)); outer_viewport_scroll_layer->AddChild(std::move(child_clip)); @@ -4233,8 +4296,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsViewportOffsetClamping) { LayerImpl* inner_scroll = host_impl_->InnerViewportScrollLayer(); // Scroll the viewports to max scroll offset. - outer_scroll->SetScrollDelta(gfx::Vector2dF(0, 200.f)); - inner_scroll->SetScrollDelta(gfx::Vector2dF(100, 100.f)); + SetScrollOffsetDelta(outer_scroll, gfx::Vector2dF(0, 200.f)); + SetScrollOffsetDelta(inner_scroll, gfx::Vector2dF(100, 100.f)); gfx::ScrollOffset viewport_offset = host_impl_->active_tree()->TotalScrollOffset(); @@ -4282,8 +4345,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsViewportOffsetClamping) { host_impl_->active_tree()->TotalScrollOffset()); // Scroll the viewports to max scroll offset. - outer_scroll->SetScrollDelta(gfx::Vector2dF(0, 200.f)); - inner_scroll->SetScrollDelta(gfx::Vector2dF(100, 100.f)); + SetScrollOffsetDelta(outer_scroll, gfx::Vector2dF(0, 200.f)); + SetScrollOffsetDelta(inner_scroll, gfx::Vector2dF(100, 100.f)); EXPECT_EQ(host_impl_->active_tree()->TotalMaxScrollOffset(), host_impl_->active_tree()->TotalScrollOffset()); } @@ -4371,8 +4434,10 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) { // Position the viewports such that the inner viewport will be scrolled. gfx::Vector2dF inner_viewport_offset(0.f, 25.f); - host_impl_->OuterViewportScrollLayer()->SetScrollDelta(gfx::Vector2dF()); - host_impl_->InnerViewportScrollLayer()->SetScrollDelta(inner_viewport_offset); + SetScrollOffsetDelta(host_impl_->OuterViewportScrollLayer(), + gfx::Vector2dF()); + SetScrollOffsetDelta(host_impl_->InnerViewportScrollLayer(), + inner_viewport_offset); scroll_delta = gfx::Vector2dF(0.f, -65.f); EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, @@ -4385,7 +4450,7 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) { host_impl_->top_controls_manager()->ContentTopOffset()); EXPECT_FLOAT_EQ( inner_viewport_offset.y() + (scroll_delta.y() + top_controls_height_), - host_impl_->InnerViewportScrollLayer()->ScrollDelta().y()); + ScrollDelta(host_impl_->InnerViewportScrollLayer()).y()); host_impl_->ScrollEnd(EndState().get()); } @@ -4810,8 +4875,14 @@ TEST_F(LayerTreeHostImplTest, ScrollChildBeyondLimit) { host_impl_->active_tree()->SetRootLayer(std::move(root)); host_impl_->active_tree()->DidBecomeActive(); host_impl_->SetViewportSize(surface_size); - grand_child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 5)); - child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(3, 0)); + grand_child_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(grand_child_layer->id(), + gfx::ScrollOffset(0, 5)); + child_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(child_layer->id(), + gfx::ScrollOffset(3, 0)); SetNeedsRebuildPropertyTrees(); DrawFrame(); @@ -4872,8 +4943,14 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) { host_impl_->active_tree()->DidBecomeActive(); host_impl_->SetViewportSize(viewport_size); - grand_child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 2)); - child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 3)); + grand_child_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(grand_child_layer->id(), + gfx::ScrollOffset(0, 2)); + child_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(child_layer->id(), + gfx::ScrollOffset(0, 3)); SetNeedsRebuildPropertyTrees(); DrawFrame(); @@ -5092,7 +5169,7 @@ TEST_F(LayerTreeHostImplTest, ScrollAxisAlignedRotatedLayer) { gfx::Vector2d(0, gesture_scroll_delta.x()))); // Reset and scroll down with the wheel. - scroll_layer->SetScrollDelta(gfx::Vector2dF()); + SetScrollOffsetDelta(scroll_layer, gfx::Vector2dF()); gfx::Vector2d wheel_scroll_delta(0, 10); EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), @@ -5166,7 +5243,7 @@ TEST_F(LayerTreeHostImplTest, ScrollNonAxisAlignedRotatedLayer) { } { // Now reset and scroll the same amount horizontally. - child_ptr->SetScrollDelta(gfx::Vector2dF()); + SetScrollOffsetDelta(child_ptr, gfx::Vector2dF()); gfx::Vector2d gesture_scroll_delta(10, 0); EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, host_impl_->ScrollBegin(BeginState(gfx::Point(1, 1)).get(), @@ -5247,7 +5324,7 @@ TEST_F(LayerTreeHostImplTest, ScrollPerspectiveTransformedLayer) { // where the previous scroll ended, but the scroll position is reset // for each scroll. for (int i = 0; i < 4; ++i) { - child_ptr->SetScrollDelta(gfx::Vector2dF()); + SetScrollOffsetDelta(child_ptr, gfx::Vector2dF()); DrawFrame(); EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, host_impl_->ScrollBegin(BeginState(viewport_point).get(), @@ -5299,7 +5376,7 @@ TEST_F(LayerTreeHostImplTest, ScrollScaledLayer) { gfx::Vector2d(0, scroll_delta.y() / scale))); // Reset and scroll down with the wheel. - scroll_layer->SetScrollDelta(gfx::Vector2dF()); + SetScrollOffsetDelta(scroll_layer, gfx::Vector2dF()); gfx::Vector2d wheel_scroll_delta(0, 10); EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), @@ -5407,8 +5484,11 @@ TEST_F(LayerTreeHostImplTest, RootLayerScrollOffsetDelegation) { host_impl_->BindToClient(&scroll_watcher); gfx::Vector2dF initial_scroll_delta(10.f, 10.f); - scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); - scroll_layer->SetScrollDelta(initial_scroll_delta); + scroll_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(), + gfx::ScrollOffset()); + SetScrollOffsetDelta(scroll_layer, initial_scroll_delta); EXPECT_EQ(gfx::ScrollOffset(), scroll_watcher.last_set_scroll_offset()); @@ -5679,8 +5759,14 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) { LayerImpl* child_layer = child.get(); root->AddChild(std::move(child)); root_clip->AddChild(std::move(root)); - child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 3)); - grand_child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 2)); + child_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(child_layer->id(), + gfx::ScrollOffset(0, 3)); + grand_child_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(grand_child_layer->id(), + gfx::ScrollOffset(0, 2)); host_impl_->active_tree()->SetRootLayer(std::move(root_clip)); host_impl_->active_tree()->DidBecomeActive(); host_impl_->SetViewportSize(surface_size); @@ -7214,7 +7300,10 @@ TEST_F(LayerTreeHostImplTest, FarAwayQuadsDontNeedAA) { gfx::ScrollOffset scroll_offset(100000, 0); scrolling_layer->SetScrollClipLayer(root->id()); - scrolling_layer->PushScrollOffsetFromMainThread(scroll_offset); + scrolling_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(scrolling_layer->id(), + scroll_offset); host_impl_->pending_tree()->BuildPropertyTreesForTesting(); host_impl_->ActivateSyncTree(); @@ -7615,11 +7704,17 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldContinueScrollingCurrentLayer) { scoped_ptr<LayerImpl> grand_child = CreateScrollableLayer(4, surface_size, root.get()); - grand_child->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 2)); + grand_child->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(grand_child->id(), + gfx::ScrollOffset(0, 2)); scoped_ptr<LayerImpl> child = CreateScrollableLayer(3, surface_size, root.get()); - child->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 4)); + child->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(child->id(), + gfx::ScrollOffset(0, 4)); child->AddChild(std::move(grand_child)); root_scrolling->AddChild(std::move(child)); @@ -8173,8 +8268,11 @@ class LayerTreeHostImplWithTopControlsTest : public LayerTreeHostImplTest { const int LayerTreeHostImplWithTopControlsTest::top_controls_height_ = 50; TEST_F(LayerTreeHostImplWithTopControlsTest, NoIdleAnimations) { - SetupScrollAndContentsLayers(gfx::Size(100, 100)) - ->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 10)); + LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100)); + scroll_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(), + gfx::ScrollOffset(0, 10)); BeginFrameArgs begin_frame_args = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE); host_impl_->WillBeginImplFrame(begin_frame_args); @@ -8209,8 +8307,11 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, } TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationScheduling) { - SetupScrollAndContentsLayers(gfx::Size(100, 100)) - ->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 10)); + LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100)); + scroll_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(scroll_layer->id(), + gfx::ScrollOffset(0, 10)); host_impl_->DidChangeTopControlsPosition(); EXPECT_TRUE(did_request_next_frame_); EXPECT_TRUE(did_request_redraw_); @@ -8407,8 +8508,10 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) { host_impl_->top_controls_manager()->UpdateTopControlsState( BOTH, SHOWN, false); float initial_scroll_offset = 50; - scroll_layer->PushScrollOffsetFromMainThread( - gfx::ScrollOffset(0, initial_scroll_offset)); + scroll_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting( + scroll_layer->id(), gfx::ScrollOffset(0, initial_scroll_offset)); DrawFrame(); EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, @@ -8478,8 +8581,10 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, host_impl_->top_controls_manager()->UpdateTopControlsState(BOTH, SHOWN, false); float initial_scroll_offset = 50; - scroll_layer->PushScrollOffsetFromMainThread( - gfx::ScrollOffset(0, initial_scroll_offset)); + scroll_layer->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting( + scroll_layer->id(), gfx::ScrollOffset(0, initial_scroll_offset)); DrawFrame(); EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD, @@ -8631,7 +8736,10 @@ class LayerTreeHostImplVirtualViewportTest : public LayerTreeHostImplTest { scoped_ptr<LayerImpl> inner_scroll = LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); inner_scroll->SetIsContainerForFixedPositionLayers(true); - inner_scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); + inner_scroll->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(inner_scroll->id(), + gfx::ScrollOffset()); scoped_ptr<LayerImpl> inner_clip = LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); @@ -8652,7 +8760,10 @@ class LayerTreeHostImplVirtualViewportTest : public LayerTreeHostImplTest { scoped_ptr<LayerImpl> outer_scroll = LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); outer_scroll->SetScrollClipLayer(outer_clip->id()); - outer_scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); + outer_scroll->layer_tree_impl() + ->property_trees() + ->scroll_tree.UpdateScrollOffsetBaseForTesting(outer_scroll->id(), + gfx::ScrollOffset()); outer_scroll->SetBounds(content_size); outer_scroll->SetPosition(gfx::PointF()); @@ -9752,7 +9863,7 @@ TEST_F(LayerTreeHostImplTest, WheelScrollWithPageScaleFactorOnInnerLayer) { host_impl_->active_tree()->PushPageScaleFromMainThread( page_scale_factor, min_page_scale, max_page_scale); host_impl_->active_tree()->SetPageScaleOnActiveTree(page_scale_factor); - scroll_layer->SetScrollDelta(gfx::Vector2d()); + SetScrollOffsetDelta(scroll_layer, gfx::Vector2d()); float page_scale_delta = 2.f; host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc index 5d9bcbf..0503aa3 100644 --- a/cc/trees/layer_tree_host_unittest_animation.cc +++ b/cc/trees/layer_tree_host_unittest_animation.cc @@ -772,7 +772,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationRemoval // Block activation until the running animation has a chance to produce a // scroll delta. - gfx::Vector2dF scroll_delta = scroll_layer_impl->ScrollDelta(); + gfx::Vector2dF scroll_delta = ScrollDelta(scroll_layer_impl); if (scroll_delta.x() < 1.f || scroll_delta.y() < 1.f) return; diff --git a/cc/trees/layer_tree_host_unittest_animation_timelines.cc b/cc/trees/layer_tree_host_unittest_animation_timelines.cc index b5593b1..1bd2696 100644 --- a/cc/trees/layer_tree_host_unittest_animation_timelines.cc +++ b/cc/trees/layer_tree_host_unittest_animation_timelines.cc @@ -677,7 +677,7 @@ class LayerTreeHostTimelinesTestScrollOffsetAnimationRemoval // Block activation until the running animation has a chance to produce a // scroll delta. - gfx::Vector2dF scroll_delta = scroll_layer_impl->ScrollDelta(); + gfx::Vector2dF scroll_delta = ScrollDelta(scroll_layer_impl); if (scroll_delta.x() < 1.f || scroll_delta.y() < 1.f) return; diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc index c3dc752..4df2e0b 100644 --- a/cc/trees/layer_tree_host_unittest_scroll.cc +++ b/cc/trees/layer_tree_host_unittest_scroll.cc @@ -56,6 +56,10 @@ scoped_ptr<ScrollState> EndState() { return scroll_state; } +static ScrollTree* ScrollTreeForLayer(LayerImpl* layer_impl) { + return &layer_impl->layer_tree_impl()->property_trees()->scroll_tree; +} + class LayerTreeHostScrollTest : public LayerTreeTest { protected: void SetupTree() override { @@ -106,7 +110,7 @@ class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest { void DrawLayersOnThread(LayerTreeHostImpl* impl) override { LayerImpl* root = impl->active_tree()->root_layer(); LayerImpl* scroll_layer = impl->OuterViewportScrollLayer(); - EXPECT_VECTOR_EQ(gfx::Vector2d(), scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(scroll_layer)); scroll_layer->SetScrollClipLayer(root->children()[0]->id()); scroll_layer->SetBounds( @@ -115,13 +119,17 @@ class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest { switch (impl->active_tree()->source_frame_number()) { case 0: - EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->BaseScrollOffset()); - EXPECT_VECTOR_EQ(scroll_amount_, scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ(initial_scroll_, ScrollTreeForLayer(scroll_layer) + ->GetScrollOffsetBaseForTesting( + scroll_layer->id())); + EXPECT_VECTOR_EQ(scroll_amount_, ScrollDelta(scroll_layer)); PostSetNeedsCommitToMainThread(); break; case 1: - EXPECT_VECTOR_EQ(second_scroll_, scroll_layer->BaseScrollOffset()); - EXPECT_VECTOR_EQ(scroll_amount_, scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ(second_scroll_, ScrollTreeForLayer(scroll_layer) + ->GetScrollOffsetBaseForTesting( + scroll_layer->id())); + EXPECT_VECTOR_EQ(scroll_amount_, ScrollDelta(scroll_layer)); EndTest(); break; } @@ -183,26 +191,27 @@ class LayerTreeHostScrollTestScrollMultipleRedraw if (impl->active_tree()->source_frame_number() == 0 && impl->SourceAnimationFrameNumberForTesting() == 1) { // First draw after first commit. - EXPECT_VECTOR_EQ(gfx::Vector2d(), scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(scroll_layer)); scroll_layer->ScrollBy(scroll_amount_); - EXPECT_VECTOR_EQ(scroll_amount_, scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ(scroll_amount_, ScrollDelta(scroll_layer)); - EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->BaseScrollOffset()); + EXPECT_VECTOR_EQ(initial_scroll_, + ScrollTreeForLayer(scroll_layer) + ->GetScrollOffsetBaseForTesting(scroll_layer->id())); PostSetNeedsRedrawToMainThread(); } else if (impl->active_tree()->source_frame_number() == 0 && impl->SourceAnimationFrameNumberForTesting() == 2) { // Second draw after first commit. - EXPECT_EQ(scroll_layer->ScrollDelta(), scroll_amount_); + EXPECT_EQ(ScrollDelta(scroll_layer), scroll_amount_); scroll_layer->ScrollBy(scroll_amount_); EXPECT_VECTOR_EQ(scroll_amount_ + scroll_amount_, - scroll_layer->ScrollDelta()); + ScrollDelta(scroll_layer)); EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer_->scroll_offset()); PostSetNeedsCommitToMainThread(); } else if (impl->active_tree()->source_frame_number() == 1) { // Third or later draw after second commit. EXPECT_GE(impl->SourceAnimationFrameNumberForTesting(), 3u); - EXPECT_VECTOR_EQ(gfx::Vector2d(), scroll_layer_->ScrollDelta()); EXPECT_VECTOR_EQ( gfx::ScrollOffsetWithDelta(initial_scroll_, scroll_amount_ + scroll_amount_), @@ -328,10 +337,12 @@ class LayerTreeHostScrollTestScrollAbortedCommit if (impl->active_tree()->source_frame_number() == 0 && impl->SourceAnimationFrameNumberForTesting() == 1) { // First draw - EXPECT_VECTOR_EQ(gfx::Vector2d(), root_scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(root_scroll_layer)); root_scroll_layer->ScrollBy(impl_scroll_); - EXPECT_VECTOR_EQ(impl_scroll_, root_scroll_layer->ScrollDelta()); - EXPECT_VECTOR_EQ(initial_scroll_, root_scroll_layer->BaseScrollOffset()); + EXPECT_VECTOR_EQ(impl_scroll_, ScrollDelta(root_scroll_layer)); + EXPECT_VECTOR_EQ(initial_scroll_, ScrollTreeForLayer(root_scroll_layer) + ->GetScrollOffsetBaseForTesting( + root_scroll_layer->id())); EXPECT_EQ(1.f, impl->active_tree()->page_scale_delta()); EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); @@ -346,12 +357,13 @@ class LayerTreeHostScrollTestScrollAbortedCommit // Test a second draw after an aborted commit. // The scroll/scale values should be baked into the offset/scale factor // since the main thread consumed but aborted the begin frame. - EXPECT_VECTOR_EQ(gfx::Vector2d(), root_scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(root_scroll_layer)); root_scroll_layer->ScrollBy(impl_scroll_); - EXPECT_VECTOR_EQ(impl_scroll_, root_scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ(impl_scroll_, ScrollDelta(root_scroll_layer)); EXPECT_VECTOR_EQ( gfx::ScrollOffsetWithDelta(initial_scroll_, impl_scroll_), - root_scroll_layer->BaseScrollOffset()); + ScrollTreeForLayer(root_scroll_layer) + ->GetScrollOffsetBaseForTesting(root_scroll_layer->id())); EXPECT_EQ(1.f, impl->active_tree()->page_scale_delta()); EXPECT_EQ(impl_scale_, impl->active_tree()->current_page_scale_factor()); @@ -367,21 +379,25 @@ class LayerTreeHostScrollTestScrollAbortedCommit } else if (impl->active_tree()->source_frame_number() == 2 && impl->SourceAnimationFrameNumberForTesting() == 3) { // Third draw after the second full commit. - EXPECT_EQ(root_scroll_layer->ScrollDelta(), gfx::Vector2d()); + EXPECT_EQ(ScrollDelta(root_scroll_layer), gfx::Vector2d()); root_scroll_layer->ScrollBy(impl_scroll_); impl->SetNeedsCommit(); - EXPECT_VECTOR_EQ(impl_scroll_, root_scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ(impl_scroll_, ScrollDelta(root_scroll_layer)); gfx::Vector2dF delta = impl_scroll_ + impl_scroll_ + second_main_scroll_; - EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(initial_scroll_, delta), - root_scroll_layer->BaseScrollOffset()); + EXPECT_VECTOR_EQ( + gfx::ScrollOffsetWithDelta(initial_scroll_, delta), + ScrollTreeForLayer(root_scroll_layer) + ->GetScrollOffsetBaseForTesting(root_scroll_layer->id())); } else if (impl->active_tree()->source_frame_number() == 2 && impl->SourceAnimationFrameNumberForTesting() == 4) { // Final draw after the second aborted commit. - EXPECT_VECTOR_EQ(gfx::Vector2d(), root_scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(root_scroll_layer)); gfx::Vector2dF delta = impl_scroll_ + impl_scroll_ + impl_scroll_ + second_main_scroll_; - EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(initial_scroll_, delta), - root_scroll_layer->BaseScrollOffset()); + EXPECT_VECTOR_EQ( + gfx::ScrollOffsetWithDelta(initial_scroll_, delta), + ScrollTreeForLayer(root_scroll_layer) + ->GetScrollOffsetBaseForTesting(root_scroll_layer->id())); EndTest(); } else { // Commit for source frame 3 is aborted. @@ -441,24 +457,30 @@ class LayerTreeHostScrollTestFractionalScroll : public LayerTreeHostScrollTest { // multiple commits. switch (impl->active_tree()->source_frame_number()) { case 0: - EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), scroll_layer->BaseScrollOffset()); - EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ( + gfx::Vector2d(0, 0), + ScrollTreeForLayer(scroll_layer) + ->GetScrollOffsetBaseForTesting(scroll_layer->id())); + EXPECT_VECTOR_EQ(gfx::Vector2d(0, 0), ScrollDelta(scroll_layer)); PostSetNeedsCommitToMainThread(); break; case 1: - EXPECT_VECTOR_EQ(gfx::ToFlooredVector2d(scroll_amount_), - scroll_layer->BaseScrollOffset()); + EXPECT_VECTOR_EQ( + gfx::ToFlooredVector2d(scroll_amount_), + ScrollTreeForLayer(scroll_layer) + ->GetScrollOffsetBaseForTesting(scroll_layer->id())); EXPECT_VECTOR_EQ(gfx::Vector2dF(fmod(scroll_amount_.x(), 1.0f), 0.0f), - scroll_layer->ScrollDelta()); + ScrollDelta(scroll_layer)); PostSetNeedsCommitToMainThread(); break; case 2: EXPECT_VECTOR_EQ( gfx::ToFlooredVector2d(scroll_amount_ + scroll_amount_), - scroll_layer->BaseScrollOffset()); + ScrollTreeForLayer(scroll_layer) + ->GetScrollOffsetBaseForTesting(scroll_layer->id())); EXPECT_VECTOR_EQ( gfx::Vector2dF(fmod(2.0f * scroll_amount_.x(), 1.0f), 0.0f), - scroll_layer->ScrollDelta()); + ScrollDelta(scroll_layer)); EndTest(); break; } @@ -605,9 +627,9 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { expected_no_scroll_layer_impl = child_layer_impl; } - EXPECT_VECTOR_EQ(gfx::Vector2d(), inner_scroll->ScrollDelta()); + EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(inner_scroll)); EXPECT_VECTOR_EQ(gfx::Vector2d(), - expected_no_scroll_layer_impl->ScrollDelta()); + ScrollDelta(expected_no_scroll_layer_impl)); // Ensure device scale factor matches the active tree. EXPECT_EQ(device_scale_factor_, impl->active_tree()->device_scale_factor()); @@ -631,9 +653,11 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { // Check the scroll is applied as a delta. EXPECT_VECTOR_EQ(initial_offset_, - expected_scroll_layer_impl->BaseScrollOffset()); + ScrollTreeForLayer(expected_scroll_layer_impl) + ->GetScrollOffsetBaseForTesting( + expected_scroll_layer_impl->id())); EXPECT_VECTOR_EQ(scroll_amount_, - expected_scroll_layer_impl->ScrollDelta()); + ScrollDelta(expected_scroll_layer_impl)); break; } case 1: { @@ -649,18 +673,22 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { // Check the scroll is applied as a delta. EXPECT_VECTOR_EQ(javascript_scroll_, - expected_scroll_layer_impl->BaseScrollOffset()); + ScrollTreeForLayer(expected_scroll_layer_impl) + ->GetScrollOffsetBaseForTesting( + expected_scroll_layer_impl->id())); EXPECT_VECTOR_EQ(scroll_amount_, - expected_scroll_layer_impl->ScrollDelta()); + ScrollDelta(expected_scroll_layer_impl)); break; } case 2: EXPECT_VECTOR_EQ( gfx::ScrollOffsetWithDelta(javascript_scroll_, scroll_amount_), - expected_scroll_layer_impl->BaseScrollOffset()); + ScrollTreeForLayer(expected_scroll_layer_impl) + ->GetScrollOffsetBaseForTesting( + expected_scroll_layer_impl->id())); EXPECT_VECTOR_EQ(gfx::Vector2d(), - expected_scroll_layer_impl->ScrollDelta()); + ScrollDelta(expected_scroll_layer_impl)); EndTest(); break; @@ -838,11 +866,13 @@ class LayerTreeHostScrollTestSimple : public LayerTreeHostScrollTest { case 0: if (!impl->pending_tree()) { impl->BlockNotifyReadyToActivateForTesting(true); - EXPECT_VECTOR_EQ(gfx::Vector2d(), scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(scroll_layer)); scroll_layer->ScrollBy(impl_thread_scroll1_); - EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->BaseScrollOffset()); - EXPECT_VECTOR_EQ(impl_thread_scroll1_, scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ(initial_scroll_, ScrollTreeForLayer(scroll_layer) + ->GetScrollOffsetBaseForTesting( + scroll_layer->id())); + EXPECT_VECTOR_EQ(impl_thread_scroll1_, ScrollDelta(scroll_layer)); PostSetNeedsCommitToMainThread(); // CommitCompleteOnThread will trigger this function again @@ -853,18 +883,21 @@ class LayerTreeHostScrollTestSimple : public LayerTreeHostScrollTest { EXPECT_EQ(impl->pending_tree()->source_frame_number(), 1); scroll_layer->ScrollBy(impl_thread_scroll2_); - EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->BaseScrollOffset()); + EXPECT_VECTOR_EQ(initial_scroll_, ScrollTreeForLayer(scroll_layer) + ->GetScrollOffsetBaseForTesting( + scroll_layer->id())); EXPECT_VECTOR_EQ(impl_thread_scroll1_ + impl_thread_scroll2_, - scroll_layer->ScrollDelta()); + ScrollDelta(scroll_layer)); LayerImpl* pending_scroll_layer = impl->pending_tree()->OuterViewportScrollLayer(); EXPECT_VECTOR_EQ( gfx::ScrollOffsetWithDelta( initial_scroll_, main_thread_scroll_ + impl_thread_scroll1_), - pending_scroll_layer->BaseScrollOffset()); + ScrollTreeForLayer(pending_scroll_layer) + ->GetScrollOffsetBaseForTesting(pending_scroll_layer->id())); EXPECT_VECTOR_EQ(impl_thread_scroll2_, - pending_scroll_layer->ScrollDelta()); + ScrollDelta(pending_scroll_layer)); } break; case 1: @@ -872,8 +905,9 @@ class LayerTreeHostScrollTestSimple : public LayerTreeHostScrollTest { EXPECT_VECTOR_EQ( gfx::ScrollOffsetWithDelta( initial_scroll_, main_thread_scroll_ + impl_thread_scroll1_), - scroll_layer->BaseScrollOffset()); - EXPECT_VECTOR_EQ(impl_thread_scroll2_, scroll_layer->ScrollDelta()); + ScrollTreeForLayer(scroll_layer) + ->GetScrollOffsetBaseForTesting(scroll_layer->id())); + EXPECT_VECTOR_EQ(impl_thread_scroll2_, ScrollDelta(scroll_layer)); EndTest(); break; } @@ -961,30 +995,36 @@ class LayerTreeHostScrollTestImplOnlyScroll : public LayerTreeHostScrollTest { ASSERT_TRUE(pending_scroll_layer); switch (impl->pending_tree()->source_frame_number()) { case 0: - EXPECT_VECTOR_EQ(initial_scroll_, - pending_scroll_layer->BaseScrollOffset()); - EXPECT_VECTOR_EQ(gfx::Vector2d(), pending_scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ( + initial_scroll_, + ScrollTreeForLayer(pending_scroll_layer) + ->GetScrollOffsetBaseForTesting(pending_scroll_layer->id())); + EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(pending_scroll_layer)); EXPECT_FALSE(active_root); break; case 1: // Even though the scroll happened during the commit, both layers // should have the appropriate scroll delta. - EXPECT_VECTOR_EQ(initial_scroll_, - pending_scroll_layer->BaseScrollOffset()); + EXPECT_VECTOR_EQ( + initial_scroll_, + ScrollTreeForLayer(pending_scroll_layer) + ->GetScrollOffsetBaseForTesting(pending_scroll_layer->id())); EXPECT_VECTOR_EQ(impl_thread_scroll_, - pending_scroll_layer->ScrollDelta()); + ScrollDelta(pending_scroll_layer)); ASSERT_TRUE(active_root); - EXPECT_VECTOR_EQ(initial_scroll_, - active_scroll_layer->BaseScrollOffset()); - EXPECT_VECTOR_EQ(impl_thread_scroll_, - active_scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ( + initial_scroll_, + ScrollTreeForLayer(active_scroll_layer) + ->GetScrollOffsetBaseForTesting(active_scroll_layer->id())); + EXPECT_VECTOR_EQ(impl_thread_scroll_, ScrollDelta(active_scroll_layer)); break; case 2: // On the next commit, this delta should have been sent and applied. EXPECT_VECTOR_EQ( gfx::ScrollOffsetWithDelta(initial_scroll_, impl_thread_scroll_), - pending_scroll_layer->BaseScrollOffset()); - EXPECT_VECTOR_EQ(gfx::Vector2d(), pending_scroll_layer->ScrollDelta()); + ScrollTreeForLayer(pending_scroll_layer) + ->GetScrollOffsetBaseForTesting(pending_scroll_layer->id())); + EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(pending_scroll_layer)); break; } } @@ -997,15 +1037,19 @@ class LayerTreeHostScrollTestImplOnlyScroll : public LayerTreeHostScrollTest { switch (impl->active_tree()->source_frame_number()) { case 0: - EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->BaseScrollOffset()); - EXPECT_VECTOR_EQ(gfx::Vector2d(), scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ(initial_scroll_, ScrollTreeForLayer(scroll_layer) + ->GetScrollOffsetBaseForTesting( + scroll_layer->id())); + EXPECT_VECTOR_EQ(gfx::Vector2d(), ScrollDelta(scroll_layer)); EXPECT_EQ(1.f, impl->active_tree()->page_scale_delta()); EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); PostSetNeedsCommitToMainThread(); break; case 1: - EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->BaseScrollOffset()); - EXPECT_VECTOR_EQ(impl_thread_scroll_, scroll_layer->ScrollDelta()); + EXPECT_VECTOR_EQ(initial_scroll_, ScrollTreeForLayer(scroll_layer) + ->GetScrollOffsetBaseForTesting( + scroll_layer->id())); + EXPECT_VECTOR_EQ(impl_thread_scroll_, ScrollDelta(scroll_layer)); EXPECT_EQ(impl_scale_, impl->active_tree()->page_scale_delta()); EXPECT_EQ(impl_scale_, impl->active_tree()->current_page_scale_factor()); @@ -1313,9 +1357,10 @@ class LayerTreeHostScrollTestLayerStructureChange LayerImpl* root = impl->OuterViewportScrollLayer(); switch (impl->active_tree()->source_frame_number()) { case 0: - root->child_at(0)->SetScrollDelta(gfx::Vector2dF(5, 5)); - root->child_at(0)->child_at(0)->SetScrollDelta(gfx::Vector2dF(5, 5)); - root->child_at(1)->SetScrollDelta(gfx::Vector2dF(5, 5)); + SetScrollOffsetDelta(root->child_at(0), gfx::Vector2dF(5, 5)); + SetScrollOffsetDelta(root->child_at(0)->child_at(0), + gfx::Vector2dF(5, 5)); + SetScrollOffsetDelta(root->child_at(1), gfx::Vector2dF(5, 5)); PostSetNeedsCommitToMainThread(); break; case 1: @@ -1363,6 +1408,13 @@ class LayerTreeHostScrollTestLayerStructureChange return scroll_layer.get(); } + static void SetScrollOffsetDelta(LayerImpl* layer_impl, + const gfx::Vector2dF& delta) { + layer_impl->SetCurrentScrollOffset( + layer_impl->synced_scroll_offset()->ActiveBase() + + gfx::ScrollOffset(delta)); + } + FakeLayerScrollClient root_scroll_layer_client_; FakeLayerScrollClient sibling_scroll_layer_client_; FakeLayerScrollClient child_scroll_layer_client_; diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index 87fe6cf..e9f11da 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc @@ -81,7 +81,9 @@ LayerTreeImpl::LayerTreeImpl( event_listener_properties_(), top_controls_shrink_blink_size_(false), top_controls_height_(0), - top_controls_shown_ratio_(top_controls_shown_ratio) {} + top_controls_shown_ratio_(top_controls_shown_ratio) { + property_trees()->is_main_thread = false; +} LayerTreeImpl::~LayerTreeImpl() { BreakSwapPromises(IsActiveTree() ? SwapPromise::SWAP_FAILS @@ -909,6 +911,7 @@ bool LayerTreeImpl::UpdateDrawProperties(bool update_lcd_text) { void LayerTreeImpl::BuildPropertyTreesForTesting() { LayerTreeHostCommon::PreCalculateMetaInformationForTesting(root_layer_.get()); + property_trees_.transform_tree.set_source_to_parent_updates_allowed(true); PropertyTreeBuilder::BuildPropertyTrees( root_layer_.get(), PageScaleLayer(), InnerViewportScrollLayer(), OuterViewportScrollLayer(), OverscrollElasticityLayer(), @@ -916,6 +919,7 @@ void LayerTreeImpl::BuildPropertyTreesForTesting() { current_page_scale_factor(), device_scale_factor(), gfx::Rect(DrawViewportSize()), layer_tree_host_impl_->DrawTransform(), &property_trees_); + property_trees_.transform_tree.set_source_to_parent_updates_allowed(false); } void LayerTreeImpl::IncrementRenderSurfaceListIdForTesting() { diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc index 4738e01..34f8c49 100644 --- a/cc/trees/property_tree.cc +++ b/cc/trees/property_tree.cc @@ -1487,6 +1487,14 @@ SyncedScrollOffset* ScrollTree::synced_scroll_offset(int layer_id) { return layer_id_to_scroll_offset_map_[layer_id].get(); } +const SyncedScrollOffset* ScrollTree::synced_scroll_offset(int layer_id) const { + if (layer_id_to_scroll_offset_map_.find(layer_id) == + layer_id_to_scroll_offset_map_.end()) { + return nullptr; + } + return layer_id_to_scroll_offset_map_.at(layer_id).get(); +} + gfx::ScrollOffset ScrollTree::PullDeltaForMainThread( SyncedScrollOffset* scroll_offset) { // TODO(miletus): Remove all this temporary flooring machinery when @@ -1593,6 +1601,27 @@ bool ScrollTree::SetScrollOffset(int layer_id, return false; } +bool ScrollTree::UpdateScrollOffsetBaseForTesting( + int layer_id, + const gfx::ScrollOffset& offset) { + DCHECK(!property_trees()->is_main_thread); + bool changed = synced_scroll_offset(layer_id)->PushFromMainThread(offset); + if (property_trees()->is_active) + changed |= synced_scroll_offset(layer_id)->PushPendingToActive(); + return changed; +} + +const gfx::ScrollOffset ScrollTree::GetScrollOffsetBaseForTesting( + int layer_id) const { + DCHECK(!property_trees()->is_main_thread); + if (synced_scroll_offset(layer_id)) + return property_trees()->is_active + ? synced_scroll_offset(layer_id)->ActiveBase() + : synced_scroll_offset(layer_id)->PendingBase(); + else + return gfx::ScrollOffset(); +} + PropertyTrees::PropertyTrees() : needs_rebuild(true), non_root_surfaces_enabled(true), diff --git a/cc/trees/property_tree.h b/cc/trees/property_tree.h index c57ad75..64226fd 100644 --- a/cc/trees/property_tree.h +++ b/cc/trees/property_tree.h @@ -576,8 +576,8 @@ class CC_EXPORT ScrollTree final : public PropertyTree<ScrollNode> { void set_currently_scrolling_node(int scroll_node_id); gfx::Transform ScreenSpaceTransform(int scroll_node_id) const; - // synced_scroll_offset is supposed to be called by Layer/LayerImpl only SyncedScrollOffset* synced_scroll_offset(int layer_id); + const SyncedScrollOffset* synced_scroll_offset(int layer_id) const; void CollectScrollDeltas(ScrollAndScaleSet* scroll_info); void UpdateScrollOffsetMap(ScrollOffsetMap* new_scroll_offset_map, LayerTreeImpl* layer_tree_impl); @@ -585,6 +585,9 @@ class CC_EXPORT ScrollTree final : public PropertyTree<ScrollNode> { const ScrollOffsetMap& scroll_offset_map() const; void ApplySentScrollDeltasFromAbortedCommit(); bool SetScrollOffset(int layer_id, const gfx::ScrollOffset& scroll_offset); + bool UpdateScrollOffsetBaseForTesting(int layer_id, + const gfx::ScrollOffset& offset); + const gfx::ScrollOffset GetScrollOffsetBaseForTesting(int layer_id) const; private: int currently_scrolling_node_id_; diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc index 14338a4..a4e8bbb 100644 --- a/cc/trees/property_tree_builder.cc +++ b/cc/trees/property_tree_builder.cc @@ -447,8 +447,7 @@ bool AddTransformNodeIfNeeded( layer->set_should_flatten_transform_from_property_tree(false); data_for_children->scroll_compensation_adjustment += - layer->ScrollDelta() + layer->ScrollCompensationAdjustment() - - node->data.scroll_snap; + layer->ScrollCompensationAdjustment() - node->data.scroll_snap; node->owner_id = layer->id(); |