summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormajidvp <majidvp@chromium.org>2016-01-12 13:05:18 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-12 21:06:33 +0000
commit944a8cdcba16be6a5fc02f99e2d0948a37692c5d (patch)
tree140739bc77d6f4bf4a47bf2b98ef9c1316155559
parent9f34e289e4ecf80a72c06ec6ed0d38f6daca23d8 (diff)
downloadchromium_src-944a8cdcba16be6a5fc02f99e2d0948a37692c5d.zip
chromium_src-944a8cdcba16be6a5fc02f99e2d0948a37692c5d.tar.gz
chromium_src-944a8cdcba16be6a5fc02f99e2d0948a37692c5d.tar.bz2
Add velocity and phase to ScrollState in CC
- Add velocity and phase information to ScrollState - Update InputeHandler::Scroll{Begin,By,End} methods to take in |ScrollState| - Ensure begin and end of scroll gesture distribute a zero scroll delta to make scrolling model match Blink's BUG=551406 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1506943003 Cr-Commit-Position: refs/heads/master@{#368985}
-rw-r--r--cc/input/input_handler.h45
-rw-r--r--cc/input/scroll_state.cc36
-rw-r--r--cc/input/scroll_state.h79
-rw-r--r--cc/input/scroll_state_data.cc23
-rw-r--r--cc/input/scroll_state_data.h18
-rw-r--r--cc/input/scroll_state_unittest.cc8
-rw-r--r--cc/trees/layer_tree_host_impl.cc104
-rw-r--r--cc/trees/layer_tree_host_impl.h11
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc1096
-rw-r--r--cc/trees/layer_tree_host_unittest_scroll.cc38
-rw-r--r--cc/trees/layer_tree_impl.cc4
-rw-r--r--ui/events/blink/input_handler_proxy.cc97
-rw-r--r--ui/events/blink/input_handler_proxy_unittest.cc259
13 files changed, 1133 insertions, 685 deletions
diff --git a/cc/input/input_handler.h b/cc/input/input_handler.h
index 2d49543..f65509f 100644
--- a/cc/input/input_handler.h
+++ b/cc/input/input_handler.h
@@ -9,6 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "cc/base/cc_export.h"
+#include "cc/input/scroll_state.h"
#include "cc/input/scrollbar.h"
#include "cc/trees/swap_promise_monitor.h"
@@ -91,35 +92,33 @@ class CC_EXPORT InputHandler {
// handler calls WillShutdown() on the client.
virtual void BindToClient(InputHandlerClient* client) = 0;
- // Selects a layer to be scrolled at a given point in viewport (logical
- // pixel) coordinates. Returns SCROLL_STARTED if the layer at the coordinates
- // can be scrolled, SCROLL_ON_MAIN_THREAD if the scroll event should instead
- // be delegated to the main thread, or SCROLL_IGNORED if there is nothing to
- // be scrolled at the given coordinates.
- virtual ScrollStatus ScrollBegin(const gfx::Point& viewport_point,
+ // Selects a layer to be scrolled using the |scroll_state| start position.
+ // Returns SCROLL_STARTED if the layer at the coordinates can be scrolled,
+ // SCROLL_ON_MAIN_THREAD if the scroll event should instead be delegated to
+ // the main thread, or SCROLL_IGNORED if there is nothing to be scrolled at
+ // the given coordinates.
+ virtual ScrollStatus ScrollBegin(ScrollState* scroll_state,
ScrollInputType type) = 0;
// Similar to ScrollBegin, except the hit test is skipped and scroll always
// targets at the root layer.
- virtual ScrollStatus RootScrollBegin(ScrollInputType type) = 0;
+ virtual ScrollStatus RootScrollBegin(ScrollState* scroll_state,
+ ScrollInputType type) = 0;
virtual ScrollStatus ScrollAnimated(const gfx::Point& viewport_point,
const gfx::Vector2dF& scroll_delta) = 0;
- // Scroll the selected layer starting at the given position. If the scroll
- // type given to ScrollBegin was a gesture, then the scroll point and delta
- // should be in viewport (logical pixel) coordinates. Otherwise they are in
- // scrolling layer's (logical pixel) space. If there is no room to move the
- // layer in the requested direction, its first ancestor layer that can be
- // scrolled will be moved instead. The return value's |did_scroll| field is
- // set to false if no layer can be moved in the requested direction at all,
- // and set to true if any layer is moved.
- // If the scroll delta hits the root layer, and the layer can no longer move,
- // the root overscroll accumulated within this ScrollBegin() scope is reported
- // in the return value's |accumulated_overscroll| field.
- // Should only be called if ScrollBegin() returned SCROLL_STARTED.
- virtual InputHandlerScrollResult ScrollBy(
- const gfx::Point& viewport_point,
- const gfx::Vector2dF& scroll_delta) = 0;
+ // Scroll the layer selected by |ScrollBegin| by given |scroll_state| delta.
+ // Internally, the delta is transformed to local layer's coordinate space for
+ // scrolls gestures that are direct manipulation (e.g. touch). If there is no
+ // room to move the layer in the requested direction, its first ancestor layer
+ // that can be scrolled will be moved instead. The return value's |did_scroll|
+ // field is set to false if no layer can be moved in the requested direction
+ // at all, and set to true if any layer is moved. If the scroll delta hits the
+ // root layer, and the layer can no longer move, the root overscroll
+ // accumulated within this ScrollBegin() scope is reported in the return
+ // value's |accumulated_overscroll| field. Should only be called if
+ // ScrollBegin() returned SCROLL_STARTED.
+ virtual InputHandlerScrollResult ScrollBy(ScrollState* scroll_state) = 0;
virtual bool ScrollVerticallyByPage(const gfx::Point& viewport_point,
ScrollDirection direction) = 0;
@@ -132,7 +131,7 @@ class CC_EXPORT InputHandler {
// Stop scrolling the selected layer. Should only be called if ScrollBegin()
// returned SCROLL_STARTED.
- virtual void ScrollEnd() = 0;
+ virtual void ScrollEnd(ScrollState* scroll_state) = 0;
// Requests a callback to UpdateRootLayerStateForSynchronousInputHandler()
// giving the current root scroll and page scale information.
diff --git a/cc/input/scroll_state.cc b/cc/input/scroll_state.cc
index a5ea07f..419b590 100644
--- a/cc/input/scroll_state.cc
+++ b/cc/input/scroll_state.cc
@@ -14,29 +14,37 @@ ScrollState::ScrollState(double delta_x,
double delta_y,
int start_position_x,
int start_position_y,
+ double velocity_x,
+ double velocity_y,
+ bool is_beginning,
+ bool is_in_inertial_phase,
+ bool is_ending,
bool should_propagate,
bool delta_consumed_for_scroll_sequence,
bool is_direct_manipulation)
- : data_(new ScrollStateData(delta_x,
- delta_y,
- start_position_x,
- start_position_y,
- should_propagate,
- delta_consumed_for_scroll_sequence,
- is_direct_manipulation)) {}
-
-ScrollState::ScrollState(scoped_ptr<ScrollStateData> data) {
- data_ = std::move(data);
-}
+ : data_(delta_x,
+ delta_y,
+ start_position_x,
+ start_position_y,
+ velocity_x,
+ velocity_y,
+ is_beginning,
+ is_in_inertial_phase,
+ is_ending,
+ should_propagate,
+ delta_consumed_for_scroll_sequence,
+ is_direct_manipulation) {}
+
+ScrollState::ScrollState(ScrollStateData data) : data_(data) {}
ScrollState::~ScrollState() {}
void ScrollState::ConsumeDelta(double x, double y) {
- data_->delta_x -= x;
- data_->delta_y -= y;
+ data_.delta_x -= x;
+ data_.delta_y -= y;
if (x || y)
- data_->delta_consumed_for_scroll_sequence = true;
+ data_.delta_consumed_for_scroll_sequence = true;
}
void ScrollState::DistributeToScrollChainDescendant() {
diff --git a/cc/input/scroll_state.h b/cc/input/scroll_state.h
index ce0c701..d704ecb 100644
--- a/cc/input/scroll_state.h
+++ b/cc/input/scroll_state.h
@@ -10,6 +10,8 @@
#include "base/memory/scoped_ptr.h"
#include "cc/base/cc_export.h"
#include "cc/input/scroll_state_data.h"
+#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/vector2d.h"
namespace cc {
@@ -19,14 +21,31 @@ class LayerImpl;
// here: https://goo.gl/1ipTpP.
class CC_EXPORT ScrollState {
public:
+ static scoped_ptr<ScrollState> Create(const gfx::Vector2dF& scroll_delta,
+ const gfx::Point& viewport_point,
+ const gfx::Vector2dF& scroll_velocity,
+ bool is_beginning,
+ bool is_in_inertial_phase,
+ bool is_ending) {
+ return make_scoped_ptr(new ScrollState(
+ scroll_delta.x(), scroll_delta.y(), viewport_point.x(),
+ viewport_point.y(), scroll_velocity.x(), scroll_velocity.y(),
+ is_beginning, is_in_inertial_phase, is_ending));
+ }
+
ScrollState(double delta_x,
double delta_y,
int start_position_x,
int start_position_y,
- bool should_propagate,
- bool delta_consumed_for_scroll_sequence,
- bool is_direct_manipulation);
- explicit ScrollState(scoped_ptr<ScrollStateData> data);
+ double velocity_x,
+ double velocity_y,
+ bool is_beginning,
+ bool is_in_inertial_phase,
+ bool is_ending,
+ bool should_propagate = false,
+ bool delta_consumed_for_scroll_sequence = false,
+ bool is_direct_manipulation = false);
+ explicit ScrollState(ScrollStateData data);
~ScrollState();
// Reduce deltas by x, y.
@@ -35,49 +54,69 @@ class CC_EXPORT ScrollState {
// |DistributeScroll| on it.
void DistributeToScrollChainDescendant();
// Positive when scrolling left.
- double delta_x() const { return data_->delta_x; }
+ double delta_x() const { return data_.delta_x; }
// Positive when scrolling up.
- double delta_y() const { return data_->delta_y; }
+ double delta_y() const { return data_.delta_y; }
// The location the scroll started at. For touch, the starting
// position of the finger. For mouse, the location of the cursor.
- int start_position_x() const { return data_->start_position_x; }
- int start_position_y() const { return data_->start_position_y; }
+ int start_position_x() const { return data_.start_position_x; }
+ int start_position_y() const { return data_.start_position_y; }
+
+ double velocity_x() const { return data_.velocity_x; }
+ double velocity_y() const { return data_.velocity_y; }
+
+ bool is_beginning() const { return data_.is_beginning; }
+ void set_is_beginning(bool is_beginning) {
+ data_.is_beginning = is_beginning;
+ }
+ bool is_in_inertial_phase() const { return data_.is_in_inertial_phase; }
+ void set_is_in_inertial_phase(bool is_in_inertial_phase) {
+ data_.is_in_inertial_phase = is_in_inertial_phase;
+ }
+ bool is_ending() const { return data_.is_ending; }
+ void set_is_ending(bool is_ending) { data_.is_ending = is_ending; }
// True if this scroll is allowed to bubble upwards.
- bool should_propagate() const { return data_->should_propagate; }
+ bool should_propagate() const { return data_.should_propagate; }
// True if the user interacts directly with the screen, e.g., via touch.
- bool is_direct_manipulation() const { return data_->is_direct_manipulation; }
+ bool is_direct_manipulation() const { return data_.is_direct_manipulation; }
+ void set_is_direct_manipulation(bool is_direct_manipulation) {
+ data_.is_direct_manipulation = is_direct_manipulation;
+ }
void set_scroll_chain(const std::list<LayerImpl*>& scroll_chain) {
scroll_chain_ = scroll_chain;
}
void set_current_native_scrolling_layer(LayerImpl* layer) {
- data_->current_native_scrolling_layer = layer;
+ data_.current_native_scrolling_layer = layer;
}
LayerImpl* current_native_scrolling_layer() const {
- return data_->current_native_scrolling_layer;
+ return data_.current_native_scrolling_layer;
}
bool delta_consumed_for_scroll_sequence() const {
- return data_->delta_consumed_for_scroll_sequence;
+ return data_.delta_consumed_for_scroll_sequence;
+ }
+ void set_delta_consumed_for_scroll_sequence(bool delta_consumed) {
+ data_.delta_consumed_for_scroll_sequence = delta_consumed;
}
- bool FullyConsumed() const { return !data_->delta_x && !data_->delta_y; }
+ bool FullyConsumed() const { return !data_.delta_x && !data_.delta_y; }
void set_caused_scroll(bool x, bool y) {
- data_->caused_scroll_x |= x;
- data_->caused_scroll_y |= y;
+ data_.caused_scroll_x |= x;
+ data_.caused_scroll_y |= y;
}
- bool caused_scroll_x() const { return data_->caused_scroll_x; }
- bool caused_scroll_y() const { return data_->caused_scroll_y; }
+ bool caused_scroll_x() const { return data_.caused_scroll_x; }
+ bool caused_scroll_y() const { return data_.caused_scroll_y; }
- ScrollStateData* data() { return data_.get(); }
+ ScrollStateData* data() { return &data_; }
private:
- scoped_ptr<ScrollStateData> data_;
+ ScrollStateData data_;
std::list<LayerImpl*> scroll_chain_;
};
diff --git a/cc/input/scroll_state_data.cc b/cc/input/scroll_state_data.cc
index 1e012d3..1eb1ceb 100644
--- a/cc/input/scroll_state_data.cc
+++ b/cc/input/scroll_state_data.cc
@@ -10,6 +10,11 @@ ScrollStateData::ScrollStateData(double delta_x,
double delta_y,
int start_position_x,
int start_position_y,
+ double velocity_x,
+ double velocity_y,
+ bool is_beginning,
+ bool is_in_inertial_phase,
+ bool is_ending,
bool should_propagate,
bool delta_consumed_for_scroll_sequence,
bool is_direct_manipulation)
@@ -17,6 +22,11 @@ ScrollStateData::ScrollStateData(double delta_x,
delta_y(delta_y),
start_position_x(start_position_x),
start_position_y(start_position_y),
+ velocity_x(velocity_x),
+ velocity_y(velocity_y),
+ is_beginning(is_beginning),
+ is_in_inertial_phase(is_in_inertial_phase),
+ is_ending(is_ending),
should_propagate(should_propagate),
current_native_scrolling_layer(nullptr),
delta_consumed_for_scroll_sequence(delta_consumed_for_scroll_sequence),
@@ -25,6 +35,17 @@ ScrollStateData::ScrollStateData(double delta_x,
caused_scroll_y(false) {}
ScrollStateData::ScrollStateData()
- : ScrollStateData(0, 0, 0, 0, true, false, false) {}
+ : ScrollStateData(0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ false,
+ false,
+ false,
+ true,
+ false,
+ false) {}
} // namespace cc
diff --git a/cc/input/scroll_state_data.h b/cc/input/scroll_state_data.h
index 139db43..302970b 100644
--- a/cc/input/scroll_state_data.h
+++ b/cc/input/scroll_state_data.h
@@ -20,13 +20,27 @@ struct CC_EXPORT ScrollStateData {
double delta_y,
int start_position_x,
int start_position_y,
+ double velocity_x,
+ double velocity_y,
+ bool is_beginning,
+ bool is_in_inertial_phase,
+ bool is_ending,
bool should_propagate,
bool delta_consumed_for_scroll_sequence,
bool is_direct_manipulation);
+ // Scroll delta in viewport coordinates (DIP).
double delta_x;
double delta_y;
- double start_position_x;
- double start_position_y;
+ // Scroll position in viewport coordinates (DIP).
+ int start_position_x;
+ int start_position_y;
+ // Scroll velocity in DIP/seconds.
+ double velocity_x;
+ double velocity_y;
+
+ bool is_beginning;
+ bool is_in_inertial_phase;
+ bool is_ending;
bool should_propagate;
diff --git a/cc/input/scroll_state_unittest.cc b/cc/input/scroll_state_unittest.cc
index 67c0124..ccebeea 100644
--- a/cc/input/scroll_state_unittest.cc
+++ b/cc/input/scroll_state_unittest.cc
@@ -23,7 +23,9 @@ TEST_F(ScrollStateTest, ConsumeDeltaNative) {
const float delta_x_to_consume = 1.2f;
const float delta_y_to_consume = 2.3f;
- ScrollState scrollState(delta_x, delta_y, 0, 0, false /* should_propagate */,
+ ScrollState scrollState(delta_x, delta_y, 0, 0, false /* is_beginning */,
+ false /* is_inertial */, false /* is_ending */,
+ false /* should_propagate */,
false /* delta_consumed_for_scroll_sequence */,
false /* is_direct_manipulation */);
EXPECT_FLOAT_EQ(delta_x, scrollState.delta_x());
@@ -55,7 +57,7 @@ TEST_F(ScrollStateTest, ConsumeDeltaNative) {
}
TEST_F(ScrollStateTest, CurrentNativeScrollingScrollable) {
- ScrollState scrollState(0, 0, 0, 0, false, false, false);
+ ScrollState scrollState(0, 0, 0, 0, false, false, false, false, false, false);
FakeImplTaskRunnerProvider task_runner_provider;
TestSharedBitmapManager shared_bitmap_manager;
@@ -70,7 +72,7 @@ TEST_F(ScrollStateTest, CurrentNativeScrollingScrollable) {
}
TEST_F(ScrollStateTest, FullyConsumed) {
- ScrollState scrollState(1, 3, 0, 0, 0, false, false);
+ ScrollState scrollState(1, 3, 0, 0, 0, false, false, false, false, false);
EXPECT_FALSE(scrollState.FullyConsumed());
scrollState.ConsumeDelta(1, 3);
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 2399289..3608a60 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -2545,15 +2545,26 @@ static bool HasScrollAncestor(LayerImpl* child, LayerImpl* scroll_ancestor) {
}
InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBeginImpl(
+ ScrollState* scroll_state,
LayerImpl* scrolling_layer_impl,
InputHandler::ScrollInputType type) {
+ DCHECK(scroll_state);
+ DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0);
+
if (!scrolling_layer_impl)
return SCROLL_IGNORED;
top_controls_manager_->ScrollBegin();
active_tree_->SetCurrentlyScrollingLayer(scrolling_layer_impl);
+ // TODO(majidvp): get rid of wheel_scrolling_ and set is_direct_manipulation
+ // in input_handler_proxy instead.
wheel_scrolling_ = (type == WHEEL || type == ANIMATED_WHEEL);
+ scroll_state->set_is_direct_manipulation(!wheel_scrolling_);
+ // Invoke |DistributeScrollDelta| even with zero delta and velocity to ensure
+ // scroll customization callbacks are invoked.
+ DistributeScrollDelta(scroll_state);
+
client_->RenewTreePriority();
RecordCompositorSlowScrollMetric(type, ScrollThread::CC_THREAD);
@@ -2564,21 +2575,25 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBeginImpl(
}
InputHandler::ScrollStatus LayerTreeHostImpl::RootScrollBegin(
+ ScrollState* scroll_state,
InputHandler::ScrollInputType type) {
TRACE_EVENT0("cc", "LayerTreeHostImpl::RootScrollBegin");
ClearCurrentlyScrollingLayer();
- return ScrollBeginImpl(InnerViewportScrollLayer(), type);
+ return ScrollBeginImpl(scroll_state, InnerViewportScrollLayer(), type);
}
InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
- const gfx::Point& viewport_point,
+ ScrollState* scroll_state,
InputHandler::ScrollInputType type) {
TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBegin");
ClearCurrentlyScrollingLayer();
+ gfx::Point viewport_point(scroll_state->start_position_x(),
+ scroll_state->start_position_y());
+
gfx::PointF device_viewport_point = gfx::ScalePoint(
gfx::PointF(viewport_point), active_tree_->device_scale_factor());
LayerImpl* layer_impl =
@@ -2606,7 +2621,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBegin(
return SCROLL_ON_MAIN_THREAD;
}
- return ScrollBeginImpl(scrolling_layer_impl, type);
+ return ScrollBeginImpl(scroll_state, scrolling_layer_impl, type);
}
InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
@@ -2617,12 +2632,15 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
? SCROLL_STARTED
: SCROLL_IGNORED;
}
+
+ ScrollState scroll_state(0, 0, viewport_point.x(), viewport_point.y(), 0, 0,
+ false, true, false);
// ScrollAnimated is used for animated wheel scrolls. We find the first layer
// that can scroll and set up an animation of its scroll offset. Note that
// this does not currently go through the scroll customization and viewport
// machinery that ScrollBy uses for non-animated wheel scrolls.
InputHandler::ScrollStatus scroll_status =
- ScrollBegin(viewport_point, ANIMATED_WHEEL);
+ ScrollBegin(&scroll_state, ANIMATED_WHEEL);
if (scroll_status == SCROLL_STARTED) {
gfx::Vector2dF pending_delta = scroll_delta;
for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl;
@@ -2655,7 +2673,8 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
return SCROLL_STARTED;
}
}
- ScrollEnd();
+ scroll_state.set_is_ending(true);
+ ScrollEnd(&scroll_state);
return scroll_status;
}
@@ -2817,22 +2836,11 @@ void LayerTreeHostImpl::ApplyScroll(LayerImpl* layer,
scroll_state->set_current_native_scrolling_layer(layer);
}
-InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
- const gfx::Point& viewport_point,
- const gfx::Vector2dF& scroll_delta) {
- TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy");
- if (!CurrentlyScrollingLayer())
- return InputHandlerScrollResult();
-
- float initial_top_controls_offset =
- top_controls_manager_->ControlsTopOffset();
- ScrollState scroll_state(
- scroll_delta.x(), scroll_delta.y(), viewport_point.x(),
- viewport_point.y(), false /* should_propagate */,
- did_lock_scrolling_layer_ /* delta_consumed_for_scroll_sequence */,
- !wheel_scrolling_ /* is_direct_manipulation */);
- scroll_state.set_current_native_scrolling_layer(CurrentlyScrollingLayer());
-
+void LayerTreeHostImpl::DistributeScrollDelta(ScrollState* scroll_state) {
+ // TODO(majidvp): in Blink we compute scroll chain only at scroll begin which
+ // is not the case here. We eventually want to have the same behaviour on both
+ // sides but it may become a non issue if we get rid of scroll chaining (see
+ // crbug.com/526462)
std::list<LayerImpl*> current_scroll_chain;
for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl;
layer_impl = NextLayerInScrollOrder(layer_impl)) {
@@ -2843,15 +2851,35 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
continue;
current_scroll_chain.push_front(layer_impl);
}
- scroll_state.set_scroll_chain(current_scroll_chain);
- scroll_state.DistributeToScrollChainDescendant();
+ scroll_state->set_scroll_chain(current_scroll_chain);
+ scroll_state->DistributeToScrollChainDescendant();
+}
+
+InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
+ ScrollState* scroll_state) {
+ DCHECK(scroll_state);
+
+ TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy");
+ if (!CurrentlyScrollingLayer())
+ return InputHandlerScrollResult();
+
+ float initial_top_controls_offset =
+ top_controls_manager_->ControlsTopOffset();
+
+ scroll_state->set_delta_consumed_for_scroll_sequence(
+ did_lock_scrolling_layer_);
+ scroll_state->set_is_direct_manipulation(!wheel_scrolling_);
+ scroll_state->set_current_native_scrolling_layer(CurrentlyScrollingLayer());
+
+ DistributeScrollDelta(scroll_state);
active_tree_->SetCurrentlyScrollingLayer(
- scroll_state.current_native_scrolling_layer());
- did_lock_scrolling_layer_ = scroll_state.delta_consumed_for_scroll_sequence();
+ scroll_state->current_native_scrolling_layer());
+ did_lock_scrolling_layer_ =
+ scroll_state->delta_consumed_for_scroll_sequence();
- bool did_scroll_x = scroll_state.caused_scroll_x();
- bool did_scroll_y = scroll_state.caused_scroll_y();
+ bool did_scroll_x = scroll_state->caused_scroll_x();
+ bool did_scroll_y = scroll_state->caused_scroll_y();
bool did_scroll_content = did_scroll_x || did_scroll_y;
if (did_scroll_content) {
// If we are scrolling with an active scroll handler, forward latency
@@ -2869,8 +2897,8 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
accumulated_root_overscroll_.set_x(0);
if (did_scroll_y)
accumulated_root_overscroll_.set_y(0);
- gfx::Vector2dF unused_root_delta(scroll_state.delta_x(),
- scroll_state.delta_y());
+ gfx::Vector2dF unused_root_delta(scroll_state->delta_x(),
+ scroll_state->delta_y());
// When inner viewport is unscrollable, disable overscrolls.
if (InnerViewportScrollLayer()) {
@@ -2891,9 +2919,11 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
scroll_result.accumulated_root_overscroll = accumulated_root_overscroll_;
scroll_result.unused_scroll_delta = unused_root_delta;
- // Scrolling can change the root scroll offset, so inform the synchronous
- // input handler.
- UpdateRootLayerStateForSynchronousInputHandler();
+ if (scroll_result.did_scroll) {
+ // Scrolling can change the root scroll offset, so inform the synchronous
+ // input handler.
+ UpdateRootLayerStateForSynchronousInputHandler();
+ }
return scroll_result;
}
@@ -2962,7 +2992,11 @@ void LayerTreeHostImpl::ClearCurrentlyScrollingLayer() {
accumulated_root_overscroll_ = gfx::Vector2dF();
}
-void LayerTreeHostImpl::ScrollEnd() {
+void LayerTreeHostImpl::ScrollEnd(ScrollState* scroll_state) {
+ DCHECK(scroll_state);
+ DCHECK(scroll_state->delta_x() == 0 && scroll_state->delta_y() == 0);
+
+ DistributeScrollDelta(scroll_state);
top_controls_manager_->ScrollEnd();
ClearCurrentlyScrollingLayer();
}
@@ -3774,7 +3808,9 @@ void LayerTreeHostImpl::LayerTransformIsPotentiallyAnimatingChanged(
}
void LayerTreeHostImpl::ScrollOffsetAnimationFinished() {
- ScrollEnd();
+ // TODO(majidvp): We should pass in the original starting scroll position here
+ ScrollState scroll_state(0, 0, 0, 0, 0, 0, false, false, false);
+ ScrollEnd(&scroll_state);
}
gfx::ScrollOffset LayerTreeHostImpl::GetScrollOffsetForAnimation(
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index f7391beb..ff9c384 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -161,23 +161,22 @@ class CC_EXPORT LayerTreeHostImpl
// InputHandler implementation
void BindToClient(InputHandlerClient* client) override;
InputHandler::ScrollStatus ScrollBegin(
- const gfx::Point& viewport_point,
+ ScrollState* scroll_state,
InputHandler::ScrollInputType type) override;
InputHandler::ScrollStatus RootScrollBegin(
+ ScrollState* scroll_state,
InputHandler::ScrollInputType type) override;
InputHandler::ScrollStatus ScrollAnimated(
const gfx::Point& viewport_point,
const gfx::Vector2dF& scroll_delta) override;
void ApplyScroll(LayerImpl* layer, ScrollState* scroll_state);
- InputHandlerScrollResult ScrollBy(
- const gfx::Point& viewport_point,
- const gfx::Vector2dF& scroll_delta) override;
+ InputHandlerScrollResult ScrollBy(ScrollState* scroll_state) override;
bool ScrollVerticallyByPage(const gfx::Point& viewport_point,
ScrollDirection direction) override;
void RequestUpdateForSynchronousInputHandler() override;
void SetSynchronousInputHandlerRootScrollOffset(
const gfx::ScrollOffset& root_offset) override;
- void ScrollEnd() override;
+ void ScrollEnd(ScrollState* scroll_state) override;
InputHandler::ScrollStatus FlingScrollBegin() override;
void MouseMoveAt(const gfx::Point& viewport_point) override;
void PinchGestureBegin() override;
@@ -655,8 +654,10 @@ class CC_EXPORT LayerTreeHostImpl
void ScrollViewportInnerFirst(gfx::Vector2dF scroll_delta);
InputHandler::ScrollStatus ScrollBeginImpl(
+ ScrollState* scroll_state,
LayerImpl* scrolling_layer_impl,
InputHandler::ScrollInputType type);
+ void DistributeScrollDelta(ScrollState* scroll_state);
bool AnimatePageScale(base::TimeTicks monotonic_time);
bool AnimateScrollbars(base::TimeTicks monotonic_time);
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 8fa0ac3..65bc38e 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -390,6 +390,22 @@ class LayerTreeHostImplTest : public testing::Test,
return layer;
}
+ scoped_ptr<ScrollState> BeginState(const gfx::Point& point) {
+ return ScrollState::Create(gfx::Vector2dF(), point, gfx::Vector2dF(), true,
+ false, false);
+ }
+
+ scoped_ptr<ScrollState> UpdateState(const gfx::Point& point,
+ const gfx::Vector2dF& delta) {
+ return ScrollState::Create(delta, point, gfx::Vector2dF(), false, false,
+ false);
+ }
+
+ scoped_ptr<ScrollState> EndState() {
+ return ScrollState::Create(gfx::Vector2dF(), gfx::Point(), gfx::Vector2dF(),
+ false, false, true);
+ }
+
void DrawFrame() {
LayerTreeHostImpl::FrameData frame;
EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
@@ -605,13 +621,14 @@ TEST_F(LayerTreeHostImplTest, ScrollRootCallsCommitAndRedraw) {
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
InputHandler::WHEEL));
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(0, 10),
InputHandler::WHEEL));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
InputHandler::WHEEL));
EXPECT_TRUE(did_request_redraw_);
@@ -624,18 +641,20 @@ TEST_F(LayerTreeHostImplTest, ScrollActiveOnlyAfterScrollMovement) {
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
EXPECT_FALSE(host_impl_->IsActivelyScrolling());
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
EXPECT_TRUE(host_impl_->IsActivelyScrolling());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FALSE(host_impl_->IsActivelyScrolling());
}
TEST_F(LayerTreeHostImplTest, ScrollWithoutRootLayer) {
// We should not crash when trying to scroll an empty layer tree.
EXPECT_EQ(InputHandler::SCROLL_IGNORED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
}
TEST_F(LayerTreeHostImplTest, ScrollWithoutRenderer) {
@@ -653,7 +672,8 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutRenderer) {
// We should not crash when trying to scroll after the renderer initialization
// fails.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
}
TEST_F(LayerTreeHostImplTest, ReplaceTreeWhileScrolling) {
@@ -663,7 +683,8 @@ TEST_F(LayerTreeHostImplTest, ReplaceTreeWhileScrolling) {
// We should not crash if the tree is replaced while we are scrolling.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
host_impl_->active_tree()->DetachLayerTree();
scroll_layer = SetupScrollAndContentsLayers(gfx::Size(100, 100));
@@ -671,8 +692,8 @@ TEST_F(LayerTreeHostImplTest, ReplaceTreeWhileScrolling) {
// We should still be scrolling, because the scrolled layer also exists in the
// new tree.
gfx::Vector2d scroll_delta(0, 10);
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas();
EXPECT_TRUE(
ScrollInfoContains(*scroll_info, scroll_layer->id(), scroll_delta));
@@ -688,26 +709,30 @@ TEST_F(LayerTreeHostImplTest, ScrollBlocksOnWheelEventHandlers) {
// have to go to the main thread.
root->SetHaveWheelEventHandlers(true);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
+ host_impl_->ScrollEnd(EndState().get());
// But typically the scroll-blocks-on mode will require them to.
root->SetScrollBlocksOn(SCROLL_BLOCKS_ON_WHEEL_EVENT |
SCROLL_BLOCKS_ON_START_TOUCH);
EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
// But gesture scrolls can still be handled.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollEnd(EndState().get());
// And if the handlers go away, wheel scrolls can again be processed
// on impl (despite the scroll-blocks-on mode).
root->SetHaveWheelEventHandlers(false);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
+ host_impl_->ScrollEnd(EndState().get());
}
TEST_F(LayerTreeHostImplTest, ScrollBlocksOnTouchEventHandlers) {
@@ -737,8 +762,9 @@ TEST_F(LayerTreeHostImplTest, ScrollBlocksOnTouchEventHandlers) {
// But they don't influence the actual handling of the scroll gestures.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollEnd(EndState().get());
// It's the union of scroll-blocks-on mode bits across all layers in the
// scroll paret chain that matters.
@@ -759,31 +785,36 @@ TEST_F(LayerTreeHostImplTest, ScrollBlocksOnScrollEventHandlers) {
// to the main thread.
root->SetHaveScrollEventHandlers(true);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
+ host_impl_->ScrollEnd(EndState().get());
// Even the default scroll blocks on mode doesn't require this.
root->SetScrollBlocksOn(SCROLL_BLOCKS_ON_WHEEL_EVENT |
SCROLL_BLOCKS_ON_START_TOUCH);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollEnd(EndState().get());
// But the page can opt in to blocking on scroll event handlers.
root->SetScrollBlocksOn(SCROLL_BLOCKS_ON_SCROLL_EVENT);
EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
// GESTURE and WHEEL scrolls behave identically in this regard.
EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
// And if the handlers go away, scrolls can again be processed on impl
// (despite the scroll-blocks-on mode).
root->SetHaveScrollEventHandlers(false);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollEnd(EndState().get());
}
TEST_F(LayerTreeHostImplTest, ScrollBlocksOnLayerTopology) {
@@ -828,35 +859,44 @@ TEST_F(LayerTreeHostImplTest, ScrollBlocksOnLayerTopology) {
// Scroll-blocks-on on a layer affects scrolls that hit that layer.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::GESTURE));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(10, 10)).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollEnd(EndState().get());
child1->SetScrollBlocksOn(SCROLL_BLOCKS_ON_SCROLL_EVENT);
EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
- host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(10, 10)).get(),
+ InputHandler::GESTURE));
// But not those that hit only other layers.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::GESTURE));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(10, 25)).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollEnd(EndState().get());
// It's the union of bits set across the scroll ancestor chain that matters.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::GESTURE));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(10, 25)).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::WHEEL));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(10, 25)).get(),
+ InputHandler::WHEEL));
+ host_impl_->ScrollEnd(EndState().get());
root->SetScrollBlocksOn(SCROLL_BLOCKS_ON_WHEEL_EVENT);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::GESTURE));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(10, 25)).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
- host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(10, 25)).get(),
+ InputHandler::WHEEL));
child2->SetScrollBlocksOn(SCROLL_BLOCKS_ON_SCROLL_EVENT);
EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
- host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(10, 25)).get(),
+ InputHandler::WHEEL));
EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
- host_impl_->ScrollBegin(gfx::Point(10, 25), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(10, 25)).get(),
+ InputHandler::GESTURE));
}
TEST_F(LayerTreeHostImplTest, FlingOnlyWhenScrollingTouchscreen) {
@@ -869,7 +909,8 @@ TEST_F(LayerTreeHostImplTest, FlingOnlyWhenScrollingTouchscreen) {
// Start scrolling a layer
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
// Now the fling should go ahead since we've started scrolling a layer
EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
@@ -885,7 +926,8 @@ TEST_F(LayerTreeHostImplTest, FlingOnlyWhenScrollingTouchpad) {
// Start scrolling a layer
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
// Now the fling should go ahead since we've started scrolling a layer
EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
@@ -901,7 +943,8 @@ TEST_F(LayerTreeHostImplTest, NoFlingWhenScrollingOnMain) {
// Start scrolling a layer
EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
// The fling should be ignored since there's no layer being scrolled impl-side
EXPECT_EQ(InputHandler::SCROLL_IGNORED, host_impl_->FlingScrollBegin());
@@ -916,9 +959,11 @@ TEST_F(LayerTreeHostImplTest, ShouldScrollOnMainThread) {
root->SetShouldScrollOnMainThread(true);
EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
}
TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionBasic) {
@@ -932,31 +977,35 @@ TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionBasic) {
// All scroll types inside the non-fast scrollable region should fail.
EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
- host_impl_->ScrollBegin(gfx::Point(25, 25), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(25, 25)).get(),
+ InputHandler::WHEEL));
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(25, 25),
InputHandler::WHEEL));
EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
- host_impl_->ScrollBegin(gfx::Point(25, 25), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(25, 25)).get(),
+ InputHandler::GESTURE));
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(25, 25),
InputHandler::GESTURE));
// All scroll types outside this region should succeed.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(75, 75), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(75, 75)).get(),
+ InputHandler::WHEEL));
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(75, 75),
InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(25, 25),
InputHandler::GESTURE));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(75, 75),
InputHandler::GESTURE));
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(75, 75), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(75, 75)).get(),
+ InputHandler::GESTURE));
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(75, 75),
InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(75, 75),
InputHandler::GESTURE));
}
@@ -975,15 +1024,17 @@ TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionWithOffset) {
// This point would fall into the non-fast scrollable region except that we've
// moved the layer down by 25 pixels.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(40, 10), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(40, 10)).get(),
+ InputHandler::WHEEL));
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(40, 10),
InputHandler::WHEEL));
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 1));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 1)).get());
+ host_impl_->ScrollEnd(EndState().get());
// This point is still inside the non-fast region.
EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
- host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(10, 10)).get(),
+ InputHandler::WHEEL));
}
TEST_F(LayerTreeHostImplTest, ScrollHandlerNotPresent) {
@@ -993,9 +1044,10 @@ TEST_F(LayerTreeHostImplTest, ScrollHandlerNotPresent) {
DrawFrame();
EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler());
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE);
EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler());
}
@@ -1006,9 +1058,10 @@ TEST_F(LayerTreeHostImplTest, ScrollHandlerPresent) {
DrawFrame();
EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler());
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE);
EXPECT_TRUE(host_impl_->scroll_affects_scroll_handler());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FALSE(host_impl_->scroll_affects_scroll_handler());
}
@@ -1019,43 +1072,70 @@ TEST_F(LayerTreeHostImplTest, ScrollByReturnsCorrectValue) {
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
// Trying to scroll to the left/top will not succeed.
EXPECT_FALSE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(-10, 0)).get())
+ .did_scroll);
EXPECT_FALSE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -10)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, -10)).get())
+ .did_scroll);
EXPECT_FALSE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, -10)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(-10, -10)).get())
+ .did_scroll);
// Scrolling to the right/bottom will succeed.
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, 0)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(10, 0)).get())
+ .did_scroll);
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get())
+ .did_scroll);
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, 10)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(10, 10)).get())
+ .did_scroll);
// Scrolling to left/top will now succeed.
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(-10, 0)).get())
+ .did_scroll);
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -10)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, -10)).get())
+ .did_scroll);
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, -10)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(-10, -10)).get())
+ .did_scroll);
// Scrolling diagonally against an edge will succeed.
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, -10)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(10, -10)).get())
+ .did_scroll);
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 0)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(-10, 0)).get())
+ .did_scroll);
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-10, 10)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(-10, 10)).get())
+ .did_scroll);
// Trying to scroll more than the available space will also succeed.
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(5000, 5000)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(5000, 5000)).get())
+ .did_scroll);
}
TEST_F(LayerTreeHostImplTest, ScrollVerticallyByPageReturnsCorrectValue) {
@@ -1065,7 +1145,8 @@ TEST_F(LayerTreeHostImplTest, ScrollVerticallyByPageReturnsCorrectValue) {
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
// Trying to scroll if not user_scrollable_vertical will fail.
host_impl_->InnerViewportScrollLayer()->set_user_scrollable_vertical(false);
@@ -1099,37 +1180,40 @@ TEST_F(LayerTreeHostImplTest, ScrollWithUserUnscrollableLayers) {
gfx::Point scroll_position(10, 10);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(scroll_position, InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(scroll_position).get(),
+ InputHandler::WHEEL));
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();
+ host_impl_->ScrollBy(UpdateState(scroll_position, scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
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::SCROLL_STARTED,
- host_impl_->ScrollBegin(scroll_position, InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(scroll_position).get(),
+ InputHandler::WHEEL));
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();
+ host_impl_->ScrollBy(UpdateState(scroll_position, scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 0), scroll_layer->CurrentScrollOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 20), overflow->CurrentScrollOffset());
overflow->set_user_scrollable_vertical(false);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(scroll_position, InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(scroll_position).get(),
+ InputHandler::WHEEL));
EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 0), scroll_layer->CurrentScrollOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 20), overflow->CurrentScrollOffset());
- host_impl_->ScrollBy(scroll_position, scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBy(UpdateState(scroll_position, scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 10), scroll_layer->CurrentScrollOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(10, 20), overflow->CurrentScrollOffset());
}
@@ -1435,11 +1519,12 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoom) {
float page_scale_delta = 2.f;
- host_impl_->ScrollBegin(gfx::Point(50, 50), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point(50, 50)).get(),
+ InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50));
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FALSE(did_request_next_frame_);
EXPECT_TRUE(did_request_redraw_);
EXPECT_TRUE(did_request_commit_);
@@ -1462,17 +1547,19 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoom) {
scroll_layer->SetScrollDelta(gfx::Vector2d());
float page_scale_delta = 2.f;
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point());
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
gfx::Vector2d scroll_delta(0, 10);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
+ InputHandler::WHEEL));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
scoped_ptr<ScrollAndScaleSet> scroll_info =
host_impl_->ProcessScrollDeltas();
@@ -1502,11 +1589,12 @@ TEST_F(LayerTreeHostImplTest, ViewportScrollOrder) {
outer_scroll_layer->MaxScrollOffset());
RebuildPropertyTrees();
- host_impl_->ScrollBegin(gfx::Point(250, 250), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point(250, 250)).get(),
+ InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(2.f, gfx::Point(0, 0));
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
// Sanity check - we're zoomed in, starting from the origin.
EXPECT_VECTOR_EQ(
@@ -1517,9 +1605,11 @@ TEST_F(LayerTreeHostImplTest, ViewportScrollOrder) {
inner_scroll_layer->CurrentScrollOffset());
// Scroll down - only the inner viewport should scroll.
- host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::GESTURE);
- host_impl_->ScrollBy(gfx::Point(0, 0), gfx::Vector2dF(100.f, 100.f));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
+ InputHandler::GESTURE);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(0, 0), gfx::Vector2dF(100.f, 100.f)).get());
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_VECTOR_EQ(
gfx::Vector2dF(50, 50),
@@ -1530,9 +1620,11 @@ TEST_F(LayerTreeHostImplTest, ViewportScrollOrder) {
// Scroll down - outer viewport should start scrolling after the inner is at
// its maximum.
- host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::GESTURE);
- host_impl_->ScrollBy(gfx::Point(0, 0), gfx::Vector2dF(1000.f, 1000.f));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
+ InputHandler::GESTURE);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(0, 0), gfx::Vector2dF(1000.f, 1000.f)).get());
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_VECTOR_EQ(
gfx::Vector2dF(250, 250),
@@ -1568,28 +1660,32 @@ TEST_F(LayerTreeHostImplTest, ScrollViewportWithFractionalAmounts) {
RebuildPropertyTrees();
// Scroll only the layout viewport.
- host_impl_->ScrollBegin(gfx::Point(250, 250), InputHandler::GESTURE);
- host_impl_->ScrollBy(gfx::Point(250, 250), gfx::Vector2dF(0.125f, 0.125f));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(250, 250)).get(),
+ InputHandler::GESTURE);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(250, 250), gfx::Vector2dF(0.125f, 0.125f)).get());
EXPECT_VECTOR2DF_EQ(
gfx::Vector2dF(0.125f, 0.125f),
outer_scroll_layer->CurrentScrollOffset());
EXPECT_VECTOR2DF_EQ(
gfx::Vector2dF(0, 0),
inner_scroll_layer->CurrentScrollOffset());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
host_impl_->active_tree()->PushPageScaleFromMainThread(2.f, 1.f, 2.f);
// Now that we zoomed in, the scroll should be applied to the inner viewport.
- host_impl_->ScrollBegin(gfx::Point(250, 250), InputHandler::GESTURE);
- host_impl_->ScrollBy(gfx::Point(250, 250), gfx::Vector2dF(0.5f, 0.5f));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(250, 250)).get(),
+ InputHandler::GESTURE);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(250, 250), gfx::Vector2dF(0.5f, 0.5f)).get());
EXPECT_VECTOR2DF_EQ(
gfx::Vector2dF(0.125f, 0.125f),
outer_scroll_layer->CurrentScrollOffset());
EXPECT_VECTOR2DF_EQ(
gfx::Vector2dF(0.25f, 0.25f),
inner_scroll_layer->CurrentScrollOffset());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
}
// Tests that scrolls during a pinch gesture (i.e. "two-finger" scrolls) work
@@ -1615,7 +1711,8 @@ TEST_F(LayerTreeHostImplTest, ScrollDuringPinchGesture) {
outer_scroll_layer->MaxScrollOffset());
RebuildPropertyTrees();
- host_impl_->ScrollBegin(gfx::Point(250, 250), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point(250, 250)).get(),
+ InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(2, gfx::Point(250, 250));
@@ -1629,7 +1726,8 @@ TEST_F(LayerTreeHostImplTest, ScrollDuringPinchGesture) {
// Needed so that the pinch is accounted for in draw properties.
DrawFrame();
- host_impl_->ScrollBy(gfx::Point(250, 250), gfx::Vector2dF(10.f, 10.f));
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(250, 250), gfx::Vector2dF(10.f, 10.f)).get());
EXPECT_VECTOR_EQ(
gfx::Vector2dF(0, 0),
outer_scroll_layer->CurrentScrollOffset());
@@ -1639,7 +1737,8 @@ TEST_F(LayerTreeHostImplTest, ScrollDuringPinchGesture) {
DrawFrame();
- host_impl_->ScrollBy(gfx::Point(250, 250), gfx::Vector2dF(400.f, 400.f));
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(250, 250), gfx::Vector2dF(400.f, 400.f)).get());
EXPECT_VECTOR_EQ(
gfx::Vector2dF(80, 80),
outer_scroll_layer->CurrentScrollOffset());
@@ -1648,7 +1747,7 @@ TEST_F(LayerTreeHostImplTest, ScrollDuringPinchGesture) {
inner_scroll_layer->CurrentScrollOffset());
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
}
// Tests the "snapping" of pinch-zoom gestures to the screen edge. That is, when
@@ -1671,11 +1770,11 @@ TEST_F(LayerTreeHostImplTest, PinchZoomSnapsToScreenEdge) {
// Pinch in within the margins. The scroll should stay exactly locked to the
// bottom and right.
RebuildPropertyTrees();
- host_impl_->ScrollBegin(anchor, InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(anchor).get(), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(2, anchor);
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_VECTOR_EQ(
gfx::Vector2dF(250, 250),
@@ -1689,11 +1788,11 @@ TEST_F(LayerTreeHostImplTest, PinchZoomSnapsToScreenEdge) {
// Pinch in within the margins. The scroll should stay exactly locked to the
// top and left.
anchor = gfx::Point(offsetFromEdge, offsetFromEdge);
- host_impl_->ScrollBegin(anchor, InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(anchor).get(), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(2, anchor);
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_VECTOR_EQ(
gfx::Vector2dF(0, 0),
@@ -1707,11 +1806,11 @@ TEST_F(LayerTreeHostImplTest, PinchZoomSnapsToScreenEdge) {
// Pinch in just outside the margin. There should be no snapping.
offsetFromEdge = Viewport::kPinchZoomSnapMarginDips;
anchor = gfx::Point(offsetFromEdge, offsetFromEdge);
- host_impl_->ScrollBegin(anchor, InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(anchor).get(), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(2, anchor);
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_VECTOR_EQ(
gfx::Vector2dF(50, 50),
@@ -1726,11 +1825,11 @@ TEST_F(LayerTreeHostImplTest, PinchZoomSnapsToScreenEdge) {
offsetFromEdge = Viewport::kPinchZoomSnapMarginDips;
anchor = gfx::Point(viewport_size.width() - offsetFromEdge,
viewport_size.height() - offsetFromEdge);
- host_impl_->ScrollBegin(anchor, InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(anchor).get(), InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(2, anchor);
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_VECTOR_EQ(
gfx::Vector2dF(200, 200),
@@ -1755,9 +1854,11 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoomWheelBubbleBetweenViewports) {
// Scroll by a small amount, there should be no bubbling to the outer
// viewport.
- host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::WHEEL);
- host_impl_->ScrollBy(gfx::Point(0, 0), gfx::Vector2dF(10.f, 20.f));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
+ InputHandler::WHEEL);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(0, 0), gfx::Vector2dF(10.f, 20.f)).get());
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_VECTOR_EQ(
gfx::Vector2dF(5, 10),
@@ -1768,9 +1869,11 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoomWheelBubbleBetweenViewports) {
// Scroll by the inner viewport's max scroll extent, the remainder
// should bubble up to the outer viewport.
- host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::WHEEL);
- host_impl_->ScrollBy(gfx::Point(0, 0), gfx::Vector2dF(100.f, 100.f));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
+ InputHandler::WHEEL);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(0, 0), gfx::Vector2dF(100.f, 100.f)).get());
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_VECTOR_EQ(
gfx::Vector2dF(50, 50),
@@ -1781,9 +1884,11 @@ TEST_F(LayerTreeHostImplTest, ImplPinchZoomWheelBubbleBetweenViewports) {
// Scroll by the outer viewport's max scroll extent, it should all go to the
// outer viewport.
- host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::WHEEL);
- host_impl_->ScrollBy(gfx::Point(0, 0), gfx::Vector2dF(190.f, 180.f));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
+ InputHandler::WHEEL);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(0, 0), gfx::Vector2dF(190.f, 180.f)).get());
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_VECTOR_EQ(
gfx::Vector2dF(100, 100),
@@ -1802,11 +1907,12 @@ TEST_F(LayerTreeHostImplTest, ScrollWithSwapPromises) {
SetupScrollAndContentsLayers(gfx::Size(100, 100));
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
host_impl_->QueueSwapPromiseForMainThreadScrollUpdate(
std::move(swap_promise));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas();
EXPECT_EQ(1u, scroll_info->swap_promises.size());
@@ -1854,10 +1960,13 @@ TEST_F(LayerTreeHostImplTest, ScrollDoesntBubble) {
DrawFrame();
{
- host_impl_->ScrollBegin(gfx::Point(21, 21), InputHandler::GESTURE);
- host_impl_->ScrollBy(gfx::Point(21, 21), gfx::Vector2d(5, 5));
- host_impl_->ScrollBy(gfx::Point(21, 21), gfx::Vector2d(100, 100));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(21, 21)).get(),
+ InputHandler::GESTURE);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(21, 21), gfx::Vector2d(5, 5)).get());
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(21, 21), gfx::Vector2d(100, 100)).get());
+ host_impl_->ScrollEnd(EndState().get());
// The child should be fully scrolled by the first ScrollBy.
EXPECT_VECTOR_EQ(gfx::Vector2dF(5, 5), child->CurrentScrollOffset());
@@ -1875,12 +1984,17 @@ TEST_F(LayerTreeHostImplTest, ScrollDoesntBubble) {
}
{
- host_impl_->ScrollBegin(gfx::Point(21, 21), InputHandler::GESTURE);
- host_impl_->ScrollBy(gfx::Point(21, 21), gfx::Vector2d(3, 4));
- host_impl_->ScrollBy(gfx::Point(21, 21), gfx::Vector2d(2, 1));
- host_impl_->ScrollBy(gfx::Point(21, 21), gfx::Vector2d(2, 1));
- host_impl_->ScrollBy(gfx::Point(21, 21), gfx::Vector2d(2, 1));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(21, 21)).get(),
+ InputHandler::GESTURE);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(21, 21), gfx::Vector2d(3, 4)).get());
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(21, 21), gfx::Vector2d(2, 1)).get());
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(21, 21), gfx::Vector2d(2, 1)).get());
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(21, 21), gfx::Vector2d(2, 1)).get());
+ host_impl_->ScrollEnd(EndState().get());
// The ScrollBy's should scroll the parent to its extent.
EXPECT_VECTOR_EQ(gfx::Vector2dF(5, 5), parent->CurrentScrollOffset());
@@ -1914,11 +2028,12 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
scroll_layer->SetScrollDelta(gfx::Vector2d());
float page_scale_delta = 2.f;
- host_impl_->ScrollBegin(gfx::Point(50, 50), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point(50, 50)).get(),
+ InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50));
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FALSE(did_request_next_frame_);
EXPECT_TRUE(did_request_redraw_);
EXPECT_TRUE(did_request_commit_);
@@ -1935,11 +2050,12 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
scroll_layer->SetScrollDelta(gfx::Vector2d());
float page_scale_delta = 10.f;
- host_impl_->ScrollBegin(gfx::Point(50, 50), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point(50, 50)).get(),
+ InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(50, 50));
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
scoped_ptr<ScrollAndScaleSet> scroll_info =
host_impl_->ProcessScrollDeltas();
@@ -1955,11 +2071,12 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(50, 50));
float page_scale_delta = 0.1f;
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point());
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
scoped_ptr<ScrollAndScaleSet> scroll_info =
host_impl_->ProcessScrollDeltas();
@@ -1977,12 +2094,13 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(20, 20));
float page_scale_delta = 1.f;
- host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point(10, 10)).get(),
+ InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(10, 10));
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(20, 20));
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
scoped_ptr<ScrollAndScaleSet> scroll_info =
host_impl_->ProcessScrollDeltas();
@@ -1999,13 +2117,15 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(20, 20));
float page_scale_delta = 1.f;
- host_impl_->ScrollBegin(gfx::Point(10, 10), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point(10, 10)).get(),
+ InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(10, 10));
- host_impl_->ScrollBy(gfx::Point(10, 10), gfx::Vector2d(-10, -10));
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(10, 10), gfx::Vector2d(-10, -10)).get());
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point(20, 20));
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
scoped_ptr<ScrollAndScaleSet> scroll_info =
host_impl_->ProcessScrollDeltas();
@@ -2021,7 +2141,8 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
scroll_layer->PullDeltaForMainThread();
scroll_layer->PushScrollOffsetFromMainThread(gfx::ScrollOffset(0, 0));
- host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
+ InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(2.f, gfx::Point(0, 0));
host_impl_->PinchGestureUpdate(1.f, gfx::Point(0, 0));
@@ -2029,10 +2150,11 @@ TEST_F(LayerTreeHostImplTest, PinchGesture) {
// Needed so layer transform includes page scale.
DrawFrame();
- host_impl_->ScrollBy(gfx::Point(0, 0), gfx::Vector2d(10, 10));
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(0, 0), gfx::Vector2d(10, 10)).get());
host_impl_->PinchGestureUpdate(1.f, gfx::Point(10, 10));
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
scoped_ptr<ScrollAndScaleSet> scroll_info =
host_impl_->ProcessScrollDeltas();
@@ -2471,8 +2593,9 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
animation_task_ = base::Closure();
// If no scroll happened during a scroll gesture, it should have no effect.
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL);
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FALSE(did_request_next_frame_);
EXPECT_FALSE(did_request_redraw_);
EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
@@ -2493,15 +2616,16 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
// After a scroll, a scrollbar animation should be scheduled about 20ms from
// now.
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 5));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL);
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(0, 5)).get());
EXPECT_FALSE(did_request_next_frame_);
EXPECT_TRUE(did_request_redraw_);
did_request_redraw_ = false;
EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
EXPECT_TRUE(animation_task_.Equals(base::Closure()));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FALSE(did_request_next_frame_);
EXPECT_FALSE(did_request_redraw_);
EXPECT_EQ(base::TimeDelta::FromMilliseconds(20),
@@ -2566,15 +2690,16 @@ class LayerTreeHostImplTestScrollbarAnimation : public LayerTreeHostImplTest {
host_impl_->DidFinishImplFrame();
// Scrollbar animation is not triggered unnecessarily.
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(5, 0));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL);
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(5, 0)).get());
EXPECT_FALSE(did_request_next_frame_);
EXPECT_TRUE(did_request_redraw_);
did_request_redraw_ = false;
EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
EXPECT_TRUE(animation_task_.Equals(base::Closure()));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FALSE(did_request_next_frame_);
EXPECT_FALSE(did_request_redraw_);
EXPECT_EQ(base::TimeDelta(), requested_animation_delay_);
@@ -2634,9 +2759,10 @@ class LayerTreeHostImplTestScrollbarOpacity : public LayerTreeHostImplTest {
host_impl_->ScrollbarAnimationControllerForId(scroll->id())
->DidMouseMoveNear(0);
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL);
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 5));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL);
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(0, 5)).get());
+ host_impl_->ScrollEnd(EndState().get());
host_impl_->CreatePendingTree();
EffectNode* pending_tree_node =
host_impl_->pending_tree()->property_trees()->effect_tree.Node(
@@ -2910,14 +3036,15 @@ TEST_F(LayerTreeHostImplTest, CompositorFrameMetadata) {
// Scrolling should update metadata immediately.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
{
CompositorFrameMetadata metadata =
host_impl_->MakeCompositorFrameMetadata();
EXPECT_EQ(gfx::Vector2dF(0.f, 10.f), metadata.root_scroll_offset);
}
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
{
CompositorFrameMetadata metadata =
host_impl_->MakeCompositorFrameMetadata();
@@ -2977,11 +3104,12 @@ TEST_F(LayerTreeHostImplTest, CompositorFrameMetadata) {
}
// Page scale should update metadata correctly (shrinking only the viewport).
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(2.f, gfx::Point());
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
{
CompositorFrameMetadata metadata =
host_impl_->MakeCompositorFrameMetadata();
@@ -3541,7 +3669,8 @@ TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) {
// Scroll event is ignored because layer is not scrollable.
EXPECT_EQ(InputHandler::SCROLL_IGNORED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
EXPECT_FALSE(did_request_redraw_);
EXPECT_FALSE(did_request_commit_);
}
@@ -3688,7 +3817,8 @@ TEST_F(LayerTreeHostImplTopControlsTest,
EXPECT_EQ(gfx::SizeF(50, 50), active_tree->ScrollableSize());
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
host_impl_->top_controls_manager()->ScrollBegin();
@@ -3721,7 +3851,7 @@ TEST_F(LayerTreeHostImplTopControlsTest,
}
host_impl_->top_controls_manager()->ScrollEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
}
TEST_F(LayerTreeHostImplTopControlsTest, ScrollTopControlsByFractionalAmount) {
@@ -3730,7 +3860,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, ScrollTopControlsByFractionalAmount) {
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
// Make the test scroll delta a fractional amount, to verify that the
// fixed container size delta is (1) non-zero, and (2) fractional, and
@@ -3743,7 +3874,7 @@ TEST_F(LayerTreeHostImplTopControlsTest, ScrollTopControlsByFractionalAmount) {
LayerImpl* inner_viewport_scroll_layer =
host_impl_->active_tree()->InnerViewportScrollLayer();
DCHECK(inner_viewport_scroll_layer);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FLOAT_EQ(top_controls_scroll_delta.y(),
inner_viewport_scroll_layer->FixedContainerSizeDelta().y());
}
@@ -3773,8 +3904,10 @@ TEST_F(LayerTreeHostImplTopControlsTest,
host_impl_->active_tree()->PushPageScaleFromMainThread(2.f, 1.f, 2.f);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, 50.f));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2dF(0.f, 50.f)).get());
// The entire scroll delta should have been used to hide the top controls.
// The viewport layers should be resized back to their full sizes.
@@ -3784,18 +3917,21 @@ TEST_F(LayerTreeHostImplTopControlsTest,
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));
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2dF(0.f, 100.f)).get());
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();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), inner_scroll);
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, -50.f));
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2dF(0.f, -50.f)).get());
// The entire scroll delta should have been used to show the top controls.
// The outer viewport should be resized to accomodate and scrolled to the
@@ -3808,16 +3944,19 @@ TEST_F(LayerTreeHostImplTopControlsTest,
// 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));
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2dF(0.f, -20.f)).get());
EXPECT_EQ(25.f, outer_scroll->CurrentScrollOffset().y());
EXPECT_EQ(15.f, inner_scroll->CurrentScrollOffset().y());
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, -30.f));
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2dF(0.f, -30.f)).get());
EXPECT_EQ(25.f, outer_scroll->CurrentScrollOffset().y());
EXPECT_EQ(0.f, inner_scroll->CurrentScrollOffset().y());
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.f, -50.f));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2dF(0.f, -50.f)).get());
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_EQ(0.f, outer_scroll->CurrentScrollOffset().y());
EXPECT_EQ(0.f, inner_scroll->CurrentScrollOffset().y());
@@ -3840,7 +3979,8 @@ TEST_F(LayerTreeHostImplTopControlsTest, FixedContainerDelta) {
host_impl_->active_tree()->PushPageScaleFromMainThread(page_scale, 1.f, 2.f);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
// Scroll down, the top controls hiding should expand the viewport size so
// the delta should be equal to the scroll distance.
@@ -3851,7 +3991,7 @@ TEST_F(LayerTreeHostImplTopControlsTest, FixedContainerDelta) {
host_impl_->top_controls_manager()->ContentTopOffset());
EXPECT_FLOAT_EQ(top_controls_scroll_delta.y(),
outer_viewport_scroll_layer->FixedContainerSizeDelta().y());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
// Scroll past the maximum extent. The delta shouldn't be greater than the
// top controls height.
@@ -3862,7 +4002,7 @@ TEST_F(LayerTreeHostImplTopControlsTest, FixedContainerDelta) {
EXPECT_EQ(0.f, host_impl_->top_controls_manager()->ContentTopOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(0, top_controls_height_),
outer_viewport_scroll_layer->FixedContainerSizeDelta());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
// Scroll in the direction to make the top controls show.
host_impl_->top_controls_manager()->ScrollBegin();
@@ -3888,8 +4028,9 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsDontTriggerCommit) {
// Scroll 25px to hide top controls
gfx::Vector2dF scroll_delta(0.f, 25.f);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
EXPECT_FALSE(did_request_commit_);
}
@@ -3931,9 +4072,10 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollableSublayer) {
host_impl_->active_tree()->property_trees()->needs_rebuild = true;
host_impl_->active_tree()->BuildPropertyTreesForTesting();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
// Top controls should be hidden
EXPECT_EQ(scroll_delta.y(),
@@ -4090,15 +4232,16 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsViewportOffsetClamping) {
// Hide the top controls by 25px.
gfx::Vector2dF scroll_delta(0.f, 25.f);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
// scrolling down at the max extents no longer hides the top controls
EXPECT_EQ(1.f, host_impl_->active_tree()->CurrentTopControlsShownRatio());
// forcefully hide the top controls by 25px
host_impl_->top_controls_manager()->ScrollBy(scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FLOAT_EQ(scroll_delta.y(),
top_controls_height_ -
@@ -4116,9 +4259,10 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsViewportOffsetClamping) {
// Bring the top controls down by 25px.
scroll_delta = gfx::Vector2dF(0.f, -25.f);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
// The viewport offset shouldn't have changed.
EXPECT_EQ(viewport_offset,
@@ -4144,9 +4288,10 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsAspectRatio) {
gfx::Vector2dF scroll_delta(0.f, 25.f);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FLOAT_EQ(scroll_delta.y(),
top_controls_height_ -
@@ -4184,12 +4329,13 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) {
// top controls get scrolled.
gfx::Vector2dF scroll_delta(0.f, 15.f);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
EXPECT_EQ(host_impl_->InnerViewportScrollLayer(),
host_impl_->CurrentlyScrollingLayer());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FLOAT_EQ(scroll_delta.y(),
top_controls_height_ -
@@ -4197,14 +4343,15 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) {
scroll_delta = gfx::Vector2dF(0.f, 50.f);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
EXPECT_EQ(0, host_impl_->top_controls_manager()->ContentTopOffset());
EXPECT_EQ(host_impl_->InnerViewportScrollLayer(),
host_impl_->CurrentlyScrollingLayer());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
// Position the viewports such that the inner viewport will be scrolled.
gfx::Vector2dF inner_viewport_offset(0.f, 25.f);
@@ -4213,8 +4360,9 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) {
scroll_delta = gfx::Vector2dF(0.f, -65.f);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
EXPECT_EQ(top_controls_height_,
host_impl_->top_controls_manager()->ContentTopOffset());
@@ -4222,7 +4370,7 @@ TEST_F(LayerTreeHostImplTopControlsTest, TopControlsScrollOuterViewport) {
inner_viewport_offset.y() + (scroll_delta.y() + top_controls_height_),
host_impl_->InnerViewportScrollLayer()->ScrollDelta().y());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
}
TEST_F(LayerTreeHostImplTopControlsTest,
@@ -4234,7 +4382,8 @@ TEST_F(LayerTreeHostImplTopControlsTest,
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
host_impl_->top_controls_manager()->ScrollBegin();
host_impl_->top_controls_manager()->ScrollBy(gfx::Vector2dF(0.f, 50.f));
@@ -4245,10 +4394,11 @@ TEST_F(LayerTreeHostImplTopControlsTest,
host_impl_->InnerViewportScrollLayer()->parent()->parent();
EXPECT_EQ(viewport_size_, inner_clip_ptr->bounds());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
float scroll_increment_y = -25.f;
host_impl_->top_controls_manager()->ScrollBegin();
@@ -4269,7 +4419,7 @@ TEST_F(LayerTreeHostImplTopControlsTest,
// Now that top controls have moved, expect the clip to resize.
EXPECT_EQ(clip_size_, inner_clip_ptr->bounds());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
// Verify the layer is once-again non-scrollable.
EXPECT_EQ(
@@ -4277,7 +4427,8 @@ TEST_F(LayerTreeHostImplTopControlsTest,
host_impl_->active_tree()->InnerViewportScrollLayer()->MaxScrollOffset());
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
}
TEST_F(LayerTreeHostImplTest, ScrollNonCompositedRoot) {
@@ -4310,9 +4461,10 @@ TEST_F(LayerTreeHostImplTest, ScrollNonCompositedRoot) {
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
+ InputHandler::WHEEL));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_TRUE(did_request_redraw_);
EXPECT_TRUE(did_request_commit_);
}
@@ -4329,9 +4481,10 @@ TEST_F(LayerTreeHostImplTest, ScrollChildCallsCommitAndRedraw) {
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
+ InputHandler::WHEEL));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_TRUE(did_request_redraw_);
EXPECT_TRUE(did_request_commit_);
}
@@ -4348,7 +4501,8 @@ TEST_F(LayerTreeHostImplTest, ScrollMissesChild) {
// Scroll event is ignored because the input coordinate is outside the layer
// boundaries.
EXPECT_EQ(InputHandler::SCROLL_IGNORED,
- host_impl_->ScrollBegin(gfx::Point(15, 5), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(15, 5)).get(),
+ InputHandler::WHEEL));
EXPECT_FALSE(did_request_redraw_);
EXPECT_FALSE(did_request_commit_);
}
@@ -4373,7 +4527,8 @@ TEST_F(LayerTreeHostImplTest, ScrollMissesBackfacingChild) {
// Scroll event is ignored because the scrollable layer is not facing the
// viewer and there is nothing scrollable behind it.
EXPECT_EQ(InputHandler::SCROLL_IGNORED,
- host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
+ InputHandler::WHEEL));
EXPECT_FALSE(did_request_redraw_);
EXPECT_FALSE(did_request_commit_);
}
@@ -4402,7 +4557,8 @@ TEST_F(LayerTreeHostImplTest, ScrollBlockedByContentLayer) {
// Scrolling fails because the content layer is asking to be scrolled on the
// main thread.
EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD,
- host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
+ InputHandler::WHEEL));
}
TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnMainThread) {
@@ -4429,9 +4585,10 @@ TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnMainThread) {
gfx::Vector2d expected_scroll_delta = scroll_delta;
gfx::ScrollOffset expected_max_scroll = root_scroll->MaxScrollOffset();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
+ InputHandler::WHEEL));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
// Set new page scale from main thread.
host_impl_->active_tree()->PushPageScaleFromMainThread(page_scale, 1.f, 2.f);
@@ -4472,16 +4629,18 @@ TEST_F(LayerTreeHostImplTest, ScrollRootAndChangePageScaleOnImplThread) {
gfx::Vector2d expected_scroll_delta = scroll_delta;
gfx::ScrollOffset expected_max_scroll = root_scroll->MaxScrollOffset();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
+ InputHandler::WHEEL));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
// Set new page scale on impl thread by pinching.
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale, gfx::Point());
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
DrawOneFrame();
// The scroll delta is not scaled because the main thread did not scale.
@@ -4525,11 +4684,12 @@ TEST_F(LayerTreeHostImplTest, PageScaleDeltaAppliedToRootScrollLayerOnly) {
// Set new page scale on impl thread by pinching.
RebuildPropertyTrees();
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(new_page_scale, gfx::Point());
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
DrawOneFrame();
// Make sure all the layers are drawn with the page scale delta applied, i.e.,
@@ -4566,9 +4726,10 @@ TEST_F(LayerTreeHostImplTest, ScrollChildAndChangePageScaleOnMainThread) {
gfx::Vector2d expected_scroll_delta(scroll_delta);
gfx::ScrollOffset expected_max_scroll(outer_scroll->MaxScrollOffset());
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
+ InputHandler::WHEEL));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
float page_scale = 2.f;
host_impl_->active_tree()->PushPageScaleFromMainThread(page_scale, 1.f,
@@ -4616,9 +4777,10 @@ TEST_F(LayerTreeHostImplTest, ScrollChildBeyondLimit) {
{
gfx::Vector2d scroll_delta(-8, -7);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
scoped_ptr<ScrollAndScaleSet> scroll_info =
host_impl_->ProcessScrollDeltas();
@@ -4675,10 +4837,10 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
{
gfx::Vector2d scroll_delta(0, -10);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(),
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
InputHandler::NON_BUBBLING_GESTURE));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
scoped_ptr<ScrollAndScaleSet> scroll_info =
host_impl_->ProcessScrollDeltas();
@@ -4700,12 +4862,12 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
// The next time we scroll we should only scroll the parent.
scroll_delta = gfx::Vector2d(0, -3);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(5, 5),
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
InputHandler::NON_BUBBLING_GESTURE));
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child);
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
scroll_info = host_impl_->ProcessScrollDeltas();
@@ -4721,12 +4883,12 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
// should still scroll the child.
scroll_delta = gfx::Vector2d(0, 7);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(5, 5),
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
InputHandler::NON_BUBBLING_GESTURE));
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child);
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
scroll_info = host_impl_->ProcessScrollDeltas();
@@ -4744,11 +4906,11 @@ TEST_F(LayerTreeHostImplTest, ScrollWithoutBubbling) {
scroll_delta = gfx::Vector2d(0, -2);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(1, 1),
+ host_impl_->ScrollBegin(BeginState(gfx::Point(1, 1)).get(),
InputHandler::NON_BUBBLING_GESTURE));
EXPECT_EQ(grand_child, host_impl_->CurrentlyScrollingLayer());
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
scroll_info = host_impl_->ProcessScrollDeltas();
@@ -4790,9 +4952,10 @@ TEST_F(LayerTreeHostImplTest, ScrollEventBubbling) {
{
gfx::Vector2d scroll_delta(0, 4);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
+ InputHandler::WHEEL));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
scoped_ptr<ScrollAndScaleSet> scroll_info =
host_impl_->ProcessScrollDeltas();
@@ -4844,7 +5007,8 @@ TEST_F(LayerTreeHostImplTest, ScrollBeforeRedraw) {
// Scrolling should still work even though we did not draw yet.
RebuildPropertyTrees();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
+ InputHandler::WHEEL));
}
TEST_F(LayerTreeHostImplTest, ScrollAxisAlignedRotatedLayer) {
@@ -4863,9 +5027,10 @@ TEST_F(LayerTreeHostImplTest, ScrollAxisAlignedRotatedLayer) {
// Scroll to the right in screen coordinates with a gesture.
gfx::Vector2d gesture_scroll_delta(10, 0);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), gesture_scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
// The layer should have scrolled down in its local coordinates.
scoped_ptr<ScrollAndScaleSet> scroll_info = host_impl_->ProcessScrollDeltas();
@@ -4876,9 +5041,10 @@ TEST_F(LayerTreeHostImplTest, ScrollAxisAlignedRotatedLayer) {
scroll_layer->SetScrollDelta(gfx::Vector2dF());
gfx::Vector2d wheel_scroll_delta(0, 10);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
- host_impl_->ScrollBy(gfx::Point(), wheel_scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), wheel_scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
// The layer should have scrolled down in its local coordinates.
scroll_info = host_impl_->ProcessScrollDeltas();
@@ -4922,9 +5088,10 @@ TEST_F(LayerTreeHostImplTest, ScrollNonAxisAlignedRotatedLayer) {
// Scroll down in screen coordinates with a gesture.
gfx::Vector2d gesture_scroll_delta(0, 10);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(1, 1), InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(1, 1)).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), gesture_scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
// The child layer should have scrolled down in its local coordinates an
// amount proportional to the angle between it and the input scroll delta.
@@ -4945,9 +5112,10 @@ TEST_F(LayerTreeHostImplTest, ScrollNonAxisAlignedRotatedLayer) {
child_ptr->SetScrollDelta(gfx::Vector2dF());
gfx::Vector2d gesture_scroll_delta(10, 0);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(1, 1), InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), gesture_scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point(1, 1)).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), gesture_scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
// The child layer shouldn't have scrolled.
gfx::Vector2d expected_scroll_delta(
@@ -5023,10 +5191,12 @@ TEST_F(LayerTreeHostImplTest, ScrollPerspectiveTransformedLayer) {
child_ptr->SetScrollDelta(gfx::Vector2dF());
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(viewport_point, InputHandler::GESTURE));
- host_impl_->ScrollBy(viewport_point, gesture_scroll_deltas[i]);
+ host_impl_->ScrollBegin(BeginState(viewport_point).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollBy(
+ UpdateState(viewport_point, gesture_scroll_deltas[i]).get());
viewport_point += gesture_scroll_deltas[i];
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
scroll_info = host_impl_->ProcessScrollDeltas();
EXPECT_TRUE(ScrollInfoContains(*scroll_info.get(), child_layer_id,
@@ -5055,9 +5225,10 @@ TEST_F(LayerTreeHostImplTest, ScrollScaledLayer) {
// Scroll down in screen coordinates with a gesture.
gfx::Vector2d scroll_delta(0, 10);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
// The layer should have scrolled down in its local coordinates, but half the
// amount.
@@ -5069,9 +5240,10 @@ TEST_F(LayerTreeHostImplTest, ScrollScaledLayer) {
scroll_layer->SetScrollDelta(gfx::Vector2dF());
gfx::Vector2d wheel_scroll_delta(0, 10);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
- host_impl_->ScrollBy(gfx::Point(), wheel_scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), wheel_scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
// It should apply the scale factor to the scroll delta for the wheel event.
scroll_info = host_impl_->ProcessScrollDeltas();
@@ -5209,31 +5381,33 @@ TEST_F(LayerTreeHostImplTest, RootLayerScrollOffsetDelegation) {
// The pinch gesture doesn't put the delegate into a state where the scroll
// offset is outside of the scroll range. (this is verified by DCHECKs in the
// delegate).
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(2.f, gfx::Point());
host_impl_->PinchGestureUpdate(.5f, gfx::Point());
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
// Scrolling should be relative to the offset as given by the delegate.
gfx::Vector2dF scroll_delta(0.f, 10.f);
gfx::ScrollOffset current_offset(7.f, 8.f);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
host_impl_->SetSynchronousInputHandlerRootScrollOffset(current_offset);
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
EXPECT_EQ(ScrollOffsetWithDelta(current_offset, scroll_delta),
scroll_watcher.last_set_scroll_offset());
current_offset = gfx::ScrollOffset(42.f, 41.f);
host_impl_->SetSynchronousInputHandlerRootScrollOffset(current_offset);
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
EXPECT_EQ(current_offset + gfx::ScrollOffset(scroll_delta),
scroll_watcher.last_set_scroll_offset());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
host_impl_->SetSynchronousInputHandlerRootScrollOffset(gfx::ScrollOffset());
// Forces a full tree synchronization and ensures that the scroll delegate
@@ -5296,15 +5470,18 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
// In-bounds scrolling does not affect overscroll.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_FALSE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(), scroll_result.unused_scroll_delta);
EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
// Overscroll events are reflected immediately.
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 50));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, 50)).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_TRUE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(0, 10), scroll_result.unused_scroll_delta);
@@ -5313,7 +5490,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
host_impl_->accumulated_root_overscroll());
// In-bounds scrolling resets accumulated overscroll for the scrolled axes.
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -50));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, -50)).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_FALSE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(), scroll_result.unused_scroll_delta);
@@ -5321,7 +5499,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
EXPECT_EQ(scroll_result.accumulated_root_overscroll,
host_impl_->accumulated_root_overscroll());
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -10));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, -10)).get());
EXPECT_FALSE(scroll_result.did_scroll);
EXPECT_TRUE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(0, -10), scroll_result.unused_scroll_delta);
@@ -5329,7 +5508,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
EXPECT_EQ(scroll_result.accumulated_root_overscroll,
host_impl_->accumulated_root_overscroll());
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, 0));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(10, 0)).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_FALSE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(0, 0), scroll_result.unused_scroll_delta);
@@ -5337,7 +5517,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
EXPECT_EQ(scroll_result.accumulated_root_overscroll,
host_impl_->accumulated_root_overscroll());
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(-15, 0));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(-15, 0)).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_TRUE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(-5, 0), scroll_result.unused_scroll_delta);
@@ -5345,7 +5526,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
EXPECT_EQ(scroll_result.accumulated_root_overscroll,
host_impl_->accumulated_root_overscroll());
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 60));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, 60)).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_TRUE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(0, 10), scroll_result.unused_scroll_delta);
@@ -5353,7 +5535,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
EXPECT_EQ(scroll_result.accumulated_root_overscroll,
host_impl_->accumulated_root_overscroll());
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(10, -60));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(10, -60)).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_TRUE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(0, -10), scroll_result.unused_scroll_delta);
@@ -5363,7 +5546,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
// Overscroll accumulates within the scope of ScrollBegin/ScrollEnd as long
// as no scroll occurs.
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -20));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, -20)).get());
EXPECT_FALSE(scroll_result.did_scroll);
EXPECT_TRUE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(0, -20), scroll_result.unused_scroll_delta);
@@ -5371,7 +5555,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
EXPECT_EQ(scroll_result.accumulated_root_overscroll,
host_impl_->accumulated_root_overscroll());
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -20));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, -20)).get());
EXPECT_FALSE(scroll_result.did_scroll);
EXPECT_TRUE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(0, -20), scroll_result.unused_scroll_delta);
@@ -5380,7 +5565,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
host_impl_->accumulated_root_overscroll());
// Overscroll resets on valid scroll.
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_FALSE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(0, 0), scroll_result.unused_scroll_delta);
@@ -5388,7 +5574,8 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
EXPECT_EQ(scroll_result.accumulated_root_overscroll,
host_impl_->accumulated_root_overscroll());
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -20));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, -20)).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_TRUE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(0, -10), scroll_result.unused_scroll_delta);
@@ -5396,7 +5583,7 @@ TEST_F(LayerTreeHostImplTest, OverscrollRoot) {
EXPECT_EQ(scroll_result.accumulated_root_overscroll,
host_impl_->accumulated_root_overscroll());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
}
@@ -5432,42 +5619,45 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildWithoutBubbling) {
{
gfx::Vector2d scroll_delta(0, -10);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(),
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
InputHandler::NON_BUBBLING_GESTURE));
- scroll_result = host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ scroll_result =
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_FALSE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
// The next time we scroll we should only scroll the parent, but overscroll
// should still not reach the root layer.
scroll_delta = gfx::Vector2d(0, -30);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(5, 5),
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
InputHandler::NON_BUBBLING_GESTURE));
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child_layer);
EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
- scroll_result = host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ scroll_result =
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_FALSE(scroll_result.did_overscroll_root);
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child_layer);
EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
// After scrolling the parent, another scroll on the opposite direction
// should scroll the child.
scroll_delta = gfx::Vector2d(0, 70);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(5, 5),
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
InputHandler::NON_BUBBLING_GESTURE));
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child_layer);
- scroll_result = host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ scroll_result =
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_FALSE(scroll_result.did_overscroll_root);
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child_layer);
EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
}
}
@@ -5481,20 +5671,24 @@ TEST_F(LayerTreeHostImplTest, OverscrollChildEventBubbling) {
{
gfx::Vector2d scroll_delta(0, 8);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::WHEEL));
- scroll_result = host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
+ InputHandler::WHEEL));
+ scroll_result =
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_FALSE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
- scroll_result = host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ scroll_result =
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_TRUE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(0, 6), host_impl_->accumulated_root_overscroll());
- scroll_result = host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ scroll_result =
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
EXPECT_FALSE(scroll_result.did_scroll);
EXPECT_TRUE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(0, 14), host_impl_->accumulated_root_overscroll());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
}
}
@@ -5513,8 +5707,10 @@ TEST_F(LayerTreeHostImplTest, OverscrollAlways) {
// Even though the layer can't scroll the overscroll still happens.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get());
EXPECT_FALSE(scroll_result.did_scroll);
EXPECT_TRUE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF(0, 10), host_impl_->accumulated_root_overscroll());
@@ -5530,49 +5726,53 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) {
// of the content. unnecessary glow effect calls shouldn't be
// called while scrolling up without reaching the edge of the content.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::WHEEL));
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 100));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
+ InputHandler::WHEEL));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2dF(0, 100)).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_FALSE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF().ToString(),
host_impl_->accumulated_root_overscroll().ToString());
- scroll_result =
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, -2.30f));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2dF(0, -2.30f)).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_FALSE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF().ToString(),
host_impl_->accumulated_root_overscroll().ToString());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
// unusedrootDelta should be subtracted from applied delta so that
// unwanted glow effect calls are not called.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(0, 0),
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
InputHandler::NON_BUBBLING_GESTURE));
EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 20));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2dF(0, 20)).get());
EXPECT_TRUE(scroll_result.did_scroll);
EXPECT_TRUE(scroll_result.did_overscroll_root);
EXPECT_VECTOR2DF_EQ(gfx::Vector2dF(0.000000f, 17.699997f),
host_impl_->accumulated_root_overscroll());
- scroll_result =
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0.02f, -0.01f));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2dF(0.02f, -0.01f)).get());
EXPECT_FALSE(scroll_result.did_scroll);
EXPECT_FALSE(scroll_result.did_overscroll_root);
EXPECT_VECTOR2DF_EQ(gfx::Vector2dF(0.000000f, 17.699997f),
host_impl_->accumulated_root_overscroll());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
// TestCase to check kEpsilon, which prevents minute values to trigger
// gloweffect without reaching edge.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(0, 0), InputHandler::WHEEL));
- scroll_result =
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(-0.12f, 0.1f));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(0, 0)).get(),
+ InputHandler::WHEEL));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2dF(-0.12f, 0.1f)).get());
EXPECT_FALSE(scroll_result.did_scroll);
EXPECT_FALSE(scroll_result.did_overscroll_root);
EXPECT_EQ(gfx::Vector2dF().ToString(),
host_impl_->accumulated_root_overscroll().ToString());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
}
}
@@ -7260,15 +7460,16 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldNotBubble) {
DrawFrame();
{
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
gfx::Vector2d scroll_delta(0, 100);
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
scoped_ptr<ScrollAndScaleSet> scroll_info =
host_impl_->ProcessScrollDeltas();
@@ -7312,8 +7513,11 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldContinueScrollingCurrentLayer) {
gfx::Vector2d scroll_delta(0, -2);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ EXPECT_TRUE(
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get())
+ .did_scroll);
// The grand child should have scrolled up to its limit.
scroll_info = host_impl_->ProcessScrollDeltas();
@@ -7323,7 +7527,9 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldContinueScrollingCurrentLayer) {
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child);
// The locked scrolling layer should remain set as the grand child.
- EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
+ EXPECT_FALSE(
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get())
+ .did_scroll);
scroll_info = host_impl_->ProcessScrollDeltas();
ASSERT_EQ(1u, scroll_info->scrolls.size());
EXPECT_TRUE(
@@ -7332,7 +7538,9 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldContinueScrollingCurrentLayer) {
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child);
EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
- EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
+ EXPECT_FALSE(
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get())
+ .did_scroll);
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child);
// The child should not have scrolled.
@@ -7343,9 +7551,11 @@ TEST_F(LayerTreeHostImplTest, TouchFlingShouldContinueScrollingCurrentLayer) {
ExpectNone(*scroll_info, child->id());
// As the locked layer is at it's limit, no further scrolling can occur.
- EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
+ EXPECT_FALSE(
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get())
+ .did_scroll);
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), grand_child);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
}
}
@@ -7371,15 +7581,16 @@ TEST_F(LayerTreeHostImplTest, WheelFlingShouldntBubble) {
DrawFrame();
{
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
gfx::Vector2d scroll_delta(0, 100);
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
scoped_ptr<ScrollAndScaleSet> scroll_info =
host_impl_->ProcessScrollDeltas();
@@ -7418,7 +7629,8 @@ TEST_F(LayerTreeHostImplTest, ScrollUnknownNotOnAncestorChain) {
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_UNKNOWN,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
}
TEST_F(LayerTreeHostImplTest, ScrollUnknownScrollAncestorMismatch) {
@@ -7456,7 +7668,8 @@ TEST_F(LayerTreeHostImplTest, ScrollUnknownScrollAncestorMismatch) {
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_UNKNOWN,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
}
TEST_F(LayerTreeHostImplTest, NotScrollInvisibleScroller) {
@@ -7485,7 +7698,8 @@ TEST_F(LayerTreeHostImplTest, NotScrollInvisibleScroller) {
// Why SCROLL_STARTED? In this case, it's because we've bubbled out and
// started scrolling the inner viewport.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
EXPECT_EQ(2, host_impl_->CurrentlyScrollingLayer()->id());
}
@@ -7521,7 +7735,8 @@ TEST_F(LayerTreeHostImplTest, ScrollInvisibleScrollerWithVisibleDescendent) {
// We should have scrolled |invisible_scroll_layer| as it was hit and it has
// a descendant which is a drawn RSLL member.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
EXPECT_EQ(7, host_impl_->CurrentlyScrollingLayer()->id());
}
@@ -7574,7 +7789,8 @@ TEST_F(LayerTreeHostImplTest, ScrollInvisibleScrollerWithVisibleScrollChild) {
// The reason for this is that if the scrolling the scroll would move a layer
// that is a drawn RSLL member, then we should accept this hit.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
EXPECT_EQ(7, host_impl_->CurrentlyScrollingLayer()->id());
}
@@ -7765,10 +7981,13 @@ TEST_F(LayerTreeHostImplTest, SimpleSwapPromiseMonitor) {
// Scrolling normally should not trigger any forwarding.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)).did_scroll);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get())
+ .did_scroll);
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_EQ(0, set_needs_commit_count);
EXPECT_EQ(1, set_needs_redraw_count);
@@ -7778,10 +7997,13 @@ TEST_F(LayerTreeHostImplTest, SimpleSwapPromiseMonitor) {
// thread.
scroll_layer->SetHaveScrollEventHandlers(true);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10)).did_scroll);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, 10)).get())
+ .did_scroll);
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_EQ(0, set_needs_commit_count);
EXPECT_EQ(2, set_needs_redraw_count);
@@ -7858,7 +8080,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF().ToString(),
scroll_layer->CurrentScrollOffset().ToString());
@@ -7866,7 +8089,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
// Scroll just the top controls and verify that the scroll succeeds.
const float residue = 10;
float offset = top_controls_height_ - residue;
- result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset));
+ result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get());
EXPECT_EQ(result.unused_scroll_delta, gfx::Vector2d(0, 0));
EXPECT_TRUE(result.did_scroll);
EXPECT_FLOAT_EQ(-offset,
@@ -7877,7 +8101,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
// Scroll across the boundary
const float content_scroll = 20;
offset = residue + content_scroll;
- result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset));
+ result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get());
EXPECT_TRUE(result.did_scroll);
EXPECT_EQ(result.unused_scroll_delta, gfx::Vector2d(0, 0));
EXPECT_EQ(-top_controls_height_,
@@ -7887,7 +8112,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
// Now scroll back to the top of the content
offset = -content_scroll;
- result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset));
+ result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get());
EXPECT_TRUE(result.did_scroll);
EXPECT_EQ(result.unused_scroll_delta, gfx::Vector2d(0, 0));
EXPECT_EQ(-top_controls_height_,
@@ -7897,7 +8123,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
// And scroll the top controls completely into view
offset = -top_controls_height_;
- result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset));
+ result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get());
EXPECT_TRUE(result.did_scroll);
EXPECT_EQ(result.unused_scroll_delta, gfx::Vector2d(0, 0));
EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
@@ -7905,14 +8132,15 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, ScrollHandledByTopControls) {
scroll_layer->CurrentScrollOffset().ToString());
// And attempt to scroll past the end
- result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset));
+ result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get());
EXPECT_FALSE(result.did_scroll);
EXPECT_EQ(result.unused_scroll_delta, gfx::Vector2d(0, -50));
EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF().ToString(),
scroll_layer->CurrentScrollOffset().ToString());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
}
TEST_F(LayerTreeHostImplWithTopControlsTest, WheelUnhandledByTopControls) {
@@ -7926,7 +8154,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, WheelUnhandledByTopControls) {
LayerImpl* viewport_layer = host_impl_->InnerViewportScrollLayer();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(), viewport_layer->CurrentScrollOffset());
@@ -7934,13 +8163,17 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, WheelUnhandledByTopControls) {
// directly through to the viewport.
const float delta = top_controls_height_;
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, delta)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, delta)).get())
+ .did_scroll);
EXPECT_FLOAT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(0, delta),
viewport_layer->CurrentScrollOffset());
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, delta)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, delta)).get())
+ .did_scroll);
EXPECT_FLOAT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
EXPECT_VECTOR_EQ(gfx::Vector2dF(0, delta * 2),
viewport_layer->CurrentScrollOffset());
@@ -7954,7 +8187,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAtOrigin) {
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF().ToString(),
scroll_layer->CurrentScrollOffset().ToString());
@@ -7963,7 +8197,9 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAtOrigin) {
const float residue = 35;
float offset = top_controls_height_ - residue;
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
+ .did_scroll);
EXPECT_FLOAT_EQ(-offset,
host_impl_->top_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF().ToString(),
@@ -7974,7 +8210,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAtOrigin) {
did_request_commit_ = false;
// End the scroll while the controls are still offset from their limit.
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
ASSERT_TRUE(host_impl_->top_controls_manager()->has_animation());
EXPECT_TRUE(did_request_next_frame_);
EXPECT_TRUE(did_request_redraw_);
@@ -8028,7 +8264,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) {
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(),
scroll_layer->CurrentScrollOffset().ToString());
@@ -8037,7 +8274,9 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) {
const float residue = 15;
float offset = top_controls_height_ - residue;
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
+ .did_scroll);
EXPECT_FLOAT_EQ(-offset,
host_impl_->top_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(),
@@ -8048,7 +8287,7 @@ TEST_F(LayerTreeHostImplWithTopControlsTest, TopControlsAnimationAfterScroll) {
did_request_commit_ = false;
// End the scroll while the controls are still offset from the limit.
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
ASSERT_TRUE(host_impl_->top_controls_manager()->has_animation());
EXPECT_TRUE(did_request_next_frame_);
EXPECT_TRUE(did_request_redraw_);
@@ -8095,7 +8334,8 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(),
scroll_layer->CurrentScrollOffset().ToString());
@@ -8104,7 +8344,9 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
const float residue = 15;
float offset = top_controls_height_ - residue;
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
+ .did_scroll);
EXPECT_FLOAT_EQ(-offset,
host_impl_->top_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF(0, initial_scroll_offset).ToString(),
@@ -8160,23 +8402,30 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
float offset = 50;
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
+ .did_scroll);
EXPECT_EQ(-offset, host_impl_->top_controls_manager()->ControlsTopOffset());
EXPECT_EQ(gfx::Vector2dF().ToString(),
scroll_layer->CurrentScrollOffset().ToString());
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
+ .did_scroll);
EXPECT_EQ(gfx::Vector2dF(0, offset).ToString(),
scroll_layer->CurrentScrollOffset().ToString());
EXPECT_TRUE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, offset)).did_scroll);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, offset)).get())
+ .did_scroll);
// Should have fully scrolled
EXPECT_EQ(gfx::Vector2dF(0, scroll_layer->MaxScrollOffset().y()).ToString(),
@@ -8186,28 +8435,34 @@ TEST_F(LayerTreeHostImplWithTopControlsTest,
// Overscroll the content
EXPECT_FALSE(
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, overscrollamount))
+ host_impl_->ScrollBy(UpdateState(gfx::Point(),
+ gfx::Vector2d(0, overscrollamount))
+ .get())
.did_scroll);
EXPECT_EQ(gfx::Vector2dF(0, 2 * offset).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))
+ EXPECT_TRUE(host_impl_->ScrollBy(UpdateState(gfx::Point(),
+ gfx::Vector2d(0, -2 * offset))
+ .get())
.did_scroll);
EXPECT_EQ(gfx::Vector2dF(0, 0).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);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2d(0, -offset)).get())
+ .did_scroll);
EXPECT_EQ(gfx::Vector2dF(0, 0).ToString(),
scroll_layer->CurrentScrollOffset().ToString());
// Top controls should be fully visible
EXPECT_EQ(0, host_impl_->top_controls_manager()->ControlsTopOffset());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
}
class LayerTreeHostImplVirtualViewportTest : public LayerTreeHostImplTest {
@@ -8322,18 +8577,19 @@ TEST_F(LayerTreeHostImplVirtualViewportTest, FlingScrollBubblesToInner) {
// Scrolling the viewport always sets the outer scroll layer as the
// currently scrolling layer.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
gfx::Vector2d scroll_delta(inner_viewport.width() / 2.f,
inner_viewport.height() / 2.f);
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
inner_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y());
EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_EQ(nullptr, host_impl_->CurrentlyScrollingLayer());
EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset());
@@ -8341,20 +8597,21 @@ TEST_F(LayerTreeHostImplVirtualViewportTest, FlingScrollBubblesToInner) {
// Fling past the inner viewport boundry, make sure outer viewport scrolls.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
inner_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y());
EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
outer_expected += gfx::Vector2dF(scroll_delta.x(), scroll_delta.y());
EXPECT_EQ(inner_scroll, host_impl_->CurrentlyScrollingLayer());
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_EQ(nullptr, host_impl_->CurrentlyScrollingLayer());
EXPECT_VECTOR_EQ(inner_expected, inner_scroll->CurrentScrollOffset());
@@ -8381,7 +8638,8 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
// Make sure the scroll goes to the inner viewport first.
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
InputHandler::GESTURE));
@@ -8389,7 +8647,7 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
// Scroll near the edge of the outer viewport.
gfx::Vector2d scroll_delta(inner_viewport.width() / 2.f,
inner_viewport.height() / 2.f);
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
inner_expected += scroll_delta;
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
InputHandler::GESTURE));
@@ -8400,12 +8658,13 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
// Now diagonal scroll across the outer viewport boundary in a single event.
// The entirety of the scroll should be consumed, as bubbling between inner
// and outer viewport layers is perfect.
- host_impl_->ScrollBy(gfx::Point(), gfx::ScaleVector2d(scroll_delta, 2));
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::ScaleVector2d(scroll_delta, 2)).get());
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
InputHandler::GESTURE));
outer_expected += scroll_delta;
inner_expected += scroll_delta;
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
gfx::Point(), InputHandler::GESTURE));
@@ -8436,8 +8695,11 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
gfx::Vector2d scroll_delta(0, inner_viewport.height());
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- EXPECT_TRUE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ EXPECT_TRUE(
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get())
+ .did_scroll);
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
InputHandler::GESTURE));
@@ -8450,7 +8712,9 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
// The fling have no effect on the currently scrolling layer.
EXPECT_EQ(InputHandler::SCROLL_STARTED, host_impl_->FlingScrollBegin());
- EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
+ EXPECT_FALSE(
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get())
+ .did_scroll);
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child_scroll);
EXPECT_TRUE(host_impl_->IsCurrentlyScrollingLayerAt(gfx::Point(),
InputHandler::GESTURE));
@@ -8463,9 +8727,11 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
ExpectNone(*scroll_info, inner_scroll->id());
// As the locked layer is at its limit, no further scrolling can occur.
- EXPECT_FALSE(host_impl_->ScrollBy(gfx::Point(), scroll_delta).did_scroll);
+ EXPECT_FALSE(
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get())
+ .did_scroll);
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child_scroll);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_FALSE(host_impl_->IsCurrentlyScrollingLayerAt(
gfx::Point(), InputHandler::GESTURE));
}
@@ -8490,13 +8756,15 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
DrawFrame();
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->RootScrollBegin(InputHandler::GESTURE));
+ host_impl_->RootScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), inner_scroll);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
EXPECT_EQ(host_impl_->CurrentlyScrollingLayer(), child_scroll);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
}
TEST_F(LayerTreeHostImplVirtualViewportTest,
@@ -8516,8 +8784,10 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
// Ensure inner viewport doesn't react to scrolls (test it's unscrollable).
EXPECT_VECTOR_EQ(gfx::Vector2dF(), inner_scroll->CurrentScrollOffset());
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE));
- scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, 100));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE));
+ scroll_result = host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2dF(0, 100)).get());
EXPECT_VECTOR_EQ(gfx::Vector2dF(), inner_scroll->CurrentScrollOffset());
// When inner viewport is unscrollable, a fling gives zero overscroll.
@@ -9034,19 +9304,21 @@ TEST_F(LayerTreeHostImplTest, WheelScrollWithPageScaleFactorOnInnerLayer) {
scroll_layer->SetScrollDelta(gfx::Vector2d());
float page_scale_delta = 2.f;
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::GESTURE);
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::GESTURE);
host_impl_->PinchGestureBegin();
host_impl_->PinchGestureUpdate(page_scale_delta, gfx::Point());
host_impl_->PinchGestureEnd();
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
gfx::Vector2dF scroll_delta(0, 5);
EXPECT_EQ(InputHandler::SCROLL_STARTED,
- host_impl_->ScrollBegin(gfx::Point(), InputHandler::WHEEL));
+ host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
+ InputHandler::WHEEL));
EXPECT_VECTOR_EQ(gfx::Vector2dF(), scroll_layer->CurrentScrollOffset());
- host_impl_->ScrollBy(gfx::Point(), scroll_delta);
- host_impl_->ScrollEnd();
+ host_impl_->ScrollBy(UpdateState(gfx::Point(), scroll_delta).get());
+ host_impl_->ScrollEnd(EndState().get());
EXPECT_VECTOR_EQ(gfx::Vector2dF(0, 2.5),
scroll_layer->CurrentScrollOffset());
}
@@ -9445,10 +9717,12 @@ TEST_F(LayerTreeHostImplTest, JitterTest) {
for (int i = 0; i < host_impl_->pending_tree()->kFixedPointHitsThreshold + 1;
++i) {
host_impl_->ActivateSyncTree();
- host_impl_->ScrollBegin(gfx::Point(5, 5), InputHandler::GESTURE);
- host_impl_->ScrollBy(gfx::Point(), gfx::Vector2dF(0, scroll));
+ host_impl_->ScrollBegin(BeginState(gfx::Point(5, 5)).get(),
+ InputHandler::GESTURE);
+ host_impl_->ScrollBy(
+ UpdateState(gfx::Point(), gfx::Vector2dF(0, scroll)).get());
accumulated_scroll += scroll;
- host_impl_->ScrollEnd();
+ host_impl_->ScrollEnd(EndState().get());
host_impl_->active_tree()->UpdateDrawProperties(false);
host_impl_->CreatePendingTree();
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc
index 380a0c2..ac20d47 100644
--- a/cc/trees/layer_tree_host_unittest_scroll.cc
+++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -28,6 +28,22 @@
namespace cc {
namespace {
+scoped_ptr<ScrollState> BeginState(const gfx::Point& point) {
+ return ScrollState::Create(gfx::Vector2dF(), point, gfx::Vector2dF(), true,
+ false, false);
+}
+
+scoped_ptr<ScrollState> UpdateState(const gfx::Point& point,
+ const gfx::Vector2dF& delta) {
+ return ScrollState::Create(delta, point, gfx::Vector2dF(), false, false,
+ false);
+}
+
+scoped_ptr<ScrollState> EndState() {
+ return ScrollState::Create(gfx::Vector2dF(), gfx::Point(), gfx::Vector2dF(),
+ false, false, true);
+}
+
class LayerTreeHostScrollTest : public LayerTreeTest {
protected:
void SetupTree() override {
@@ -587,15 +603,16 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest {
case 0: {
// GESTURE scroll on impl thread. Also tests that the last scrolled
// layer id is stored even after the scrolling ends.
- InputHandler::ScrollStatus status = impl->ScrollBegin(
+ gfx::Point scroll_point =
gfx::ToCeiledPoint(expected_scroll_layer_impl->position() -
- gfx::Vector2dF(0.5f, 0.5f)),
- InputHandler::GESTURE);
+ gfx::Vector2dF(0.5f, 0.5f));
+ InputHandler::ScrollStatus status = impl->ScrollBegin(
+ BeginState(scroll_point).get(), InputHandler::GESTURE);
EXPECT_EQ(InputHandler::SCROLL_STARTED, status);
- impl->ScrollBy(gfx::Point(), scroll_amount_);
+ impl->ScrollBy(UpdateState(gfx::Point(), scroll_amount_).get());
LayerImpl* scrolling_layer = impl->CurrentlyScrollingLayer();
CHECK(scrolling_layer);
- impl->ScrollEnd();
+ impl->ScrollEnd(EndState().get());
CHECK(!impl->CurrentlyScrollingLayer());
EXPECT_EQ(scrolling_layer->id(),
impl->active_tree()->LastScrolledLayerId());
@@ -609,13 +626,14 @@ class LayerTreeHostScrollTestCaseWithChild : public LayerTreeHostScrollTest {
}
case 1: {
// WHEEL scroll on impl thread.
- InputHandler::ScrollStatus status = impl->ScrollBegin(
+ gfx::Point scroll_point =
gfx::ToCeiledPoint(expected_scroll_layer_impl->position() +
- gfx::Vector2dF(0.5f, 0.5f)),
- InputHandler::WHEEL);
+ gfx::Vector2dF(0.5f, 0.5f));
+ InputHandler::ScrollStatus status = impl->ScrollBegin(
+ BeginState(scroll_point).get(), InputHandler::WHEEL);
EXPECT_EQ(InputHandler::SCROLL_STARTED, status);
- impl->ScrollBy(gfx::Point(), scroll_amount_);
- impl->ScrollEnd();
+ impl->ScrollBy(UpdateState(gfx::Point(), scroll_amount_).get());
+ impl->ScrollEnd(EndState().get());
// Check the scroll is applied as a delta.
EXPECT_VECTOR_EQ(javascript_scroll_,
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 516abb0..513ce5e 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -1884,7 +1884,9 @@ void LayerTreeImpl::GetViewportSelection(ViewportSelection* selection) {
}
void LayerTreeImpl::InputScrollAnimationFinished() {
- layer_tree_host_impl_->ScrollEnd();
+ // TODO(majidvp): We should pass in the original starting scroll position here
+ ScrollState scroll_state(0, 0, 0, 0, 0, 0, false, false, false);
+ layer_tree_host_impl_->ScrollEnd(&scroll_state);
}
bool LayerTreeImpl::SmoothnessTakesPriority() const {
diff --git a/ui/events/blink/input_handler_proxy.cc b/ui/events/blink/input_handler_proxy.cc
index 8ba8b03..b0b7659 100644
--- a/ui/events/blink/input_handler_proxy.cc
+++ b/ui/events/blink/input_handler_proxy.cc
@@ -121,6 +121,31 @@ WebGestureEvent ObtainGestureScrollBegin(const WebGestureEvent& event) {
return scroll_begin_event;
}
+cc::ScrollState CreateScrollStateForGesture(const WebGestureEvent& event) {
+ switch (event.type) {
+ case WebInputEvent::GestureScrollBegin:
+ return cc::ScrollState(0, 0, event.x, event.y, 0, 0, true, false, false);
+ case WebInputEvent::GestureFlingStart:
+ return cc::ScrollState(
+ 0, 0, event.x, event.y, event.data.flingStart.velocityX,
+ event.data.flingStart.velocityX, true, true, false);
+ case WebInputEvent::GestureScrollUpdate:
+ return cc::ScrollState(-event.data.scrollUpdate.deltaX,
+ -event.data.scrollUpdate.deltaY, event.x, event.y,
+ event.data.scrollUpdate.velocityX,
+ event.data.scrollUpdate.velocityY,
+ event.data.scrollUpdate.inertial, false, false);
+ case WebInputEvent::GestureScrollEnd:
+ return cc::ScrollState(0, 0, event.x, event.y, 0, 0, false, false, true);
+ case WebInputEvent::GestureFlingCancel:
+ return cc::ScrollState(0, 0, event.x, event.y, 0, 0, false, true, true);
+
+ default:
+ NOTREACHED();
+ return cc::ScrollState(0, 0, 0, 0, 0, 0, false, false, false);
+ }
+}
+
void ReportInputEventLatencyUma(const WebInputEvent& event,
const ui::LatencyInfo& latency_info) {
if (!(event.type == WebInputEvent::GestureScrollBegin ||
@@ -383,18 +408,29 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel(
break;
}
} else {
- cc::InputHandler::ScrollStatus scroll_status = input_handler_->ScrollBegin(
- gfx::Point(wheel_event.x, wheel_event.y), cc::InputHandler::WHEEL);
+ cc::ScrollState scroll_state_begin(0, 0, wheel_event.x, wheel_event.y, 0, 0,
+ true, false, false);
+ cc::InputHandler::ScrollStatus scroll_status =
+ input_handler_->ScrollBegin(&scroll_state_begin,
+ cc::InputHandler::WHEEL);
switch (scroll_status) {
case cc::InputHandler::SCROLL_STARTED: {
TRACE_EVENT_INSTANT2("input",
"InputHandlerProxy::handle_input wheel scroll",
TRACE_EVENT_SCOPE_THREAD, "deltaX",
scroll_delta.x(), "deltaY", scroll_delta.y());
- gfx::Point scroll_point(wheel_event.x, wheel_event.y);
- scroll_result = input_handler_->ScrollBy(scroll_point, scroll_delta);
- HandleOverscroll(scroll_point, scroll_result);
- input_handler_->ScrollEnd();
+ cc::ScrollState scroll_state_update(scroll_delta.x(), scroll_delta.y(),
+ wheel_event.x, wheel_event.y, 0, 0,
+ false, false, false);
+
+ scroll_result = input_handler_->ScrollBy(&scroll_state_update);
+ HandleOverscroll(gfx::Point(wheel_event.x, wheel_event.y),
+ scroll_result);
+
+ cc::ScrollState scroll_state_end(0, 0, wheel_event.x, wheel_event.y,
+ 0, 0, false, false, true);
+ input_handler_->ScrollEnd(&scroll_state_end);
+
result = scroll_result.did_scroll ? DID_HANDLE : DROP_EVENT;
break;
}
@@ -441,13 +477,14 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureScrollBegin(
DCHECK(!expect_scroll_update_end_);
expect_scroll_update_end_ = true;
#endif
+ cc::ScrollState scroll_state = CreateScrollStateForGesture(gesture_event);
cc::InputHandler::ScrollStatus scroll_status;
if (gesture_event.data.scrollBegin.targetViewport) {
- scroll_status = input_handler_->RootScrollBegin(cc::InputHandler::GESTURE);
+ scroll_status = input_handler_->RootScrollBegin(&scroll_state,
+ cc::InputHandler::GESTURE);
} else {
- scroll_status = input_handler_->ScrollBegin(
- gfx::Point(gesture_event.x, gesture_event.y),
- cc::InputHandler::GESTURE);
+ scroll_status =
+ input_handler_->ScrollBegin(&scroll_state, cc::InputHandler::GESTURE);
}
UMA_HISTOGRAM_ENUMERATION("Renderer4.CompositorScrollHitTestResult",
scroll_status,
@@ -481,12 +518,10 @@ InputHandlerProxy::HandleGestureScrollUpdate(
if (!gesture_scroll_on_impl_thread_ && !gesture_pinch_on_impl_thread_)
return DID_NOT_HANDLE;
- gfx::Point scroll_point(gesture_event.x, gesture_event.y);
- gfx::Vector2dF scroll_delta(-gesture_event.data.scrollUpdate.deltaX,
- -gesture_event.data.scrollUpdate.deltaY);
- cc::InputHandlerScrollResult scroll_result = input_handler_->ScrollBy(
- scroll_point, scroll_delta);
- HandleOverscroll(scroll_point, scroll_result);
+ cc::ScrollState scroll_state = CreateScrollStateForGesture(gesture_event);
+ cc::InputHandlerScrollResult scroll_result =
+ input_handler_->ScrollBy(&scroll_state);
+ HandleOverscroll(gfx::Point(gesture_event.x, gesture_event.y), scroll_result);
return scroll_result.did_scroll ? DID_HANDLE : DROP_EVENT;
}
@@ -496,7 +531,8 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureScrollEnd(
DCHECK(expect_scroll_update_end_);
expect_scroll_update_end_ = false;
#endif
- input_handler_->ScrollEnd();
+ cc::ScrollState scroll_state = CreateScrollStateForGesture(gesture_event);
+ input_handler_->ScrollEnd(&scroll_state);
if (!gesture_scroll_on_impl_thread_)
return DID_NOT_HANDLE;
gesture_scroll_on_impl_thread_ = false;
@@ -505,17 +541,17 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureScrollEnd(
InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureFlingStart(
const WebGestureEvent& gesture_event) {
+ cc::ScrollState scroll_state = CreateScrollStateForGesture(gesture_event);
cc::InputHandler::ScrollStatus scroll_status =
cc::InputHandler::SCROLL_ON_MAIN_THREAD;
switch (gesture_event.sourceDevice) {
case blink::WebGestureDeviceTouchpad:
if (gesture_event.data.flingStart.targetViewport) {
scroll_status = input_handler_->RootScrollBegin(
- cc::InputHandler::NON_BUBBLING_GESTURE);
+ &scroll_state, cc::InputHandler::NON_BUBBLING_GESTURE);
} else {
scroll_status = input_handler_->ScrollBegin(
- gfx::Point(gesture_event.x, gesture_event.y),
- cc::InputHandler::NON_BUBBLING_GESTURE);
+ &scroll_state, cc::InputHandler::NON_BUBBLING_GESTURE);
}
break;
case blink::WebGestureDeviceTouchscreen:
@@ -535,8 +571,10 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureFlingStart(
switch (scroll_status) {
case cc::InputHandler::SCROLL_STARTED: {
- if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad)
- input_handler_->ScrollEnd();
+ if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad) {
+ scroll_state.set_is_ending(true);
+ input_handler_->ScrollEnd(&scroll_state);
+ }
const float vx = gesture_event.data.flingStart.velocityX;
const float vy = gesture_event.data.flingStart.velocityY;
@@ -903,7 +941,10 @@ bool InputHandlerProxy::CancelCurrentFlingWithoutNotifyingClient() {
bool had_fling_animation = fling_curve_;
if (had_fling_animation &&
fling_parameters_.sourceDevice == blink::WebGestureDeviceTouchscreen) {
- input_handler_->ScrollEnd();
+ cc::ScrollState scroll_state(0, 0, fling_parameters_.point.x,
+ fling_parameters_.point.y, 0, 0, false, true,
+ true);
+ input_handler_->ScrollEnd(&scroll_state);
TRACE_EVENT_ASYNC_END0(
"input",
"InputHandlerProxy::HandleGestureFling::started",
@@ -1001,7 +1042,7 @@ bool InputHandlerProxy::scrollBy(const WebFloatSize& increment,
current_fling_velocity_ = clipped_velocity;
- // Early out if the increment is zero, but avoid early terimination if the
+ // Early out if the increment is zero, but avoid early termination if the
// velocity is still non-zero.
if (clipped_increment == WebFloatSize())
return clipped_velocity != WebFloatSize();
@@ -1021,8 +1062,12 @@ bool InputHandlerProxy::scrollBy(const WebFloatSize& increment,
break;
case blink::WebGestureDeviceTouchscreen: {
clipped_increment = ToClientScrollIncrement(clipped_increment);
- cc::InputHandlerScrollResult scroll_result = input_handler_->ScrollBy(
- fling_parameters_.point, clipped_increment);
+ cc::ScrollState scroll_state(
+ clipped_increment.width, clipped_increment.height,
+ fling_parameters_.point.x, fling_parameters_.point.y,
+ clipped_velocity.width, clipped_velocity.height, false, true, false);
+ cc::InputHandlerScrollResult scroll_result =
+ input_handler_->ScrollBy(&scroll_state);
HandleOverscroll(fling_parameters_.point, scroll_result);
did_scroll = scroll_result.did_scroll;
} break;
diff --git a/ui/events/blink/input_handler_proxy_unittest.cc b/ui/events/blink/input_handler_proxy_unittest.cc
index d76d891..ccf24f4 100644
--- a/ui/events/blink/input_handler_proxy_unittest.cc
+++ b/ui/events/blink/input_handler_proxy_unittest.cc
@@ -98,21 +98,19 @@ class MockInputHandler : public cc::InputHandler {
MOCK_METHOD0(SetNeedsAnimateInput, void());
MOCK_METHOD2(ScrollBegin,
- ScrollStatus(const gfx::Point& viewport_point,
+ ScrollStatus(cc::ScrollState*,
+ cc::InputHandler::ScrollInputType type));
+ MOCK_METHOD2(RootScrollBegin,
+ ScrollStatus(cc::ScrollState*,
cc::InputHandler::ScrollInputType type));
- MOCK_METHOD1(RootScrollBegin,
- ScrollStatus(cc::InputHandler::ScrollInputType type));
MOCK_METHOD2(ScrollAnimated,
ScrollStatus(const gfx::Point& viewport_point,
const gfx::Vector2dF& scroll_delta));
- MOCK_METHOD2(ScrollBy,
- cc::InputHandlerScrollResult(
- const gfx::Point& viewport_point,
- const gfx::Vector2dF& scroll_delta));
+ MOCK_METHOD1(ScrollBy, cc::InputHandlerScrollResult(cc::ScrollState*));
MOCK_METHOD2(ScrollVerticallyByPage,
bool(const gfx::Point& viewport_point,
cc::ScrollDirection direction));
- MOCK_METHOD0(ScrollEnd, void());
+ MOCK_METHOD1(ScrollEnd, void(cc::ScrollState*));
MOCK_METHOD0(FlingScrollBegin, cc::InputHandler::ScrollStatus());
scoped_ptr<cc::SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor(
@@ -415,9 +413,9 @@ TEST_P(InputHandlerProxyTest, DISABLED_MouseWheelWithPreciseScrollingDeltas) {
wheel.hasPreciseScrollingDeltas = true;
EXPECT_CALL(mock_input_handler_, ScrollBegin(::testing::_, ::testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_, ScrollBy(::testing::_, ::testing::_))
+ EXPECT_CALL(mock_input_handler_, ScrollBy(::testing::_))
.WillOnce(testing::Return(scroll_result_did_scroll_));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(wheel));
VERIFY_AND_RESET_MOCKS();
@@ -459,9 +457,9 @@ TEST_P(InputHandlerProxyTest, GestureScrollStarted) {
gesture_.type = WebInputEvent::GestureScrollUpdate;
gesture_.data.scrollUpdate.deltaY =
-40; // -Y means scroll down - i.e. in the +Y direction.
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::y, testing::Gt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Gt(0))))
.WillOnce(testing::Return(scroll_result_did_not_scroll_));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -472,9 +470,9 @@ TEST_P(InputHandlerProxyTest, GestureScrollStarted) {
gesture_.type = WebInputEvent::GestureScrollUpdate;
gesture_.data.scrollUpdate.deltaY =
-40; // -Y means scroll down - i.e. in the +Y direction.
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::y, testing::Gt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Gt(0))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -482,7 +480,7 @@ TEST_P(InputHandlerProxyTest, GestureScrollStarted) {
gesture_.type = WebInputEvent::GestureScrollEnd;
gesture_.data.scrollUpdate.deltaY = 0;
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -509,7 +507,8 @@ TEST_P(InputHandlerProxyTest, GestureScrollOnMainThread) {
gesture_.type = WebInputEvent::GestureScrollEnd;
gesture_.data.scrollUpdate.deltaY = 0;
- EXPECT_CALL(mock_input_handler_, ScrollEnd()).WillOnce(testing::Return());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_))
+ .WillOnce(testing::Return());
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -532,7 +531,8 @@ TEST_P(InputHandlerProxyTest, GestureScrollIgnored) {
expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
gesture_.type = WebInputEvent::GestureScrollEnd;
- EXPECT_CALL(mock_input_handler_, ScrollEnd()).WillOnce(testing::Return());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_))
+ .WillOnce(testing::Return());
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -543,7 +543,7 @@ TEST_P(InputHandlerProxyTest, GestureScrollBeginThatTargetViewport) {
expected_disposition_ = InputHandlerProxy::DID_HANDLE;
VERIFY_AND_RESET_MOCKS();
- EXPECT_CALL(mock_input_handler_, RootScrollBegin(testing::_))
+ EXPECT_CALL(mock_input_handler_, RootScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
gesture_.type = WebInputEvent::GestureScrollBegin;
@@ -676,9 +676,9 @@ TEST_P(InputHandlerProxyTest, GesturePinchAfterScrollOnMainThread) {
gesture_.type = WebInputEvent::GestureScrollUpdate;
gesture_.data.scrollUpdate.deltaY =
-40; // -Y means scroll down - i.e. in the +Y direction.
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::y, testing::Gt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Gt(0))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -704,7 +704,7 @@ TEST_P(InputHandlerProxyTest, GesturePinchAfterScrollOnMainThread) {
gesture_.type = WebInputEvent::GestureScrollEnd;
gesture_.data.scrollUpdate.deltaY = 0;
- EXPECT_CALL(mock_input_handler_, ScrollEnd())
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_))
.WillOnce(testing::Return());
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -718,7 +718,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingStartedTouchpad) {
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
gesture_.type = WebInputEvent::GestureFlingStart;
@@ -802,7 +802,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -823,11 +823,11 @@ TEST_P(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
time += base::TimeDelta::FromMilliseconds(100);
Animate(time);
@@ -840,8 +840,8 @@ TEST_P(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
// transferred to the main thread.
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_ON_MAIN_THREAD));
- EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_)).Times(0);
- EXPECT_CALL(mock_input_handler_, ScrollEnd()).Times(0);
+ EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_)).Times(0);
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)).Times(0);
// Expected wheel fling animation parameters:
// *) fling_delta and fling_point should match the original GestureFlingStart
// event
@@ -908,7 +908,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -927,11 +927,11 @@ TEST_P(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
time += base::TimeDelta::FromMilliseconds(100);
Animate(time);
@@ -944,8 +944,8 @@ TEST_P(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
// transferred to the main thread.
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_ON_MAIN_THREAD));
- EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_)).Times(0);
- EXPECT_CALL(mock_input_handler_, ScrollEnd()).Times(0);
+ EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_)).Times(0);
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)).Times(0);
// Expected wheel fling animation parameters:
// *) fling_delta and fling_point should match the original GestureFlingStart
@@ -1008,7 +1008,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
expected_disposition_ = InputHandlerProxy::DID_HANDLE;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1027,11 +1027,11 @@ TEST_P(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::y, testing::Gt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Gt(0))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
time += base::TimeDelta::FromMilliseconds(100);
Animate(time);
@@ -1040,8 +1040,8 @@ TEST_P(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
// Then abort the second fling.
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_ON_MAIN_THREAD));
- EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_)).Times(0);
- EXPECT_CALL(mock_input_handler_, ScrollEnd()).Times(0);
+ EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_)).Times(0);
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)).Times(0);
// We should get parameters from the second fling, nothing from the first
// fling should "leak".
@@ -1090,7 +1090,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingStartedTouchscreen) {
VERIFY_AND_RESET_MOCKS();
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
// Verify that a GestureFlingCancel during an animation cancels it.
gesture_.type = WebInputEvent::GestureFlingCancel;
@@ -1210,16 +1210,16 @@ TEST_P(InputHandlerProxyTest, GestureFlingAnimatesTouchscreen) {
// The second call should start scrolling in the -X direction.
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
time += base::TimeDelta::FromMilliseconds(100);
Animate(time);
VERIFY_AND_RESET_MOCKS();
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
gesture_.type = WebInputEvent::GestureFlingCancel;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1266,16 +1266,16 @@ TEST_P(InputHandlerProxyTest, GestureFlingWithValidTimestamp) {
// the first scroll generated by the fling.
// Scrolling should start in the -X direction.
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
time += dt;
Animate(time);
VERIFY_AND_RESET_MOCKS();
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
gesture_.type = WebInputEvent::GestureFlingCancel;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1331,16 +1331,16 @@ TEST_P(InputHandlerProxyTest, GestureFlingWithInvalidTimestamp) {
// Further animation ticks should update the fling as usual.
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
time += base::TimeDelta::FromMilliseconds(10);
Animate(time);
VERIFY_AND_RESET_MOCKS();
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
gesture_.type = WebInputEvent::GestureFlingCancel;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1399,16 +1399,16 @@ TEST_P(InputHandlerProxyTest, GestureScrollOnImplThreadFlagClearedAfterFling) {
// The second call should start scrolling in the -X direction.
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
time += base::TimeDelta::FromMilliseconds(100);
Animate(time);
VERIFY_AND_RESET_MOCKS();
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
gesture_.type = WebInputEvent::GestureFlingCancel;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1459,7 +1459,7 @@ TEST_P(InputHandlerProxyTest,
// gesture_scroll_on_impl_thread_ is still true when this scroll begins. As a
// result, this scroll begin will cancel the previous fling.
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
@@ -1485,7 +1485,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
gesture_.data.flingStart.velocityY = fling_delta.y;
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -1499,11 +1499,11 @@ TEST_P(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
// The second animate starts scrolling in the positive X and Y directions.
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::y, testing::Lt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Lt(0))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
time += base::TimeDelta::FromMilliseconds(100);
Animate(time);
@@ -1518,9 +1518,9 @@ TEST_P(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
overscroll.unused_scroll_delta = gfx::Vector2dF(0, 10);
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::y, testing::Lt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Lt(0))))
.WillOnce(testing::Return(overscroll));
EXPECT_CALL(
mock_client_,
@@ -1529,7 +1529,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
overscroll.unused_scroll_delta,
testing::Property(&gfx::Vector2dF::y, testing::Lt(0)),
testing::_));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
time += base::TimeDelta::FromMilliseconds(100);
Animate(time);
@@ -1539,11 +1539,11 @@ TEST_P(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::y, testing::Eq(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Eq(0))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
time += base::TimeDelta::FromMilliseconds(100);
Animate(time);
VERIFY_AND_RESET_MOCKS();
@@ -1594,9 +1594,9 @@ TEST_P(InputHandlerProxyTest, GestureFlingNotCancelledBySmallTimeDelta) {
// A small time delta should not stop the fling, even if the client
// reports no scrolling.
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
.WillOnce(testing::Return(scroll_result_did_not_scroll_));
time += base::TimeDelta::FromMicroseconds(5);
Animate(time);
@@ -1614,10 +1614,10 @@ TEST_P(InputHandlerProxyTest, GestureFlingNotCancelledBySmallTimeDelta) {
// Lack of movement on the client, with a non-trivial scroll delta, should
// terminate the fling.
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x, testing::Lt(1))))
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(1))))
.WillOnce(testing::Return(scroll_result_did_not_scroll_));
time += base::TimeDelta::FromMilliseconds(100);
Animate(time);
@@ -1662,9 +1662,9 @@ TEST_P(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
// The second animate starts scrolling in the positive X and Y directions.
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::y, testing::Lt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Lt(0))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
time += base::TimeDelta::FromMilliseconds(10);
Animate(time);
@@ -1673,9 +1673,9 @@ TEST_P(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
// The third animate hits the bottom content edge.
overscroll.accumulated_root_overscroll = gfx::Vector2dF(0, 100);
overscroll.unused_scroll_delta = gfx::Vector2dF(0, 100);
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::y, testing::Lt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Lt(0))))
.WillOnce(testing::Return(overscroll));
EXPECT_CALL(
mock_client_,
@@ -1691,9 +1691,9 @@ TEST_P(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
// The next call to animate will no longer scroll vertically.
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::y, testing::Eq(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Eq(0))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
time += base::TimeDelta::FromMilliseconds(10);
Animate(time);
@@ -1702,9 +1702,9 @@ TEST_P(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
// The next call will hit the right edge.
overscroll.accumulated_root_overscroll = gfx::Vector2dF(100, 100);
overscroll.unused_scroll_delta = gfx::Vector2dF(100, 0);
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
.WillOnce(testing::Return(overscroll));
EXPECT_CALL(
mock_client_,
@@ -1713,7 +1713,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
overscroll.unused_scroll_delta,
testing::Property(&gfx::Vector2dF::x, testing::Lt(0)),
testing::_));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
time += base::TimeDelta::FromMilliseconds(10);
Animate(time);
VERIFY_AND_RESET_MOCKS();
@@ -1721,7 +1721,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
// The next call to animate will no longer scroll horizontally or vertically,
// and the fling should be cancelled.
EXPECT_SET_NEEDS_ANIMATE_INPUT(0);
- EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_)).Times(0);
+ EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_)).Times(0);
time += base::TimeDelta::FromMilliseconds(10);
Animate(time);
VERIFY_AND_RESET_MOCKS();
@@ -1818,7 +1818,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingCancelledByKeyboardEvent) {
VERIFY_AND_RESET_MOCKS();
// Keyboard events received during a fling should cancel the active fling.
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_EQ(InputHandlerProxy::DID_NOT_HANDLE,
input_handler_->HandleInputEvent(key_event));
EXPECT_FALSE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
@@ -1875,9 +1875,7 @@ TEST_P(InputHandlerProxyTest, GestureFlingWithNegativeTimeDelta) {
// before the fling's start time then we should *not* try scrolling and
// instead reset the fling start time.
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::_)).Times(0);
+ EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_)).Times(0);
time -= base::TimeDelta::FromMilliseconds(5);
Animate(time);
@@ -1886,16 +1884,16 @@ TEST_P(InputHandlerProxyTest, GestureFlingWithNegativeTimeDelta) {
// The first call should have reset the start time so subsequent calls should
// generate scroll events.
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
- EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x, testing::Lt(0))))
+ EXPECT_CALL(
+ mock_input_handler_,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
Animate(time + base::TimeDelta::FromMilliseconds(1));
VERIFY_AND_RESET_MOCKS();
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
gesture_.type = WebInputEvent::GestureFlingCancel;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -1935,8 +1933,7 @@ TEST_P(InputHandlerProxyTest, FlingBoost) {
(time - last_animate_time).InSecondsF() * -fling_delta.x;
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x,
testing::Eq(expected_delta))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
Animate(time);
@@ -1959,8 +1956,7 @@ TEST_P(InputHandlerProxyTest, FlingBoost) {
expected_delta = (time - last_animate_time).InSecondsF() * -fling_delta.x;
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x,
testing::Eq(expected_delta))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
Animate(time);
@@ -1985,8 +1981,7 @@ TEST_P(InputHandlerProxyTest, FlingBoost) {
expected_delta = 2 * (time - last_animate_time).InSecondsF() * -fling_delta.x;
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x,
testing::Eq(expected_delta))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
Animate(time);
@@ -2011,8 +2006,7 @@ TEST_P(InputHandlerProxyTest, FlingBoost) {
expected_delta = 3 * (time - last_animate_time).InSecondsF() * -fling_delta.x;
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x,
testing::Eq(expected_delta))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
Animate(time);
@@ -2031,7 +2025,7 @@ TEST_P(InputHandlerProxyTest, FlingBoost) {
VERIFY_AND_RESET_MOCKS();
time += base::TimeDelta::FromMilliseconds(100);
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
Animate(time);
VERIFY_AND_RESET_MOCKS();
@@ -2055,7 +2049,7 @@ TEST_P(InputHandlerProxyTest, NoFlingBoostIfScrollTargetsDifferentLayer) {
EXPECT_CALL(mock_input_handler_,
IsCurrentlyScrollingLayerAt(testing::_, testing::_))
.WillOnce(testing::Return(false));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
@@ -2096,7 +2090,7 @@ TEST_P(InputHandlerProxyTest, NoFlingBoostIfScrollDelayed) {
// If no GestureScrollUpdate or GestureFlingStart is received within the
// timeout window, the fling should be cancelled and scrolling should resume.
time += base::TimeDelta::FromMilliseconds(100);
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
Animate(time);
@@ -2114,7 +2108,7 @@ TEST_P(InputHandlerProxyTest, NoFlingBoostIfNotAnimated) {
// Animate fling once.
time += dt;
- EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_))
+ EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_))
.WillOnce(testing::Return(scroll_result_did_scroll_));
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
Animate(time);
@@ -2141,10 +2135,10 @@ TEST_P(InputHandlerProxyTest, NoFlingBoostIfNotAnimated) {
// since last animate. Cancel old fling and start new scroll.
gesture_.type = WebInputEvent::GestureScrollUpdate;
gesture_.data.scrollUpdate.deltaY = -40;
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_, testing::_))
+ EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_))
.WillOnce(testing::Return(scroll_result_did_scroll_));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -2184,8 +2178,7 @@ TEST_P(InputHandlerProxyTest, NoFlingBoostIfFlingInDifferentDirection) {
float expected_delta = dt.InSecondsF() * -orthogonal_fling_delta.y;
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::y,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_y,
testing::Eq(expected_delta))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
Animate(time);
@@ -2225,12 +2218,11 @@ TEST_P(InputHandlerProxyTest, NoFlingBoostIfScrollInDifferentDirection) {
gesture_.timeStampSeconds = InSecondsF(time);
gesture_.type = WebInputEvent::GestureScrollUpdate;
gesture_.data.scrollUpdate.deltaX = -fling_delta.x;
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x,
testing::Eq(fling_delta.x))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -2269,8 +2261,7 @@ TEST_P(InputHandlerProxyTest, NoFlingBoostIfFlingTooSlow) {
float expected_delta = dt.InSecondsF() * -small_fling_delta.x;
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x,
testing::Eq(expected_delta))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
Animate(time);
@@ -2287,7 +2278,7 @@ TEST_P(InputHandlerProxyTest, NoFlingBoostIfPreventBoostingFlagIsSet) {
StartFling(
time, blink::WebGestureDeviceTouchscreen, fling_delta, fling_point);
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
// Cancel the fling. The fling cancellation should not be deferred because of
// prevent boosting flag set.
@@ -2331,11 +2322,10 @@ TEST_P(InputHandlerProxyTest, FlingBoostTerminatedDuringScrollSequence) {
float expected_delta =
(time - last_animate_time).InSecondsF() * -fling_delta.x;
EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x,
testing::Eq(expected_delta))))
.WillOnce(testing::Return(scroll_result_did_not_scroll_));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
Animate(time);
@@ -2350,8 +2340,7 @@ TEST_P(InputHandlerProxyTest, FlingBoostTerminatedDuringScrollSequence) {
gesture_.type = WebInputEvent::GestureScrollUpdate;
gesture_.data.scrollUpdate.deltaX = -expected_delta;
EXPECT_CALL(mock_input_handler_,
- ScrollBy(testing::_,
- testing::Property(&gfx::Vector2dF::x,
+ ScrollBy(testing::Property(&cc::ScrollState::delta_x,
testing::Eq(expected_delta))))
.WillOnce(testing::Return(scroll_result_did_scroll_));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
@@ -2362,7 +2351,7 @@ TEST_P(InputHandlerProxyTest, FlingBoostTerminatedDuringScrollSequence) {
time += dt;
gesture_.timeStampSeconds = InSecondsF(time);
gesture_.type = WebInputEvent::GestureScrollEnd;
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -2389,7 +2378,7 @@ TEST_P(InputHandlerProxyTest, DidReceiveInputEvent_ForFling) {
EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::SCROLL_STARTED));
- EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
EXPECT_EQ(InputHandlerProxy::DID_HANDLE,
input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();