diff options
author | aelias <aelias@chromium.org> | 2015-02-02 17:40:51 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-03 01:41:49 +0000 |
commit | f998da84f5813c2874d0fcc2e71b44e8d4c04314 (patch) | |
tree | 68e4a57d4cbfcebadc999e501a1fb99535debc8a | |
parent | 3b4800d42ead0f0ff9420755af741e79613d4a01 (diff) | |
download | chromium_src-f998da84f5813c2874d0fcc2e71b44e8d4c04314.zip chromium_src-f998da84f5813c2874d0fcc2e71b44e8d4c04314.tar.gz chromium_src-f998da84f5813c2874d0fcc2e71b44e8d4c04314.tar.bz2 |
Finalize rename of LayerImpl scroll offset methods.
This deletes stubs and renames all uses in tests for the following
methods that were renamed in https://codereview.chromium.org/800613009:
- LayerImpl::TotalScrollOffset was renamed to CurrentScrollOffset.
TotalScrollOffset is now a LayerTreeImpl-specific concept meaning the
sum of the inner and outer viewport current scroll offsets.
- LayerImpl::scroll_offset() was renamed to BaseScrollOffset. This is
the latest scroll offset pushed from the main thread.
- LayerImpl::SetScrollOffset() was renamed to
PushScrollOffsetFromMainThread. There are two ways to change the
scroll offset, either pushing from the main thread or directly doing
SetCurrentScrollOffset, corresponding to main-thread or impl-thread
scrolling.
BUG=
Review URL: https://codereview.chromium.org/878413005
Cr-Commit-Position: refs/heads/master@{#314238}
-rw-r--r-- | cc/layers/layer_impl.h | 8 | ||||
-rw-r--r-- | cc/layers/layer_impl_unittest.cc | 145 | ||||
-rw-r--r-- | cc/layers/picture_layer_impl_perftest.cc | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_common_unittest.cc | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl_unittest.cc | 180 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_animation.cc | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_damage.cc | 3 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_scroll.cc | 55 |
8 files changed, 199 insertions, 202 deletions
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h index 1545bb9..f46c16e 100644 --- a/cc/layers/layer_impl.h +++ b/cc/layers/layer_impl.h @@ -422,14 +422,6 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, // initial scroll gfx::Vector2dF ScrollBy(const gfx::Vector2dF& scroll); - // TODO(aelias): Delete these three methods after doing a mass rename in - // tests. - gfx::ScrollOffset TotalScrollOffset() const { return CurrentScrollOffset(); } - void SetScrollOffset(const gfx::ScrollOffset& scroll_offset) { - PushScrollOffsetFromMainThread(scroll_offset); - } - gfx::ScrollOffset scroll_offset() const { return BaseScrollOffset(); } - void SetScrollClipLayer(int scroll_clip_layer_id); LayerImpl* scroll_clip_layer() const { return scroll_clip_layer_; } bool scrollable() const { return !!scroll_clip_layer_; } diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc index c0b2aa7..0dbf356 100644 --- a/cc/layers/layer_impl_unittest.cc +++ b/cc/layers/layer_impl_unittest.cc @@ -163,8 +163,8 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) { root->SetDoubleSided(false)); // constructor initializes it to "true". EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->ScrollBy(arbitrary_vector2d)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetScrollDelta(gfx::Vector2d())); - EXECUTE_AND_VERIFY_SUBTREE_CHANGED( - root->SetScrollOffset(gfx::ScrollOffset(arbitrary_vector2d))); + EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->PushScrollOffsetFromMainThread( + gfx::ScrollOffset(arbitrary_vector2d))); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetHideLayerAndSubtree(true)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetOpacity(arbitrary_number)); EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBlendMode(arbitrary_blend_mode)); @@ -223,7 +223,8 @@ TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) { EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( root->SetScrollDelta(gfx::Vector2d())); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( - root->SetScrollOffset(gfx::ScrollOffset(arbitrary_vector2d))); + root->PushScrollOffsetFromMainThread( + gfx::ScrollOffset(arbitrary_vector2d))); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( root->SetContentBounds(arbitrary_size)); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( @@ -303,10 +304,10 @@ TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { layer->SetScrollDelta(arbitrary_vector2d)); VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( layer->SetScrollDelta(arbitrary_vector2d)); - VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( - layer->SetScrollOffset(gfx::ScrollOffset(arbitrary_vector2d))); - VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( - layer->SetScrollOffset(gfx::ScrollOffset(arbitrary_vector2d))); + VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES(layer->PushScrollOffsetFromMainThread( + gfx::ScrollOffset(arbitrary_vector2d))); + VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->PushScrollOffsetFromMainThread( + gfx::ScrollOffset(arbitrary_vector2d))); // Unrelated functions, always set to new values, always set needs update. VERIFY_NEEDS_UPDATE_DRAW_PROPERTIES( @@ -467,46 +468,46 @@ TEST_F(LayerImplScrollTest, ScrollByWithZeroOffset) { // Test that LayerImpl::ScrollBy only affects ScrollDelta and total scroll // offset is bounded by the range [0, max scroll offset]. - EXPECT_VECTOR_EQ(gfx::Vector2dF(), layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(gfx::Vector2dF(), layer()->scroll_offset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(), layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(), layer()->BaseScrollOffset()); EXPECT_VECTOR_EQ(gfx::Vector2dF(), layer()->ScrollDelta()); layer()->ScrollBy(gfx::Vector2dF(-100, 100)); - EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 80), layer()->TotalScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 80), layer()->CurrentScrollOffset()); - EXPECT_VECTOR_EQ(layer()->ScrollDelta(), layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(gfx::Vector2dF(), layer()->scroll_offset()); + EXPECT_VECTOR_EQ(layer()->ScrollDelta(), layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(), layer()->BaseScrollOffset()); layer()->ScrollBy(gfx::Vector2dF(100, -100)); - EXPECT_VECTOR_EQ(gfx::Vector2dF(50, 0), layer()->TotalScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(50, 0), layer()->CurrentScrollOffset()); - EXPECT_VECTOR_EQ(layer()->ScrollDelta(), layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(gfx::Vector2dF(), layer()->scroll_offset()); + EXPECT_VECTOR_EQ(layer()->ScrollDelta(), layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(), layer()->BaseScrollOffset()); } TEST_F(LayerImplScrollTest, ScrollByWithNonZeroOffset) { gfx::ScrollOffset scroll_offset(10, 5); - layer()->SetScrollOffset(scroll_offset); + layer()->PushScrollOffsetFromMainThread(scroll_offset); - EXPECT_VECTOR_EQ(scroll_offset, layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); EXPECT_VECTOR_EQ(gfx::Vector2dF(), layer()->ScrollDelta()); layer()->ScrollBy(gfx::Vector2dF(-100, 100)); - EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 80), layer()->TotalScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 80), layer()->CurrentScrollOffset()); - EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(scroll_offset, - layer()->ScrollDelta()), - layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + EXPECT_VECTOR_EQ( + gfx::ScrollOffsetWithDelta(scroll_offset, layer()->ScrollDelta()), + layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); layer()->ScrollBy(gfx::Vector2dF(100, -100)); - EXPECT_VECTOR_EQ(gfx::Vector2dF(50, 0), layer()->TotalScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(50, 0), layer()->CurrentScrollOffset()); - EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(scroll_offset, - layer()->ScrollDelta()), - layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + EXPECT_VECTOR_EQ( + gfx::ScrollOffsetWithDelta(scroll_offset, layer()->ScrollDelta()), + layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); } class ScrollDelegateIgnore : public LayerImpl::ScrollOffsetDelegate { @@ -535,10 +536,10 @@ class ScrollDelegateIgnore : public LayerImpl::ScrollOffsetDelegate { TEST_F(LayerImplScrollTest, ScrollByWithIgnoringDelegate) { gfx::ScrollOffset scroll_offset(10, 5); - layer()->SetScrollOffset(scroll_offset); + layer()->PushScrollOffsetFromMainThread(scroll_offset); - EXPECT_VECTOR_EQ(scroll_offset, layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); EXPECT_VECTOR_EQ(gfx::Vector2dF(), layer()->ScrollDelta()); ScrollDelegateIgnore delegate; @@ -547,24 +548,24 @@ TEST_F(LayerImplScrollTest, ScrollByWithIgnoringDelegate) { layer()->SetScrollOffsetDelegate(&delegate); layer()->RefreshFromScrollDelegate(); - EXPECT_VECTOR_EQ(fixed_offset, layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + EXPECT_VECTOR_EQ(fixed_offset, layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); layer()->ScrollBy(gfx::Vector2dF(-100, 100)); - EXPECT_VECTOR_EQ(fixed_offset, layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + EXPECT_VECTOR_EQ(fixed_offset, layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); layer()->SetScrollOffsetDelegate(nullptr); - EXPECT_VECTOR_EQ(fixed_offset, layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + EXPECT_VECTOR_EQ(fixed_offset, layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); gfx::Vector2dF scroll_delta(1, 1); layer()->ScrollBy(scroll_delta); - EXPECT_VECTOR_EQ(fixed_offset + scroll_delta, layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + EXPECT_VECTOR_EQ(fixed_offset + scroll_delta, layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); } class ScrollDelegateAccept : public LayerImpl::ScrollOffsetDelegate { @@ -584,34 +585,34 @@ class ScrollDelegateAccept : public LayerImpl::ScrollOffsetDelegate { TEST_F(LayerImplScrollTest, ScrollByWithAcceptingDelegate) { gfx::ScrollOffset scroll_offset(10, 5); - layer()->SetScrollOffset(scroll_offset); + layer()->PushScrollOffsetFromMainThread(scroll_offset); - EXPECT_VECTOR_EQ(scroll_offset, layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); EXPECT_VECTOR_EQ(gfx::Vector2dF(), layer()->ScrollDelta()); ScrollDelegateAccept delegate; layer()->SetScrollOffsetDelegate(&delegate); - EXPECT_VECTOR_EQ(scroll_offset, layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); EXPECT_VECTOR_EQ(gfx::Vector2dF(), layer()->ScrollDelta()); layer()->ScrollBy(gfx::Vector2dF(-100, 100)); - EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 80), layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 80), layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); layer()->SetScrollOffsetDelegate(nullptr); - EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 80), layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 80), layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); gfx::Vector2dF scroll_delta(1, 1); layer()->ScrollBy(scroll_delta); - EXPECT_VECTOR_EQ(gfx::Vector2dF(1, 80), layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(1, 80), layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); } TEST_F(LayerImplScrollTest, ApplySentScrollsNoDelegate) { @@ -626,17 +627,17 @@ TEST_F(LayerImplScrollTest, ApplySentScrollsNoDelegate) { gfx::ScrollOffset(scroll_delta)); EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(scroll_offset, scroll_delta), - layer()->TotalScrollOffset()); + layer()->CurrentScrollOffset()); EXPECT_VECTOR_EQ(scroll_delta, layer()->ScrollDelta()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); layer()->ApplySentScrollDeltasFromAbortedCommit(); EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(scroll_offset, scroll_delta), - layer()->TotalScrollOffset()); + layer()->CurrentScrollOffset()); EXPECT_VECTOR_EQ(scroll_delta - sent_scroll_delta, layer()->ScrollDelta()); EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(scroll_offset, sent_scroll_delta), - layer()->scroll_offset()); + layer()->BaseScrollOffset()); } TEST_F(LayerImplScrollTest, ApplySentScrollsWithIgnoringDelegate) { @@ -653,16 +654,16 @@ TEST_F(LayerImplScrollTest, ApplySentScrollsWithIgnoringDelegate) { layer()->SetScrollOffsetDelegate(&delegate); layer()->RefreshFromScrollDelegate(); - EXPECT_VECTOR_EQ(fixed_offset, layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + EXPECT_VECTOR_EQ(fixed_offset, layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); layer()->ApplySentScrollDeltasFromAbortedCommit(); EXPECT_VECTOR_EQ(fixed_offset, delegate.last_attempted_set_offset()); - EXPECT_VECTOR_EQ(fixed_offset, layer()->TotalScrollOffset()); + EXPECT_VECTOR_EQ(fixed_offset, layer()->CurrentScrollOffset()); EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(scroll_offset, sent_scroll_delta), - layer()->scroll_offset()); + layer()->BaseScrollOffset()); } TEST_F(LayerImplScrollTest, ApplySentScrollsWithAcceptingDelegate) { @@ -679,15 +680,15 @@ TEST_F(LayerImplScrollTest, ApplySentScrollsWithAcceptingDelegate) { gfx::ScrollOffset(scroll_delta)); EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(scroll_offset, scroll_delta), - layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(scroll_offset, layer()->scroll_offset()); + layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(scroll_offset, layer()->BaseScrollOffset()); layer()->ApplySentScrollDeltasFromAbortedCommit(); EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(scroll_offset, scroll_delta), - layer()->TotalScrollOffset()); + layer()->CurrentScrollOffset()); EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(scroll_offset, sent_scroll_delta), - layer()->scroll_offset()); + layer()->BaseScrollOffset()); } TEST_F(LayerImplScrollTest, ScrollUserUnscrollableLayer) { @@ -695,41 +696,41 @@ TEST_F(LayerImplScrollTest, ScrollUserUnscrollableLayer) { gfx::Vector2dF scroll_delta(20.5f, 8.5f); layer()->set_user_scrollable_vertical(false); - layer()->SetScrollOffset(scroll_offset); + layer()->PushScrollOffsetFromMainThread(scroll_offset); gfx::Vector2dF unscrolled = layer()->ScrollBy(scroll_delta); EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 8.5f), unscrolled); - EXPECT_VECTOR_EQ(gfx::Vector2dF(30.5f, 5), layer()->TotalScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(30.5f, 5), layer()->CurrentScrollOffset()); } -TEST_F(LayerImplScrollTest, PushPropertiesToMirrorsTotalScrollOffset) { +TEST_F(LayerImplScrollTest, PushPropertiesToMirrorsCurrentScrollOffset) { gfx::ScrollOffset scroll_offset(10, 5); gfx::Vector2dF scroll_delta(12, 18); host_impl().CreatePendingTree(); - layer()->SetScrollOffset(scroll_offset); + layer()->PushScrollOffsetFromMainThread(scroll_offset); gfx::Vector2dF unscrolled = layer()->ScrollBy(scroll_delta); EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 0), unscrolled); - EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->TotalScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); layer()->PullDeltaForMainThread(); scoped_ptr<LayerImpl> pending_layer = LayerImpl::Create( host_impl().sync_tree(), layer()->id(), layer()->synced_scroll_offset()); - pending_layer->SetScrollOffset(layer()->TotalScrollOffset()); + pending_layer->PushScrollOffsetFromMainThread(layer()->CurrentScrollOffset()); pending_layer->PushPropertiesTo(layer()); - EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->TotalScrollOffset()); - EXPECT_VECTOR_EQ(layer()->TotalScrollOffset(), - pending_layer->TotalScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), + pending_layer->CurrentScrollOffset()); } TEST_F(LayerImplScrollTest, SetNewScrollbarParameters) { gfx::ScrollOffset scroll_offset(10, 5); - layer()->SetScrollOffset(scroll_offset); + layer()->PushScrollOffsetFromMainThread(scroll_offset); scoped_ptr<PaintedScrollbarLayerImpl> vertical_scrollbar( PaintedScrollbarLayerImpl::Create(tree(), 100, VERTICAL)); diff --git a/cc/layers/picture_layer_impl_perftest.cc b/cc/layers/picture_layer_impl_perftest.cc index c649e69..62f4129 100644 --- a/cc/layers/picture_layer_impl_perftest.cc +++ b/cc/layers/picture_layer_impl_perftest.cc @@ -94,7 +94,7 @@ class PictureLayerImplPerfTest : public testing::Test { void RunRasterQueueConstructTest(const std::string& test_name, const gfx::Rect& viewport) { host_impl_.SetViewportSize(viewport.size()); - pending_layer_->SetScrollOffset( + pending_layer_->PushScrollOffsetFromMainThread( gfx::ScrollOffset(viewport.x(), viewport.y())); host_impl_.pending_tree()->UpdateDrawProperties(); @@ -143,7 +143,7 @@ class PictureLayerImplPerfTest : public testing::Test { void RunEvictionQueueConstructTest(const std::string& test_name, const gfx::Rect& viewport) { host_impl_.SetViewportSize(viewport.size()); - pending_layer_->SetScrollOffset( + pending_layer_->PushScrollOffsetFromMainThread( gfx::ScrollOffset(viewport.x(), viewport.y())); host_impl_.pending_tree()->UpdateDrawProperties(); diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc index 74b5011..df2b30e 100644 --- a/cc/trees/layer_tree_host_common_unittest.cc +++ b/cc/trees/layer_tree_host_common_unittest.cc @@ -348,7 +348,7 @@ TEST_F(LayerTreeHostCommonTest, TransformsAboutScrollOffset) { scroll_layer->AddChild(sublayer_scoped_ptr.Pass()); LayerImpl* scroll_layer_raw_ptr = scroll_layer_scoped_ptr.get(); clip_layer->AddChild(scroll_layer_scoped_ptr.Pass()); - scroll_layer_raw_ptr->SetScrollOffset(kScrollOffset); + scroll_layer_raw_ptr->PushScrollOffsetFromMainThread(kScrollOffset); scoped_ptr<LayerImpl> root(LayerImpl::Create(host_impl.active_tree(), 3)); SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), @@ -7819,7 +7819,7 @@ 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->SetScrollOffset(scroll_offset); + scroll_layer->PushScrollOffsetFromMainThread(scroll_offset); scroll_layer->SetScrollDelta(scroll_delta); scroll_layer->SetScrollCompensationAdjustment(main_scroll_fractional_part); diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index cc608fa..cb33686 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -238,7 +238,7 @@ class LayerTreeHostImplTest : public testing::Test, LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); LayerImpl* scroll_layer = scroll.get(); scroll->SetIsContainerForFixedPositionLayers(true); - scroll->SetScrollOffset(gfx::ScrollOffset()); + scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); scoped_ptr<LayerImpl> clip = LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); @@ -473,7 +473,7 @@ TEST_F(LayerTreeHostImplTest, ScrollDeltaRepeatedScrolls) { root_clip->AddChild(root.Pass()); root_layer->SetBounds(gfx::Size(110, 110)); root_layer->SetScrollClipLayer(root_clip->id()); - root_layer->SetScrollOffset(scroll_offset); + root_layer->PushScrollOffsetFromMainThread(scroll_offset); root_layer->ScrollBy(scroll_delta); host_impl_->active_tree()->SetRootLayer(root_clip.Pass()); } @@ -846,7 +846,7 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) { overflow->SetBounds(overflow_size); overflow->SetContentBounds(overflow_size); overflow->SetScrollClipLayer(scroll_layer->parent()->id()); - overflow->SetScrollOffset(gfx::ScrollOffset()); + overflow->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); overflow->SetPosition(gfx::PointF()); DrawFrame(); @@ -854,38 +854,38 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) { EXPECT_EQ(InputHandler::ScrollStarted, host_impl_->ScrollBegin(scroll_position, InputHandler::Wheel)); - EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->TotalScrollOffset()); - EXPECT_VECTOR_EQ(gfx::Vector2dF(), overflow->TotalScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(), overflow->CurrentScrollOffset()); gfx::Vector2dF scroll_delta(10, 10); host_impl_->ScrollBy(scroll_position, scroll_delta); host_impl_->ScrollEnd(); - EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->TotalScrollOffset()); - EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 10), overflow->TotalScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 10), overflow->CurrentScrollOffset()); overflow->set_user_scrollable_horizontal(false); EXPECT_EQ(InputHandler::ScrollStarted, host_impl_->ScrollBegin(scroll_position, InputHandler::Wheel)); - EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->TotalScrollOffset()); - EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 10), overflow->TotalScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 10), overflow->CurrentScrollOffset()); host_impl_->ScrollBy(scroll_position, scroll_delta); host_impl_->ScrollEnd(); - EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 0), scroll_layer->TotalScrollOffset()); - EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 20), overflow->TotalScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 0), scroll_layer->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 20), overflow->CurrentScrollOffset()); overflow->set_user_scrollable_vertical(false); EXPECT_EQ(InputHandler::ScrollStarted, host_impl_->ScrollBegin(scroll_position, InputHandler::Wheel)); - EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 0), scroll_layer->TotalScrollOffset()); - EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 20), overflow->TotalScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 0), scroll_layer->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 20), overflow->CurrentScrollOffset()); host_impl_->ScrollBy(scroll_position, scroll_delta); host_impl_->ScrollEnd(); - EXPECT_VECTOR_EQ(gfx::Vector2dF(20, 10), scroll_layer->TotalScrollOffset()); - EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 20), overflow->TotalScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(20, 10), scroll_layer->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 20), overflow->CurrentScrollOffset()); } TEST_F(LayerTreeHostImplTest, ImplPinchZoom) { @@ -1030,7 +1030,7 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) { max_page_scale); scroll_layer->SetScrollDelta(gfx::Vector2d()); scroll_layer->PullDeltaForMainThread(); - scroll_layer->SetScrollOffset(gfx::ScrollOffset(50, 50)); + scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); float page_scale_delta = 0.1f; host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture); @@ -1052,7 +1052,7 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) { max_page_scale); scroll_layer->SetScrollDelta(gfx::Vector2d()); scroll_layer->PullDeltaForMainThread(); - scroll_layer->SetScrollOffset(gfx::ScrollOffset(20, 20)); + scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(20, 20)); float page_scale_delta = 1.f; host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::Gesture); @@ -1074,7 +1074,7 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) { max_page_scale); scroll_layer->SetScrollDelta(gfx::Vector2d()); scroll_layer->PullDeltaForMainThread(); - scroll_layer->SetScrollOffset(gfx::ScrollOffset(20, 20)); + scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(20, 20)); float page_scale_delta = 1.f; host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::Gesture); @@ -1096,7 +1096,7 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) { host_impl_->active_tree()->PushPageScaleFromMainThread(0.5f, 0.5f, 4.f); scroll_layer->SetScrollDelta(gfx::Vector2d()); scroll_layer->PullDeltaForMainThread(); - scroll_layer->SetScrollOffset(gfx::ScrollOffset(0, 0)); + scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 0)); host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::Gesture); host_impl_->PinchGestureBegin(); @@ -1134,7 +1134,7 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimation) { { host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, max_page_scale); - scroll_layer->SetScrollOffset(gfx::ScrollOffset(50, 50)); + scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); did_request_redraw_ = false; did_request_animate_ = false; @@ -1177,7 +1177,7 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimation) { { host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, max_page_scale); - scroll_layer->SetScrollOffset(gfx::ScrollOffset(50, 50)); + scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); did_request_redraw_ = false; did_request_animate_ = false; @@ -1233,7 +1233,7 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimationNoOp) { { host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, min_page_scale, max_page_scale); - scroll_layer->SetScrollOffset(gfx::ScrollOffset(50, 50)); + scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); host_impl_->active_tree()->SetPendingPageScaleAnimation( scoped_ptr<PendingPageScaleAnimation>(new PendingPageScaleAnimation( @@ -1280,7 +1280,7 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimationTransferedOnSyncTreeActivate) { base::TimeTicks end_time = start_time + duration; float target_scale = 2.f; - scroll_layer->SetScrollOffset(gfx::ScrollOffset(50, 50)); + scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); // Make sure TakePageScaleAnimation works properly. @@ -1368,7 +1368,7 @@ TEST_F(LayerTreeHostImplTest, PageScaleAnimationCompletedNotification) { base::TimeTicks end_time = start_time + duration; host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.5f, 4.f); - scroll_layer->SetScrollOffset(gfx::ScrollOffset(50, 50)); + scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50)); did_complete_page_scale_animation_ = false; host_impl_->active_tree()->SetPendingPageScaleAnimation( @@ -1433,7 +1433,7 @@ class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl { scoped_ptr<LayerImpl> scroll = \ LayerImpl::Create(host_impl_->active_tree(), 2); \ scroll->SetScrollClipLayer(root->id()); \ - scroll->SetScrollOffset(gfx::ScrollOffset()); \ + scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); \ root->SetBounds(viewport_size); \ scroll->SetBounds(content_size); \ scroll->SetContentBounds(content_size); \ @@ -1505,7 +1505,7 @@ TEST_F(LayerTreeHostImplTest, ScrollbarLinearFadeScheduling) { // Setting the scroll offset outside a scroll should also cause the scrollbar // to appear and to schedule a fade. - host_impl_->InnerViewportScrollLayer()->SetScrollOffset( + host_impl_->InnerViewportScrollLayer()->PushScrollOffsetFromMainThread( gfx::ScrollOffset(5, 5)); EXPECT_LT(base::TimeDelta::FromMilliseconds(19), requested_scrollbar_animation_delay_); @@ -1602,7 +1602,7 @@ void LayerTreeHostImplTest::SetupMouseMoveAtWithDeviceScale( scoped_ptr<LayerImpl> scroll = LayerImpl::Create(host_impl_->active_tree(), 2); scroll->SetScrollClipLayer(root->id()); - scroll->SetScrollOffset(gfx::ScrollOffset()); + scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); scroll->SetBounds(content_size); scroll->SetContentBounds(content_size); scroll->SetIsContainerForFixedPositionLayers(true); @@ -2482,14 +2482,14 @@ TEST_F(LayerTreeHostImplTopControlsTest, // The viewport layers should be resized back to their full sizes. EXPECT_EQ(0.f, host_impl_->active_tree()->total_top_controls_content_offset()); - EXPECT_EQ(0.f, inner_scroll->TotalScrollOffset().y()); + EXPECT_EQ(0.f, inner_scroll->CurrentScrollOffset().y()); EXPECT_EQ(100.f, inner_container->BoundsForScrolling().height()); EXPECT_EQ(100.f, outer_container->BoundsForScrolling().height()); // The inner viewport should be scrollable by 50px * page_scale. host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, 100.f)); - EXPECT_EQ(50.f, inner_scroll->TotalScrollOffset().y()); - EXPECT_EQ(0.f, outer_scroll->TotalScrollOffset().y()); + EXPECT_EQ(50.f, inner_scroll->CurrentScrollOffset().y()); + EXPECT_EQ(0.f, outer_scroll->CurrentScrollOffset().y()); EXPECT_EQ(gfx::ScrollOffset(), outer_scroll->MaxScrollOffset()); host_impl_->ScrollEnd(); @@ -2507,24 +2507,24 @@ TEST_F(LayerTreeHostImplTopControlsTest, host_impl_->active_tree()->total_top_controls_content_offset()); EXPECT_EQ(50.f, outer_container->BoundsForScrolling().height()); EXPECT_EQ(50.f, inner_container->BoundsForScrolling().height()); - EXPECT_EQ(25.f, outer_scroll->TotalScrollOffset().y()); - EXPECT_EQ(25.f, inner_scroll->TotalScrollOffset().y()); + EXPECT_EQ(25.f, outer_scroll->CurrentScrollOffset().y()); + EXPECT_EQ(25.f, inner_scroll->CurrentScrollOffset().y()); // Now when we continue scrolling, make sure the outer viewport gets scrolled // since it wasn't scrollable when the scroll began. host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, -20.f)); - EXPECT_EQ(15.f, outer_scroll->TotalScrollOffset().y()); - EXPECT_EQ(25.f, inner_scroll->TotalScrollOffset().y()); + EXPECT_EQ(15.f, outer_scroll->CurrentScrollOffset().y()); + EXPECT_EQ(25.f, inner_scroll->CurrentScrollOffset().y()); host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, -30.f)); - EXPECT_EQ(0.f, outer_scroll->TotalScrollOffset().y()); - EXPECT_EQ(25.f, inner_scroll->TotalScrollOffset().y()); + EXPECT_EQ(0.f, outer_scroll->CurrentScrollOffset().y()); + EXPECT_EQ(25.f, inner_scroll->CurrentScrollOffset().y()); host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, -50.f)); host_impl_->ScrollEnd(); - EXPECT_EQ(0.f, outer_scroll->TotalScrollOffset().y()); - EXPECT_EQ(0.f, inner_scroll->TotalScrollOffset().y()); + EXPECT_EQ(0.f, outer_scroll->CurrentScrollOffset().y()); + EXPECT_EQ(0.f, inner_scroll->CurrentScrollOffset().y()); } // Test that the fixed position container delta is appropriately adjusted @@ -3311,8 +3311,8 @@ TEST_F(LayerTreeHostImplTest, ScrollChildBeyondLimit) { host_impl_->active_tree()->SetRootLayer(root.Pass()); host_impl_->active_tree()->DidBecomeActive(); host_impl_->SetViewportSize(surface_size); - grand_child_layer->SetScrollOffset(gfx::ScrollOffset(0, 5)); - child_layer->SetScrollOffset(gfx::ScrollOffset(3, 0)); + grand_child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 5)); + child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(3, 0)); DrawFrame(); { @@ -3365,8 +3365,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) { host_impl_->active_tree()->DidBecomeActive(); host_impl_->SetViewportSize(viewport_size); - grand_child_layer->SetScrollOffset(gfx::ScrollOffset(0, 2)); - child_layer->SetScrollOffset(gfx::ScrollOffset(0, 3)); + grand_child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 2)); + child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 3)); DrawFrame(); { @@ -3794,7 +3794,7 @@ TEST_F(LayerTreeHostImplTest, RootLayerScrollOffsetDelegation) { // Setting the delegate results in the current scroll offset being set. gfx::Vector2dF initial_scroll_delta(10.f, 10.f); - scroll_layer->SetScrollOffset(gfx::ScrollOffset()); + scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); scroll_layer->SetScrollDelta(initial_scroll_delta); host_impl_->SetRootLayerScrollOffsetDelegate(&scroll_delegate); EXPECT_EQ(initial_scroll_delta.ToString(), @@ -3868,7 +3868,7 @@ TEST_F(LayerTreeHostImplTest, RootLayerScrollOffsetDelegation) { host_impl_->SetRootLayerScrollOffsetDelegate(NULL); EXPECT_EQ(current_offset.ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); } void CheckLayerScrollDelta(LayerImpl* layer, gfx::Vector2dF scroll_delta) { @@ -4047,8 +4047,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) { LayerImpl* child_layer = child.get(); root->AddChild(child.Pass()); root_clip->AddChild(root.Pass()); - child_layer->SetScrollOffset(gfx::ScrollOffset(0, 3)); - grand_child_layer->SetScrollOffset(gfx::ScrollOffset(0, 2)); + child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 3)); + grand_child_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 2)); host_impl_->active_tree()->SetRootLayer(root_clip.Pass()); host_impl_->active_tree()->DidBecomeActive(); host_impl_->SetViewportSize(surface_size); @@ -6272,7 +6272,7 @@ TEST_F(LayerTreeHostImplTest, FarAwayQuadsDontNeedAA) { gfx::ScrollOffset scroll_offset(100000, 0); scrolling_layer->SetScrollClipLayer(root->id()); - scrolling_layer->SetScrollOffset(scroll_offset); + scrolling_layer->PushScrollOffsetFromMainThread(scroll_offset); host_impl_->ActivateSyncTree(); @@ -6800,11 +6800,11 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldLockToFirstScrolledLayer) { scoped_ptr<LayerImpl> grand_child = CreateScrollableLayer(4, surface_size, root.get()); - grand_child->SetScrollOffset(gfx::ScrollOffset(0, 2)); + grand_child->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 2)); scoped_ptr<LayerImpl> child = CreateScrollableLayer(3, surface_size, root.get()); - child->SetScrollOffset(gfx::ScrollOffset(0, 4)); + child->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 4)); child->AddChild(grand_child.Pass()); root_scrolling->AddChild(child.Pass()); @@ -7296,7 +7296,7 @@ const int LayerTreeHostImplWithTopControlsTest::top_controls_height_ = 50; TEST_F(LayerTreeHostImplWithTopControlsTest, NoIdleAnimations) { SetupScrollAndContentsLayers(gfx::Size(100, 100)) - ->SetScrollOffset(gfx::ScrollOffset(0, 10)); + ->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 10)); host_impl_->Animate(base::TimeTicks()); EXPECT_FALSE(did_request_redraw_); } @@ -7328,7 +7328,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationScheduling) { SetupScrollAndContentsLayers(gfx::Size(100, 100)) - ->SetScrollOffset(gfx::ScrollOffset(0, 10)); + ->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 10)); host_impl_->DidChangeTopControlsPosition(); EXPECT_TRUE(did_request_animate_); EXPECT_TRUE(did_request_redraw_); @@ -7345,7 +7345,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) { host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture)); EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset()); EXPECT_EQ(gfx::Vector2dF().ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); // Scroll just the top controls and verify that the scroll succeeds. const float residue = 10; @@ -7354,7 +7354,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) { host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll); EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset()); EXPECT_EQ(gfx::Vector2dF().ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); // Scroll across the boundary const float content_scroll = 20; @@ -7364,7 +7364,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) { EXPECT_EQ(-top_controls_height_, host_impl_->top_controls_manager()->ControlsTopOffset()); EXPECT_EQ(gfx::Vector2dF(0, content_scroll).ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); // Now scroll back to the top of the content offset = -content_scroll; @@ -7373,7 +7373,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) { EXPECT_EQ(-top_controls_height_, host_impl_->top_controls_manager()->ControlsTopOffset()); EXPECT_EQ(gfx::Vector2dF().ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); // And scroll the top controls completely into view offset = -top_controls_height_; @@ -7381,14 +7381,14 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) { host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll); EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset()); EXPECT_EQ(gfx::Vector2dF().ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); // And attempt to scroll past the end EXPECT_FALSE( host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll); EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset()); EXPECT_EQ(gfx::Vector2dF().ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); host_impl_->ScrollEnd(); } @@ -7404,7 +7404,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAtOrigin) { host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture)); EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset()); EXPECT_EQ(gfx::Vector2dF().ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); // Scroll the top controls partially. const float residue = 35; @@ -7413,7 +7413,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAtOrigin) { host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll); EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset()); EXPECT_EQ(gfx::Vector2dF().ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); did_request_redraw_ = false; did_request_animate_ = false; @@ -7440,7 +7440,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAtOrigin) { animation_time += base::TimeDelta::FromMilliseconds(5); host_impl_->Animate(animation_time); EXPECT_EQ(gfx::Vector2dF().ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); float new_offset = host_impl_->top_controls_manager()->ControlsTopOffset(); @@ -7466,14 +7466,15 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) { host_impl_->top_controls_manager()->UpdateTopControlsState( BOTH, SHOWN, false); float initial_scroll_offset = 50; - scroll_layer->SetScrollOffset(gfx::ScrollOffset(0, initial_scroll_offset)); + scroll_layer->PushScrollOffsetFromMainThread( + gfx::ScrollOffset(0, initial_scroll_offset)); DrawFrame(); EXPECT_EQ(InputHandler::ScrollStarted, host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture)); EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset()); EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); // Scroll the top controls partially. const float residue = 15; @@ -7482,7 +7483,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) { host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll); EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset()); EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); did_request_redraw_ = false; did_request_animate_ = false; @@ -7539,19 +7540,19 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll); EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset()); EXPECT_EQ(gfx::Vector2dF().ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); EXPECT_TRUE( host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll); EXPECT_EQ(gfx::Vector2dF(0, offset).ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); EXPECT_TRUE( host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll); // Should have fully scrolled EXPECT_EQ(gfx::Vector2dF(0, scroll_layer->MaxScrollOffset().y()).ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); float overscrollamount = 10; @@ -7560,20 +7561,20 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, overscrollamount)) .did_scroll); EXPECT_EQ(gfx::Vector2dF(0, 2 * offset).ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); EXPECT_EQ(gfx::Vector2dF(0, overscrollamount).ToString(), host_impl_->accumulated_root_overscroll().ToString()); EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -2 * offset)) .did_scroll); EXPECT_EQ(gfx::Vector2dF(0, 0).ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset()); EXPECT_TRUE( host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -offset)).did_scroll); EXPECT_EQ(gfx::Vector2dF(0, 0).ToString(), - scroll_layer->TotalScrollOffset().ToString()); + scroll_layer->CurrentScrollOffset().ToString()); // Top controls should be fully visible EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset()); @@ -7596,7 +7597,7 @@ class LayerTreeHostImplVirtualViewportTest : public LayerTreeHostImplTest { scoped_ptr<LayerImpl> inner_scroll = LayerImpl::Create(layer_tree_impl, kInnerViewportScrollLayerId); inner_scroll->SetIsContainerForFixedPositionLayers(true); - inner_scroll->SetScrollOffset(gfx::ScrollOffset()); + inner_scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); scoped_ptr<LayerImpl> inner_clip = LayerImpl::Create(layer_tree_impl, kInnerViewportClipLayerId); @@ -7618,7 +7619,7 @@ class LayerTreeHostImplVirtualViewportTest : public LayerTreeHostImplTest { scoped_ptr<LayerImpl> outer_scroll = LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); outer_scroll->SetScrollClipLayer(outer_clip->id()); - outer_scroll->SetScrollOffset(gfx::ScrollOffset()); + outer_scroll->PushScrollOffsetFromMainThread(gfx::ScrollOffset()); outer_scroll->SetBounds(content_size); outer_scroll->SetContentBounds(content_size); outer_scroll->SetPosition(gfx::PointF()); @@ -7659,8 +7660,8 @@ TEST_F(LayerTreeHostImplVirtualViewportTest, FlingScrollBubblesToInner) { { gfx::Vector2dF inner_expected; gfx::Vector2dF outer_expected; - EXPECT_VECTOR_EQ(inner_expected, inner_scroll->TotalScrollOffset()); - EXPECT_VECTOR_EQ(outer_expected, outer_scroll->TotalScrollOffset()); + EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset()); // Make sure the fling goes to the outer viewport first EXPECT_EQ(InputHandler::ScrollStarted, @@ -7673,8 +7674,8 @@ TEST_F(LayerTreeHostImplVirtualViewportTest, FlingScrollBubblesToInner) { host_impl_->ScrollEnd(); - EXPECT_VECTOR_EQ(inner_expected, inner_scroll->TotalScrollOffset()); - EXPECT_VECTOR_EQ(outer_expected, outer_scroll->TotalScrollOffset()); + EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset()); // Fling past the outer viewport boundry, make sure inner viewport scrolls. EXPECT_EQ(InputHandler::ScrollStarted, @@ -7689,8 +7690,8 @@ TEST_F(LayerTreeHostImplVirtualViewportTest, FlingScrollBubblesToInner) { host_impl_->ScrollEnd(); - EXPECT_VECTOR_EQ(inner_expected, inner_scroll->TotalScrollOffset()); - EXPECT_VECTOR_EQ(outer_expected, outer_scroll->TotalScrollOffset()); + EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset()); } } @@ -7708,8 +7709,8 @@ TEST_F(LayerTreeHostImplVirtualViewportTest, { gfx::Vector2dF inner_expected; gfx::Vector2dF outer_expected; - EXPECT_VECTOR_EQ(inner_expected, inner_scroll->TotalScrollOffset()); - EXPECT_VECTOR_EQ(outer_expected, outer_scroll->TotalScrollOffset()); + EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset()); // Make sure the scroll goes to the outer viewport first. EXPECT_EQ(InputHandler::ScrollStarted, @@ -7721,8 +7722,8 @@ TEST_F(LayerTreeHostImplVirtualViewportTest, host_impl_->ScrollBy(gfx::Point(), scroll_delta); outer_expected += scroll_delta; - EXPECT_VECTOR_EQ(inner_expected, inner_scroll->TotalScrollOffset()); - EXPECT_VECTOR_EQ(outer_expected, outer_scroll->TotalScrollOffset()); + EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset()); // Now diagonal scroll across the outer viewport boundary in a single event. // The entirety of the scroll should be consumed, as bubbling between inner @@ -7732,8 +7733,8 @@ TEST_F(LayerTreeHostImplVirtualViewportTest, inner_expected += scroll_delta; host_impl_->ScrollEnd(); - EXPECT_VECTOR_EQ(inner_expected, inner_scroll->TotalScrollOffset()); - EXPECT_VECTOR_EQ(outer_expected, outer_scroll->TotalScrollOffset()); + EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset()); + EXPECT_VECTOR_EQ(outer_expected, outer_scroll->CurrentScrollOffset()); } } @@ -7854,12 +7855,12 @@ TEST_F(LayerTreeHostImplTest, ScrollAnimated) { host_impl_->Animate(start_time); host_impl_->UpdateAnimationState(true); - EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->TotalScrollOffset()); + EXPECT_EQ(gfx::ScrollOffset(), scrolling_layer->CurrentScrollOffset()); host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(50)); host_impl_->UpdateAnimationState(true); - float y = scrolling_layer->TotalScrollOffset().y(); + float y = scrolling_layer->CurrentScrollOffset().y(); EXPECT_TRUE(y > 1 && y < 49); // Update target. @@ -7869,7 +7870,7 @@ TEST_F(LayerTreeHostImplTest, ScrollAnimated) { host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(200)); host_impl_->UpdateAnimationState(true); - y = scrolling_layer->TotalScrollOffset().y(); + y = scrolling_layer->CurrentScrollOffset().y(); EXPECT_TRUE(y > 50 && y < 100); EXPECT_EQ(scrolling_layer, host_impl_->CurrentlyScrollingLayer()); @@ -7877,7 +7878,7 @@ TEST_F(LayerTreeHostImplTest, ScrollAnimated) { host_impl_->UpdateAnimationState(true); EXPECT_VECTOR_EQ(gfx::ScrollOffset(0, 100), - scrolling_layer->TotalScrollOffset()); + scrolling_layer->CurrentScrollOffset()); EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); } @@ -8028,11 +8029,12 @@ TEST_F(LayerTreeHostImplTest, WheelScrollWithPageScaleFactorOnInnerLayer) { gfx::Vector2dF scroll_delta(0, 5); EXPECT_EQ(InputHandler::ScrollStarted, host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel)); - EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->TotalScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->CurrentScrollOffset()); host_impl_->ScrollBy(gfx::Point(), scroll_delta); host_impl_->ScrollEnd(); - EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 2.5), scroll_layer->TotalScrollOffset()); + EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 2.5), + scroll_layer->CurrentScrollOffset()); } } diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc index 7733f41..bbdfe6b 100644 --- a/cc/trees/layer_tree_host_unittest_animation.cc +++ b/cc/trees/layer_tree_host_unittest_animation.cc @@ -1103,7 +1103,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationRemoval Animation::ScrollOffset)) return; - EXPECT_EQ(final_postion_, scroll_layer_impl->TotalScrollOffset()); + EXPECT_EQ(final_postion_, scroll_layer_impl->CurrentScrollOffset()); EndTest(); } diff --git a/cc/trees/layer_tree_host_unittest_damage.cc b/cc/trees/layer_tree_host_unittest_damage.cc index d34cd4d..daff40b 100644 --- a/cc/trees/layer_tree_host_unittest_damage.cc +++ b/cc/trees/layer_tree_host_unittest_damage.cc @@ -434,7 +434,8 @@ class LayerTreeHostDamageTestScrollbarDoesDamage // Test that modifying the position of the content layer (not // scrolling) won't damage the scrollbar. scroll_layer->SetPosition(gfx::Point(1, 1)); - scroll_layer->SetScrollOffset(scroll_layer->scroll_offset()); + scroll_layer->PushScrollOffsetFromMainThread( + scroll_layer->BaseScrollOffset()); host_impl->SetNeedsRedraw(); break; case 2: diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc index e63d35f..1c20b4c 100644 --- a/cc/trees/layer_tree_host_unittest_scroll.cc +++ b/cc/trees/layer_tree_host_unittest_scroll.cc @@ -77,12 +77,12 @@ class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest { switch (impl->active_tree()->source_frame_number()) { case 0: - EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->scroll_offset()); + EXPECT_VECTOR_EQ(initial_scroll_, scroll_layer->BaseScrollOffset()); EXPECT_VECTOR_EQ(scroll_amount_, scroll_layer->ScrollDelta()); PostSetNeedsCommitToMainThread(); break; case 1: - EXPECT_VECTOR_EQ(scroll_layer->scroll_offset(), second_scroll_); + EXPECT_VECTOR_EQ(scroll_layer->BaseScrollOffset(), second_scroll_); EXPECT_VECTOR_EQ(scroll_layer->ScrollDelta(), scroll_amount_); EndTest(); break; @@ -157,7 +157,7 @@ class LayerTreeHostScrollTestScrollMultipleRedraw scroll_layer->ScrollBy(scroll_amount_); EXPECT_VECTOR_EQ(scroll_layer->ScrollDelta(), scroll_amount_); - EXPECT_VECTOR_EQ(scroll_layer->scroll_offset(), initial_scroll_); + EXPECT_VECTOR_EQ(scroll_layer->BaseScrollOffset(), initial_scroll_); PostSetNeedsRedrawToMainThread(); } else if (impl->active_tree()->source_frame_number() == 0 && impl->SourceAnimationFrameNumber() == 2) { @@ -303,7 +303,7 @@ class LayerTreeHostScrollTestScrollAbortedCommit EXPECT_VECTOR_EQ(root_scroll_layer->ScrollDelta(), gfx::Vector2d()); root_scroll_layer->ScrollBy(impl_scroll_); EXPECT_VECTOR_EQ(root_scroll_layer->ScrollDelta(), impl_scroll_); - EXPECT_VECTOR_EQ(root_scroll_layer->scroll_offset(), initial_scroll_); + EXPECT_VECTOR_EQ(root_scroll_layer->BaseScrollOffset(), initial_scroll_); EXPECT_EQ(1.f, impl->active_tree()->page_scale_delta()); EXPECT_EQ(1.f, impl->active_tree()->current_page_scale_factor()); @@ -322,7 +322,7 @@ class LayerTreeHostScrollTestScrollAbortedCommit root_scroll_layer->ScrollBy(impl_scroll_); EXPECT_VECTOR_EQ(root_scroll_layer->ScrollDelta(), impl_scroll_); EXPECT_VECTOR_EQ( - root_scroll_layer->scroll_offset(), + root_scroll_layer->BaseScrollOffset(), gfx::ScrollOffsetWithDelta(initial_scroll_, impl_scroll_)); EXPECT_EQ(1.f, impl->active_tree()->page_scale_delta()); @@ -344,7 +344,7 @@ class LayerTreeHostScrollTestScrollAbortedCommit impl->SetNeedsCommit(); EXPECT_VECTOR_EQ(root_scroll_layer->ScrollDelta(), impl_scroll_); gfx::Vector2dF delta = impl_scroll_ + impl_scroll_ + second_main_scroll_; - EXPECT_VECTOR_EQ(root_scroll_layer->scroll_offset(), + EXPECT_VECTOR_EQ(root_scroll_layer->BaseScrollOffset(), gfx::ScrollOffsetWithDelta(initial_scroll_, delta)); } else if (impl->active_tree()->source_frame_number() == 2 && impl->SourceAnimationFrameNumber() == 4) { @@ -352,7 +352,7 @@ class LayerTreeHostScrollTestScrollAbortedCommit EXPECT_VECTOR_EQ(root_scroll_layer->ScrollDelta(), gfx::Vector2d()); gfx::Vector2dF delta = impl_scroll_ + impl_scroll_ + impl_scroll_ + second_main_scroll_; - EXPECT_VECTOR_EQ(root_scroll_layer->scroll_offset(), + EXPECT_VECTOR_EQ(root_scroll_layer->BaseScrollOffset(), gfx::ScrollOffsetWithDelta(initial_scroll_, delta)); EndTest(); } else { @@ -424,12 +424,12 @@ class LayerTreeHostScrollTestFractionalScroll : public LayerTreeHostScrollTest { // multiple commits. switch (impl->active_tree()->source_frame_number()) { case 0: - EXPECT_VECTOR_EQ(scroll_layer->scroll_offset(), gfx::Vector2d(0, 0)); + EXPECT_VECTOR_EQ(scroll_layer->BaseScrollOffset(), gfx::Vector2d(0, 0)); EXPECT_VECTOR_EQ(scroll_layer->ScrollDelta(), gfx::Vector2d(0, 0)); PostSetNeedsCommitToMainThread(); break; case 1: - EXPECT_VECTOR_EQ(scroll_layer->scroll_offset(), + EXPECT_VECTOR_EQ(scroll_layer->BaseScrollOffset(), gfx::ToFlooredVector2d(scroll_amount_)); EXPECT_VECTOR_EQ(scroll_layer->ScrollDelta(), gfx::Vector2dF(fmod(scroll_amount_.x(), 1.0f), 0.0f)); @@ -437,7 +437,7 @@ class LayerTreeHostScrollTestFractionalScroll : public LayerTreeHostScrollTest { break; case 2: EXPECT_VECTOR_EQ( - scroll_layer->scroll_offset(), + scroll_layer->BaseScrollOffset(), gfx::ToFlooredVector2d(scroll_amount_ + scroll_amount_)); EXPECT_VECTOR_EQ( scroll_layer->ScrollDelta(), @@ -598,7 +598,7 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { // Check the scroll is applied as a delta. EXPECT_VECTOR_EQ(initial_offset_, - expected_scroll_layer_impl->scroll_offset()); + expected_scroll_layer_impl->BaseScrollOffset()); EXPECT_VECTOR_EQ(scroll_amount_, expected_scroll_layer_impl->ScrollDelta()); break; @@ -615,16 +615,16 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest { // Check the scroll is applied as a delta. EXPECT_VECTOR_EQ(javascript_scroll_, - expected_scroll_layer_impl->scroll_offset()); + expected_scroll_layer_impl->BaseScrollOffset()); EXPECT_VECTOR_EQ(scroll_amount_, expected_scroll_layer_impl->ScrollDelta()); break; } case 2: - EXPECT_VECTOR_EQ(gfx::ScrollOffsetWithDelta(javascript_scroll_, - scroll_amount_), - expected_scroll_layer_impl->scroll_offset()); + EXPECT_VECTOR_EQ( + gfx::ScrollOffsetWithDelta(javascript_scroll_, scroll_amount_), + expected_scroll_layer_impl->BaseScrollOffset()); EXPECT_VECTOR_EQ(gfx::Vector2d(), expected_scroll_layer_impl->ScrollDelta()); @@ -828,7 +828,7 @@ class ImplSidePaintingScrollTestSimple : public ImplSidePaintingScrollTest { EXPECT_VECTOR_EQ(scroll_layer->ScrollDelta(), gfx::Vector2d()); scroll_layer->ScrollBy(impl_thread_scroll1_); - EXPECT_VECTOR_EQ(scroll_layer->scroll_offset(), initial_scroll_); + EXPECT_VECTOR_EQ(scroll_layer->BaseScrollOffset(), initial_scroll_); EXPECT_VECTOR_EQ(scroll_layer->ScrollDelta(), impl_thread_scroll1_); PostSetNeedsCommitToMainThread(); @@ -840,13 +840,13 @@ class ImplSidePaintingScrollTestSimple : public ImplSidePaintingScrollTest { EXPECT_EQ(impl->pending_tree()->source_frame_number(), 1); scroll_layer->ScrollBy(impl_thread_scroll2_); - EXPECT_VECTOR_EQ(scroll_layer->scroll_offset(), initial_scroll_); + EXPECT_VECTOR_EQ(scroll_layer->BaseScrollOffset(), initial_scroll_); EXPECT_VECTOR_EQ(scroll_layer->ScrollDelta(), impl_thread_scroll1_ + impl_thread_scroll2_); LayerImpl* pending_scroll_layer = pending_root->children()[0]; EXPECT_VECTOR_EQ( - pending_scroll_layer->scroll_offset(), + pending_scroll_layer->BaseScrollOffset(), gfx::ScrollOffsetWithDelta( initial_scroll_, main_thread_scroll_ + impl_thread_scroll1_)); EXPECT_VECTOR_EQ(pending_scroll_layer->ScrollDelta(), @@ -856,7 +856,7 @@ class ImplSidePaintingScrollTestSimple : public ImplSidePaintingScrollTest { case 1: EXPECT_FALSE(impl->pending_tree()); EXPECT_VECTOR_EQ( - scroll_layer->scroll_offset(), + scroll_layer->BaseScrollOffset(), gfx::ScrollOffsetWithDelta( initial_scroll_, main_thread_scroll_ + impl_thread_scroll1_)); EXPECT_VECTOR_EQ(scroll_layer->ScrollDelta(), impl_thread_scroll2_); @@ -954,7 +954,7 @@ class ImplSidePaintingScrollTestImplOnlyScroll ASSERT_TRUE(pending_scroll_layer); switch (impl->pending_tree()->source_frame_number()) { case 0: - EXPECT_VECTOR_EQ(pending_scroll_layer->scroll_offset(), + EXPECT_VECTOR_EQ(pending_scroll_layer->BaseScrollOffset(), initial_scroll_); EXPECT_VECTOR_EQ(pending_scroll_layer->ScrollDelta(), gfx::Vector2d()); EXPECT_FALSE(active_root); @@ -962,20 +962,21 @@ class ImplSidePaintingScrollTestImplOnlyScroll case 1: // Even though the scroll happened during the commit, both layers // should have the appropriate scroll delta. - EXPECT_VECTOR_EQ(pending_scroll_layer->scroll_offset(), + EXPECT_VECTOR_EQ(pending_scroll_layer->BaseScrollOffset(), initial_scroll_); EXPECT_VECTOR_EQ(pending_scroll_layer->ScrollDelta(), impl_thread_scroll_); ASSERT_TRUE(active_root); - EXPECT_VECTOR_EQ(active_scroll_layer->scroll_offset(), initial_scroll_); + EXPECT_VECTOR_EQ(active_scroll_layer->BaseScrollOffset(), + initial_scroll_); EXPECT_VECTOR_EQ(active_scroll_layer->ScrollDelta(), impl_thread_scroll_); break; case 2: // On the next commit, this delta should have been sent and applied. - EXPECT_VECTOR_EQ(pending_scroll_layer->scroll_offset(), - gfx::ScrollOffsetWithDelta(initial_scroll_, - impl_thread_scroll_)); + EXPECT_VECTOR_EQ( + pending_scroll_layer->BaseScrollOffset(), + gfx::ScrollOffsetWithDelta(initial_scroll_, impl_thread_scroll_)); EXPECT_VECTOR_EQ(pending_scroll_layer->ScrollDelta(), gfx::Vector2d()); break; } @@ -989,14 +990,14 @@ class ImplSidePaintingScrollTestImplOnlyScroll switch (impl->active_tree()->source_frame_number()) { case 0: - EXPECT_VECTOR_EQ(scroll_layer->scroll_offset(), initial_scroll_); + EXPECT_VECTOR_EQ(scroll_layer->BaseScrollOffset(), initial_scroll_); EXPECT_VECTOR_EQ(scroll_layer->ScrollDelta(), gfx::Vector2d()); 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(scroll_layer->scroll_offset(), initial_scroll_); + EXPECT_VECTOR_EQ(scroll_layer->BaseScrollOffset(), initial_scroll_); EXPECT_VECTOR_EQ(scroll_layer->ScrollDelta(), impl_thread_scroll_); EXPECT_EQ(impl_scale_, impl->active_tree()->page_scale_delta()); EXPECT_EQ(impl_scale_, |