Commit 84299338 authored by David Bokan's avatar David Bokan Committed by Commit Bot

[Refactor] Move ShouldAnimate decision to compositor

Currently, the decision on whether a scroll should be animated or not
occurs in InputHandlerProxy. This makes the compositor scroll interface
more complicated than it needs to be and exposes details about scrolling
that should be encapsulated in the compositor.

This CL moves the |smooth_scroll_enabled| from an ad hoc bit in the
InputHandlerProxy into a real setting in LayerTreeSettings. We then
rearrange the public interface of the compositor input handler so that
we only have a ScrollUpdate method. This method now checks whether a
given scroll should be animated or not and delegates to the old ScrollBy
or ScrollAnimated methods, based on the answer. Finally, we remove some
of the divergence between animated and non-animated paths in
InputHandlerProxy so that both kinds of scrolls are handed in the same
way.

Bug: 1016229
Change-Id: I2143cf27aeb6aca905b59b817fe8e3f1b14b7858
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1981711
Commit-Queue: David Bokan <bokan@chromium.org>
Reviewed-by: default avatarStefan Zager <szager@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Reviewed-by: default avatarMajid Valipour <majidvp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729938}
parent 201ce4ba
......@@ -62,16 +62,16 @@ struct CC_EXPORT InputHandlerPointerResult {
struct CC_EXPORT InputHandlerScrollResult {
InputHandlerScrollResult();
// Did any layer scroll as a result this ScrollBy call?
// Did any layer scroll as a result this ScrollUpdate call?
bool did_scroll;
// Was any of the scroll delta argument to this ScrollBy call not used?
// Was any of the scroll delta argument to this ScrollUpdate call not used?
bool did_overscroll_root;
// The total overscroll that has been accumulated by all ScrollBy calls that
// have had overscroll since the last ScrollBegin call. This resets upon a
// ScrollBy with no overscroll.
// The total overscroll that has been accumulated by all ScrollUpdate calls
// that have had overscroll since the last ScrollBegin call. This resets upon
// a ScrollUpdate with no overscroll.
gfx::Vector2dF accumulated_root_overscroll;
// The amount of the scroll delta argument to this ScrollBy call that was not
// used for scrolling.
// The amount of the scroll delta argument to this ScrollUpdate call that was
// not used for scrolling.
gfx::Vector2dF unused_scroll_delta;
// How the browser should handle the overscroll navigation based on the css
// property scroll-boundary-behavior.
......@@ -159,11 +159,13 @@ class CC_EXPORT InputHandler {
// handler calls WillShutdown() on the client.
virtual void BindToClient(InputHandlerClient* client) = 0;
// 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.
// Selects a ScrollNode to be "latched" for scrolling using the
// |scroll_state| start position. The selected node remains latched until the
// gesture is ended by a call to ScrollEnd. Returns SCROLL_STARTED if a node
// at the coordinates can be scrolled and was latched, 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;
......@@ -172,25 +174,23 @@ class CC_EXPORT InputHandler {
virtual ScrollStatus RootScrollBegin(ScrollState* scroll_state,
ScrollInputType type) = 0;
// |delayed_by| is the delay that is taken into account when determining
// the duration of the animation. TODO(bokan): Should eventually be merged
// into ScrollBy. https://crbug.com/1016229.
virtual void ScrollAnimated(const gfx::Point& viewport_point,
const gfx::Vector2dF& scroll_delta,
base::TimeDelta delayed_by) = 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
// scrolls gestures that are direct manipulation (e.g. touch). If the
// viewport is latched, and it can no longer scroll, 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;
// |delayed_by| is the delay from the event that caused the scroll. This is
// taken into account when determining the duration of the animation if one
// is created.
virtual InputHandlerScrollResult ScrollUpdate(ScrollState* scroll_state,
ScrollInputType type,
base::TimeDelta delayed_by) = 0;
// Stop scrolling the selected layer. Should only be called if ScrollBegin()
// returned SCROLL_STARTED. Snap to a snap position if |should_snap| is true.
virtual void ScrollEnd(bool should_snap) = 0;
virtual InputHandlerPointerResult MouseMoveAt(
const gfx::Point& mouse_position) = 0;
......@@ -202,10 +202,6 @@ class CC_EXPORT InputHandler {
const gfx::PointF& mouse_position) = 0;
virtual void MouseLeave() = 0;
// Stop scrolling the selected layer. Should only be called if ScrollBegin()
// returned SCROLL_STARTED. Snap to a snap position if |should_snap| is true.
virtual void ScrollEnd(bool should_snap) = 0;
// Requests a callback to UpdateRootLayerStateForSynchronousInputHandler()
// giving the current root scroll and page scale information.
virtual void RequestUpdateForSynchronousInputHandler() = 0;
......
......@@ -4586,6 +4586,49 @@ void LayerTreeHostImpl::SetRenderFrameObserver(
render_frame_metadata_observer_->BindToCurrentThread();
}
bool LayerTreeHostImpl::ShouldAnimateScroll(
const ScrollState& scroll_state,
InputHandler::ScrollInputType type) const {
if (!settings_.enable_smooth_scroll)
return false;
bool has_precise_scroll_deltas =
scroll_state.delta_granularity() ==
static_cast<double>(
ui::input_types::ScrollGranularity::kScrollByPrecisePixel);
#if defined(OS_MACOSX)
// Mac does not smooth scroll wheel events (crbug.com/574283).
return type == InputHandler::SCROLLBAR ? !has_precise_scroll_deltas : false;
#else
return !has_precise_scroll_deltas;
#endif
}
InputHandlerScrollResult LayerTreeHostImpl::ScrollUpdate(
ScrollState* scroll_state,
InputHandler::ScrollInputType type,
base::TimeDelta delayed_by) {
DCHECK(scroll_state);
if (ShouldAnimateScroll(*scroll_state, type)) {
DCHECK(!scroll_state->is_in_inertial_phase());
gfx::Vector2dF scroll_delta(scroll_state->delta_x(),
scroll_state->delta_y());
ScrollAnimated(gfx::Point(), scroll_delta, delayed_by);
// TODO(bokan): Always return |did_scroll| to preserve existing behavior
// where ScrollAnimated used to not return anything at all and then ACK as
// DID_HANDLE. Long term we should fill in the result with meaningful
// values.
InputHandlerScrollResult result;
result.did_scroll = true;
return result;
}
return ScrollBy(scroll_state);
}
InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
ScrollState* scroll_state) {
DCHECK(scroll_state);
......
......@@ -258,6 +258,13 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandler,
LayerTreeHostImpl& operator=(const LayerTreeHostImpl&) = delete;
// TODO(bokan): Replace calls in unit tests to ScrollUpdate and make these
// private.
void ScrollAnimated(const gfx::Point& viewport_point,
const gfx::Vector2dF& scroll_delta,
base::TimeDelta delayed_by = base::TimeDelta());
InputHandlerScrollResult ScrollBy(ScrollState* scroll_state);
// InputHandler implementation
void BindToClient(InputHandlerClient* client) override;
InputHandler::ScrollStatus ScrollBegin(
......@@ -266,10 +273,10 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandler,
InputHandler::ScrollStatus RootScrollBegin(
ScrollState* scroll_state,
InputHandler::ScrollInputType type) override;
void ScrollAnimated(const gfx::Point& viewport_point,
const gfx::Vector2dF& scroll_delta,
base::TimeDelta delayed_by = base::TimeDelta()) override;
InputHandlerScrollResult ScrollBy(ScrollState* scroll_state) override;
InputHandlerScrollResult ScrollUpdate(
ScrollState* scroll_state,
InputHandler::ScrollInputType type,
base::TimeDelta delayed_by = base::TimeDelta()) override;
void RequestUpdateForSynchronousInputHandler() override;
void SetSynchronousInputHandlerRootScrollOffset(
const gfx::ScrollOffset& root_content_offset) override;
......@@ -925,6 +932,9 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandler,
void ScrollLatchedScroller(ScrollState* scroll_state);
bool ShouldAnimateScroll(const ScrollState& scroll_state,
InputHandler::ScrollInputType type) const;
bool AnimatePageScale(base::TimeTicks monotonic_time);
bool AnimateScrollbars(base::TimeTicks monotonic_time);
bool AnimateBrowserControls(base::TimeTicks monotonic_time);
......
......@@ -3872,6 +3872,124 @@ TEST_F(LayerTreeHostImplTest, MaxScrollOffsetAffectedByViewportBoundsDelta) {
EXPECT_EQ(gfx::ScrollOffset(10, 10), inner_scroll->MaxScrollOffset());
}
// Ensures scroll gestures coming from scrollbars cause animations in the
// appropriate scenarios.
TEST_F(LayerTreeHostImplTest, AnimatedGranularityCausesSmoothScroll) {
// Enable animated scrolling
LayerTreeSettings settings = DefaultSettings();
settings.enable_smooth_scroll = true;
CreateHostImpl(settings, CreateLayerTreeFrameSink());
gfx::Size viewport_size(300, 200);
gfx::Size content_size(1000, 1000);
SetupViewportLayersOuterScrolls(viewport_size, content_size);
gfx::Point position(295, 195);
gfx::Vector2dF offset(0, 50);
// TODO(bokan): Unfortunately, Mac currently doesn't support smooth scrolling
// wheel events. https://crbug.com/574283.
#if defined(OS_MACOSX)
std::vector<InputHandler::ScrollInputType> types = {InputHandler::SCROLLBAR};
#else
std::vector<InputHandler::ScrollInputType> types = {InputHandler::SCROLLBAR,
InputHandler::WHEEL};
#endif
for (auto type : types) {
auto begin_state = BeginState(position, offset, type);
begin_state->data()->set_current_native_scrolling_element(
host_impl_->OuterViewportScrollNode()->element_id);
begin_state->data()->delta_granularity =
static_cast<double>(ui::input_types::ScrollGranularity::kScrollByPixel);
auto update_state = UpdateState(position, offset, type);
update_state->data()->delta_granularity =
static_cast<double>(ui::input_types::ScrollGranularity::kScrollByPixel);
ASSERT_FALSE(GetImplAnimationHost()->IsImplOnlyScrollAnimating());
// Perform a scrollbar-like scroll (one injected by the
// ScrollbarController). It should cause an animation to be created.
{
host_impl_->ScrollBegin(begin_state.get(), type);
ASSERT_EQ(host_impl_->CurrentlyScrollingNode(),
host_impl_->OuterViewportScrollNode());
host_impl_->ScrollUpdate(update_state.get(), type);
EXPECT_TRUE(GetImplAnimationHost()->IsImplOnlyScrollAnimating());
host_impl_->ScrollEnd();
}
GetImplAnimationHost()->ScrollAnimationAbort();
ASSERT_FALSE(GetImplAnimationHost()->IsImplOnlyScrollAnimating());
// Perform a scrollbar-like scroll (one injected by the
// ScrollbarController). This time we change the granularity to precise (as
// if thumb-dragging). This should not cause an animation.
{
begin_state->data()->delta_granularity = static_cast<double>(
ui::input_types::ScrollGranularity::kScrollByPrecisePixel);
update_state->data()->delta_granularity = static_cast<double>(
ui::input_types::ScrollGranularity::kScrollByPrecisePixel);
host_impl_->ScrollBegin(begin_state.get(), type);
ASSERT_EQ(host_impl_->CurrentlyScrollingNode(),
host_impl_->OuterViewportScrollNode());
host_impl_->ScrollUpdate(update_state.get(), type);
EXPECT_FALSE(GetImplAnimationHost()->IsImplOnlyScrollAnimating());
host_impl_->ScrollEnd();
}
}
}
// Ensures scroll gestures coming from scrollbars don't cause animations if
// smooth scrolling is disabled.
TEST_F(LayerTreeHostImplTest, NonAnimatedGranularityCausesInstantScroll) {
// Disable animated scrolling
LayerTreeSettings settings = DefaultSettings();
settings.enable_smooth_scroll = false;
CreateHostImpl(settings, CreateLayerTreeFrameSink());
gfx::Size viewport_size(300, 200);
gfx::Size content_size(1000, 1000);
SetupViewportLayersOuterScrolls(viewport_size, content_size);
gfx::Point position(295, 195);
gfx::Vector2dF offset(0, 50);
std::vector<InputHandler::ScrollInputType> types = {InputHandler::SCROLLBAR,
InputHandler::WHEEL};
for (auto type : types) {
auto begin_state = BeginState(position, offset, type);
begin_state->data()->set_current_native_scrolling_element(
host_impl_->OuterViewportScrollNode()->element_id);
begin_state->data()->delta_granularity =
static_cast<double>(ui::input_types::ScrollGranularity::kScrollByPixel);
auto update_state = UpdateState(position, offset, type);
update_state->data()->delta_granularity =
static_cast<double>(ui::input_types::ScrollGranularity::kScrollByPixel);
ASSERT_FALSE(GetImplAnimationHost()->IsImplOnlyScrollAnimating());
// Perform a scrollbar-like scroll (one injected by the
// ScrollbarController). It should cause an animation to be created.
{
host_impl_->ScrollBegin(begin_state.get(), type);
ASSERT_EQ(host_impl_->CurrentlyScrollingNode(),
host_impl_->OuterViewportScrollNode());
host_impl_->ScrollUpdate(update_state.get(), type);
EXPECT_FALSE(GetImplAnimationHost()->IsImplOnlyScrollAnimating());
host_impl_->ScrollEnd();
}
}
}
class LayerTreeHostImplOverridePhysicalTime : public LayerTreeHostImpl {
public:
LayerTreeHostImplOverridePhysicalTime(
......
......@@ -136,6 +136,13 @@ class CC_EXPORT LayerTreeSettings {
// on the compositor thread.
bool compositor_threaded_scrollbar_scrolling = false;
// Determines whether animated scrolling is supported. If true, and the
// incoming gesture scroll is of a type that would normally be animated (e.g.
// coarse granularity scrolls like those coming from an external mouse wheel),
// the scroll will be performed smoothly using the animation system rather
// than instantly.
bool enable_smooth_scroll = false;
// Whether layer tree commits should be made directly to the active
// tree on the impl thread. If |false| LayerTreeHostImpl creates a
// pending layer tree and produces that as the 'sync tree' with
......
......@@ -163,7 +163,6 @@ void WidgetInputHandlerManager::InitInputHandler() {
base::OnceClosure init_closure = base::BindOnce(
&WidgetInputHandlerManager::InitOnInputHandlingThread, this,
render_widget_->layer_tree_host()->GetInputHandler(),
render_widget_->compositor_deps()->IsScrollAnimatorEnabled(),
sync_compositing);
InputThreadTaskRunner()->PostTask(FROM_HERE, std::move(init_closure));
}
......@@ -515,7 +514,6 @@ void WidgetInputHandlerManager::OnDeferCommitsChanged(bool status) {
void WidgetInputHandlerManager::InitOnInputHandlingThread(
const base::WeakPtr<cc::InputHandler>& input_handler,
bool smooth_scroll_enabled,
bool sync_compositing) {
DCHECK(InputThreadTaskRunner()->BelongsToCurrentThread());
......@@ -531,8 +529,6 @@ void WidgetInputHandlerManager::InitOnInputHandlingThread(
input_handler_proxy_ = std::make_unique<ui::InputHandlerProxy>(
input_handler.get(), this, force_input_handling_on_main);
input_handler_proxy_->set_smooth_scroll_enabled(smooth_scroll_enabled);
#if defined(OS_ANDROID)
if (sync_compositing) {
DCHECK(synchronous_compositor_registry_);
......
......@@ -151,7 +151,6 @@ class CONTENT_EXPORT WidgetInputHandlerManager final
void InitInputHandler();
void InitOnInputHandlingThread(
const base::WeakPtr<cc::InputHandler>& input_handler,
bool smooth_scroll_enabled,
bool sync_compositing);
void BindAssociatedChannel(
mojo::PendingAssociatedReceiver<mojom::WidgetInputHandler> receiver);
......
......@@ -3087,6 +3087,8 @@ cc::LayerTreeSettings RenderWidget::GenerateLayerTreeSettings(
settings.commit_fractional_scroll_deltas =
blink::WebRuntimeFeatures::IsFractionalScrollOffsetsEnabled();
settings.enable_smooth_scroll = compositor_deps->IsScrollAnimatorEnabled();
// The means the renderer compositor has 2 possible modes:
// - Threaded compositing with a scheduler.
// - Single threaded compositing without a scheduler (for web tests only).
......
......@@ -68,7 +68,8 @@ bool ScrollInputHandler::OnScrollEvent(const ScrollEvent& event,
cc::InputHandler::WHEEL);
cc::ScrollState scroll_state = CreateScrollState(event, false);
input_handler_weak_ptr_->ScrollBy(&scroll_state);
input_handler_weak_ptr_->ScrollUpdate(&scroll_state, cc::InputHandler::WHEEL,
base::TimeDelta());
input_handler_weak_ptr_->ScrollEnd(/*should_snap=*/false);
return true;
......
......@@ -186,7 +186,6 @@ InputHandlerProxy::InputHandlerProxy(cc::InputHandler* input_handler,
#endif
gesture_scroll_on_impl_thread_(false),
scroll_sequence_ignored_(false),
smooth_scroll_enabled_(false),
touch_result_(kEventDispositionUndefined),
mouse_wheel_result_(kEventDispositionUndefined),
current_overscroll_params_(nullptr),
......@@ -746,21 +745,6 @@ void InputHandlerProxy::RecordMainThreadScrollingReasons(
}
}
bool InputHandlerProxy::ShouldAnimate(blink::WebGestureDevice device,
bool has_precise_scroll_deltas) const {
if (!smooth_scroll_enabled_)
return false;
#if defined(OS_MACOSX)
// Mac does not smooth scroll wheel events (crbug.com/574283).
return device == blink::WebGestureDevice::kScrollbar
? !has_precise_scroll_deltas
: false;
#else
return !has_precise_scroll_deltas;
#endif
}
InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel(
const WebMouseWheelEvent& wheel_event) {
InputHandlerProxy::EventDisposition result = DROP_EVENT;
......@@ -837,13 +821,6 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureScrollBegin(
} else if (gesture_event.data.scroll_begin.target_viewport) {
scroll_status = input_handler_->RootScrollBegin(
&scroll_state, GestureScrollInputType(gesture_event.SourceDevice()));
} else if (ShouldAnimate(
gesture_event.SourceDevice(),
gesture_event.data.scroll_begin.delta_hint_units !=
ui::input_types::ScrollGranularity::kScrollByPixel)) {
DCHECK(!scroll_state.is_in_inertial_phase());
scroll_status =
input_handler_->ScrollBegin(&scroll_state, cc::InputHandler::WHEEL);
} else {
scroll_status = input_handler_->ScrollBegin(
&scroll_state, GestureScrollInputType(gesture_event.SourceDevice()));
......@@ -887,15 +864,14 @@ InputHandlerProxy::EventDisposition InputHandlerProxy::HandleGestureScrollBegin(
InputHandlerProxy::EventDisposition
InputHandlerProxy::HandleGestureScrollUpdate(
const WebGestureEvent& gesture_event) {
TRACE_EVENT2("input", "InputHandlerProxy::HandleGestureScrollUpdate", "dx",
-gesture_event.data.scroll_update.delta_x, "dy",
-gesture_event.data.scroll_update.delta_y);
#if DCHECK_IS_ON()
DCHECK(expect_scroll_update_end_);
#endif
gfx::Vector2dF scroll_delta(-gesture_event.data.scroll_update.delta_x,
-gesture_event.data.scroll_update.delta_y);
TRACE_EVENT2("input", "InputHandlerProxy::HandleGestureScrollUpdate", "dx",
scroll_delta.x(), "dy", scroll_delta.y());
if (scroll_sequence_ignored_) {
TRACE_EVENT_INSTANT0("input", "Scroll Sequence Ignored",
TRACE_EVENT_SCOPE_THREAD);
......@@ -907,29 +883,10 @@ InputHandlerProxy::HandleGestureScrollUpdate(
cc::ScrollState scroll_state = CreateScrollStateForGesture(gesture_event);
in_inertial_scrolling_ = scroll_state.is_in_inertial_phase();
gfx::PointF scroll_point(gesture_event.PositionInWidget());
TRACE_EVENT_INSTANT1(
"input", "DeltaUnits", TRACE_EVENT_SCOPE_THREAD, "unit",
static_cast<int>(gesture_event.data.scroll_update.delta_units));
if (ShouldAnimate(gesture_event.SourceDevice(),
gesture_event.data.scroll_update.delta_units !=
ui::input_types::ScrollGranularity::kScrollByPixel)) {
if (input_handler_->ScrollingShouldSwitchtoMainThread()) {
TRACE_EVENT_INSTANT0("input", "Move Scroll To Main Thread",
TRACE_EVENT_SCOPE_THREAD);
gesture_scroll_on_impl_thread_ = false;
client_->GenerateScrollBeginAndSendToMainThread(gesture_event);
return DID_NOT_HANDLE;
} else {
DCHECK(!scroll_state.is_in_inertial_phase());
base::TimeTicks event_time = gesture_event.TimeStamp();
base::TimeDelta delay = base::TimeTicks::Now() - event_time;
input_handler_->ScrollAnimated(gfx::ToFlooredPoint(scroll_point),
scroll_delta, delay);
return DID_HANDLE;
}
}
if (snap_fling_controller_->HandleGestureScrollUpdate(
GetGestureScrollUpdateInfo(gesture_event))) {
......@@ -940,19 +897,30 @@ InputHandlerProxy::HandleGestureScrollUpdate(
return DROP_EVENT;
}
cc::InputHandlerScrollResult scroll_result =
input_handler_->ScrollBy(&scroll_state);
if (!scroll_result.did_scroll &&
input_handler_->ScrollingShouldSwitchtoMainThread()) {
if (input_handler_->ScrollingShouldSwitchtoMainThread()) {
TRACE_EVENT_INSTANT0("input", "Move Scroll To Main Thread",
TRACE_EVENT_SCOPE_THREAD);
gesture_scroll_on_impl_thread_ = false;
client_->GenerateScrollBeginAndSendToMainThread(gesture_event);
// TODO(bokan): |!gesture_pinch_in_progress_| was put here by
// https://crrev.com/2720903005 but it's not clear to me how this is
// supposed to work - we already generated and sent a GSB to the main
// thread above so it's odd to continue handling on the compositor thread
// if a pinch was in progress. It probably makes more sense to bake this
// condition into ScrollingShouldSwitchToMainThread().
if (!gesture_pinch_in_progress_)
return DID_NOT_HANDLE;
}
HandleOverscroll(scroll_point, scroll_result);
base::TimeTicks event_time = gesture_event.TimeStamp();
base::TimeDelta delay = base::TimeTicks::Now() - event_time;
cc::InputHandlerScrollResult scroll_result = input_handler_->ScrollUpdate(
&scroll_state, GestureScrollInputType(gesture_event.SourceDevice()),
delay);
HandleOverscroll(gesture_event.PositionInWidget(), scroll_result);
if (scroll_elasticity_controller_)
HandleScrollElasticityOverscroll(gesture_event, scroll_result);
......@@ -1203,8 +1171,11 @@ bool InputHandlerProxy::GetSnapFlingInfoAndSetAnimatingSnapTarget(
gfx::Vector2dF InputHandlerProxy::ScrollByForSnapFling(
const gfx::Vector2dF& delta) {
cc::ScrollState scroll_state = CreateScrollStateForInertialUpdate(delta);
cc::InputHandlerScrollResult scroll_result =
input_handler_->ScrollBy(&scroll_state);
// TODO(bokan): We should be passing in the source device that was used to
// scroll during the gesture.
cc::InputHandlerScrollResult scroll_result = input_handler_->ScrollUpdate(
&scroll_state, cc::InputHandler::TOUCHSCREEN, base::TimeDelta());
return scroll_result.current_visual_offset;
}
......
......@@ -61,8 +61,6 @@ class InputHandlerProxy : public cc::InputHandlerClient,
return scroll_elasticity_controller_.get();
}
void set_smooth_scroll_enabled(bool value) { smooth_scroll_enabled_ = value; }
enum EventDisposition {
DID_HANDLE,
DID_NOT_HANDLE,
......@@ -164,10 +162,6 @@ class InputHandlerProxy : public cc::InputHandlerClient,
void HandleOverscroll(const gfx::PointF& causal_event_viewport_point,
const cc::InputHandlerScrollResult& scroll_result);
// Whether to use a smooth scroll animation for this event.
bool ShouldAnimate(blink::WebGestureDevice device,
bool has_precise_scroll_deltas) const;
// Update the elastic overscroll controller with |gesture_event|.
void HandleScrollElasticityOverscroll(
const blink::WebGestureEvent& gesture_event,
......@@ -204,8 +198,6 @@ class InputHandlerProxy : public cc::InputHandlerClient,
std::unique_ptr<InputScrollElasticityController>
scroll_elasticity_controller_;
bool smooth_scroll_enabled_;
// The merged result of the last touch event with previous touch events.
// This value will get returned for subsequent TouchMove events to allow
// passive events not to block scrolling.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment