diff options
author | dominikg@chromium.org <dominikg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-27 00:59:05 +0000 |
---|---|---|
committer | dominikg@chromium.org <dominikg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-27 00:59:05 +0000 |
commit | 4cb7699e349fabe62f9b4af7894361c4334161f9 (patch) | |
tree | 0fe73b53015a32fdce4a5600db8088e573a399a3 | |
parent | fa1b0fcb70378e41179e3033823be4cc383fb51d (diff) | |
download | chromium_src-4cb7699e349fabe62f9b4af7894361c4334161f9.zip chromium_src-4cb7699e349fabe62f9b4af7894361c4334161f9.tar.gz chromium_src-4cb7699e349fabe62f9b4af7894361c4334161f9.tar.bz2 |
Round deltas for mouse-based synthetic scroll.
Even though WebMouseWheelEvents take floating point deltas, internally the
scroll position is stored as an integer. Rounding the deltas ensures that
the gesture state, especially |current_y_|, is consistent with the internal
state.
Re-enable ScrollActionTest, as this should fix flakiness in testScrollAction
unit test.
BUG=323249
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=237353
Review URL: https://codereview.chromium.org/88713002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237457 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.cc | 8 | ||||
-rw-r--r-- | tools/telemetry/telemetry/page/actions/scroll_unittest.py | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.cc b/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.cc index dac00d3..b81f75b 100644 --- a/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.cc +++ b/content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.cc @@ -4,6 +4,8 @@ #include "content/browser/renderer_host/input/synthetic_smooth_scroll_gesture.h" +#include <cmath> + #include "content/common/input/input_event.h" #include "ui/events/latency_info.h" @@ -62,7 +64,11 @@ SyntheticGesture::Result SyntheticSmoothScrollGesture::ForwardMouseInputEvents( if (HasFinished()) return SyntheticGesture::GESTURE_FINISHED; - float delta = GetPositionDelta(interval); + // Even though WebMouseWheelEvents take floating point deltas, internally the + // scroll position is stored as an integer. Flooring the deltas ensures that + // the gesture state, especially |current_y_|, is consistent with the internal + // state. + float delta = floor(GetPositionDelta(interval)); current_y_ += delta; ForwardMouseWheelEvent(target, delta); diff --git a/tools/telemetry/telemetry/page/actions/scroll_unittest.py b/tools/telemetry/telemetry/page/actions/scroll_unittest.py index ad8eaa4..aace7c1 100644 --- a/tools/telemetry/telemetry/page/actions/scroll_unittest.py +++ b/tools/telemetry/telemetry/page/actions/scroll_unittest.py @@ -9,8 +9,6 @@ from telemetry.page.actions import scroll from telemetry.unittest import tab_test_case class ScrollActionTest(tab_test_case.TabTestCase): - enabled = False - def setUp(self): self._extra_browser_args.append('--enable-gpu-benchmarking') super(ScrollActionTest, self).setUp() |