Put vertical overscroll behind kScrollEndEffect flag

Currently vertical overscroll is only used in the experimental scroll
end effect feature and causes issues with gmail, so putting it behind
this feature flag.

BUG=312998
TEST=Built Chrome for CrOS and confirmed that the stuttering with the
     flag off is no long present.

Review URL: https://codereview.chromium.org/52263006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233068 0039d316-1c4b-4281-b951-d872f2087c98
parent 82757b10
......@@ -4,12 +4,23 @@
#include "content/browser/renderer_host/overscroll_controller.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "content/browser/renderer_host/overscroll_controller_delegate.h"
#include "content/public/browser/overscroll_configuration.h"
#include "content/public/common/content_switches.h"
using WebKit::WebInputEvent;
namespace {
bool IsScrollEndEffectEnabled() {
return CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kScrollEndEffect) == "1";
}
} // namespace
namespace content {
OverscrollController::OverscrollController()
......@@ -302,6 +313,12 @@ void OverscrollController::ProcessOverscroll(float delta_x,
fabs(overscroll_delta_y_) > fabs(overscroll_delta_x_) * kMinRatio)
new_mode = overscroll_delta_y_ > 0.f ? OVERSCROLL_SOUTH : OVERSCROLL_NORTH;
// The vertical oversrcoll currently does not have any UX effects other then
// for the scroll end effect, so testing if it is enabled.
if ((new_mode == OVERSCROLL_SOUTH || new_mode == OVERSCROLL_NORTH) &&
!IsScrollEndEffectEnabled())
new_mode = OVERSCROLL_NONE;
if (overscroll_mode_ == OVERSCROLL_NONE)
SetOverscrollMode(new_mode);
else if (new_mode != overscroll_mode_)
......
......@@ -1350,7 +1350,7 @@ TEST_F(RenderWidgetHostTest, WheelScrollConsumedDoNotHorizOverscroll) {
SendInputEventACK(WebInputEvent::MouseWheel,
INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode());
EXPECT_EQ(0U, process_->sink().message_count());
EXPECT_EQ(1U, process_->sink().message_count());
process_->sink().ClearMessages();
SendInputEventACK(WebInputEvent::MouseWheel,
......@@ -1687,41 +1687,6 @@ TEST_F(RenderWidgetHostTest, GestureScrollConsumedHorizontal) {
EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode());
}
// Tests that if the page is scrolled because of a scroll-gesture, then that
// particular scroll sequence never generates overscroll if the scroll direction
// is vertical.
TEST_F(RenderWidgetHostTest, GestureScrollConsumedVertical) {
// Turn off debounce handling for test isolation.
host_->SetupForOverscrollControllerTest();
host_->set_debounce_interval_time_ms(0);
process_->sink().ClearMessages();
SimulateGestureEvent(WebInputEvent::GestureScrollBegin,
WebGestureEvent::Touchscreen);
SimulateGestureScrollUpdateEvent(0, -1, 0);
// Start scrolling on content. ACK both events as being processed.
SendInputEventACK(WebInputEvent::GestureScrollBegin,
INPUT_EVENT_ACK_STATE_CONSUMED);
SendInputEventACK(WebInputEvent::GestureScrollUpdate,
INPUT_EVENT_ACK_STATE_CONSUMED);
EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode());
EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_delegate()->current_mode());
// Send another gesture event and ACK as not being processed. This should
// initiate overscroll because the scroll was in the vertical direction even
// though the beginning of the scroll did scroll content.
SimulateGestureScrollUpdateEvent(0, -50, 0);
SendInputEventACK(WebInputEvent::GestureScrollUpdate,
INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
EXPECT_EQ(OVERSCROLL_NORTH, host_->overscroll_mode());
// Changing direction of scroll to be horizontal to test that this causes the
// vertical overscroll to stop.
SimulateGestureScrollUpdateEvent(500, 0, 0);
EXPECT_EQ(OVERSCROLL_NONE, host_->overscroll_mode());
}
// Tests that the overscroll controller plays nice with touch-scrolls and the
// gesture event filter with debounce filtering turned on.
TEST_F(RenderWidgetHostTest, GestureScrollDebounceOverscrolls) {
......
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