Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: content/renderer/render_widget.cc

Issue 1203693003: Setting Accurate ScrollResult from Blink for Elastic Scroll. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index de16016217bd6bb6eb96a4e6aa2b4e6bbc4226a9..d0a6ca3df3f0ba043ec98ea153ae6b26af675688 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -1208,7 +1208,10 @@ void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event,
// that they can be used to produce the elastic overscroll effect on Mac.
if (input_event->type == WebInputEvent::MouseWheel) {
ObserveWheelEventAndResult(
- static_cast<const WebMouseWheelEvent&>(*input_event), processed);
+ static_cast<const WebMouseWheelEvent&>(*input_event),
+ event_overscroll ? event_overscroll->latest_overscroll_delta
+ : gfx::Vector2dF(),
+ processed);
}
bool frame_pending = compositor_ && compositor_->BeginMainFrameRequested();
@@ -2308,23 +2311,15 @@ bool RenderWidget::WillHandleGestureEvent(
void RenderWidget::ObserveWheelEventAndResult(
const blink::WebMouseWheelEvent& wheel_event,
+ const gfx::Vector2dF& wheel_unused_delta,
bool event_processed) {
if (!compositor_deps_->IsElasticOverscrollEnabled())
return;
- // Blink does not accurately compute scroll bubbling or overscroll. For now,
- // assume that an unprocessed event was entirely an overscroll, and that a
- // processed event was entirely scroll.
- // TODO(ccameron): Retrieve an accurate scroll result from Blink.
- // http://crbug.com/442859
cc::InputHandlerScrollResult scroll_result;
- if (event_processed) {
- scroll_result.did_scroll = true;
- } else {
- scroll_result.did_overscroll_root = true;
- scroll_result.unused_scroll_delta =
- gfx::Vector2dF(-wheel_event.deltaX, -wheel_event.deltaY);
- }
+ scroll_result.did_scroll = event_processed;
+ scroll_result.did_overscroll_root = !wheel_unused_delta.IsZero();
+ scroll_result.unused_scroll_delta = wheel_unused_delta;
RenderThreadImpl* render_thread = RenderThreadImpl::current();
InputHandlerManager* input_handler_manager =
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698