summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-20 22:45:14 +0000
committerasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-20 22:45:14 +0000
commit3c64af84a272e2d37532138b9b4e146524caa28b (patch)
tree2ebaa6054099e4beb4da32e6f3637939513381b5
parent6a1622a028049ab188fb66d7708bbe450d0698a7 (diff)
downloadchromium_src-3c64af84a272e2d37532138b9b4e146524caa28b.zip
chromium_src-3c64af84a272e2d37532138b9b4e146524caa28b.tar.gz
chromium_src-3c64af84a272e2d37532138b9b4e146524caa28b.tar.bz2
[Mac] Fix "Rubber-band overhang doesn't go away after scrolling".
The mouse wheel event coalescing logic didn't account for new WebMouseWheelEvent members. BUG=97265 TEST=per bug Review URL: http://codereview.chromium.org/7976012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102047 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/renderer_host/render_widget_host.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc
index 3cd4a46..04bbeb6 100644
--- a/content/browser/renderer_host/render_widget_host.cc
+++ b/content/browser/renderer_host/render_widget_host.cc
@@ -55,6 +55,21 @@ static const int kHungRendererDelayMs = 20000;
// in trailing scrolls after the user ends their input.
static const int kMaxTimeBetweenWheelMessagesMs = 250;
+namespace {
+
+// Returns |true| if the two wheel events should be coalesced.
+bool ShouldCoalesceMouseWheelEvents(const WebMouseWheelEvent& last_event,
+ const WebMouseWheelEvent& new_event) {
+ return last_event.modifiers == new_event.modifiers &&
+ last_event.scrollByPage == new_event.scrollByPage &&
+ last_event.hasPreciseScrollingDeltas
+ == new_event.hasPreciseScrollingDeltas &&
+ last_event.phase == new_event.phase &&
+ last_event.momentumPhase == new_event.momentumPhase;
+}
+
+} // namespace
+
///////////////////////////////////////////////////////////////////////////////
// RenderWidgetHost
@@ -537,10 +552,8 @@ void RenderWidgetHost::ForwardWheelEvent(
// which many, very small wheel events are sent).
if (mouse_wheel_pending_) {
if (coalesced_mouse_wheel_events_.empty() ||
- coalesced_mouse_wheel_events_.back().modifiers
- != wheel_event.modifiers ||
- coalesced_mouse_wheel_events_.back().scrollByPage
- != wheel_event.scrollByPage) {
+ !ShouldCoalesceMouseWheelEvents(coalesced_mouse_wheel_events_.back(),
+ wheel_event)) {
coalesced_mouse_wheel_events_.push_back(wheel_event);
} else {
WebMouseWheelEvent* last_wheel_event =