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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 878413005: Finalize rename of LayerImpl scroll offset methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix perftest compile Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index cc608fa3afd58b7c0b5af65280bdf9e10d812c36..cb33686994eb0189f68ae46929aee297b4113d44 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());
}
}
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698