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

Side by Side Diff: content/renderer/input/render_widget_input_handler.cc

Issue 2884423003: Use scroll-boundary-behavior to control overscroll-refresh/glow on android. (Closed)
Patch Set: Update ScrollManager to pass the test. Created 3 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/input/render_widget_input_handler.h" 5 #include "content/renderer/input/render_widget_input_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 26 matching lines...) Expand all
37 #endif 37 #endif
38 38
39 using blink::WebFloatPoint; 39 using blink::WebFloatPoint;
40 using blink::WebFloatSize; 40 using blink::WebFloatSize;
41 using blink::WebGestureEvent; 41 using blink::WebGestureEvent;
42 using blink::WebInputEvent; 42 using blink::WebInputEvent;
43 using blink::WebInputEventResult; 43 using blink::WebInputEventResult;
44 using blink::WebKeyboardEvent; 44 using blink::WebKeyboardEvent;
45 using blink::WebMouseEvent; 45 using blink::WebMouseEvent;
46 using blink::WebMouseWheelEvent; 46 using blink::WebMouseWheelEvent;
47 using blink::WebScrollBoundaryBehavior;
47 using blink::WebTouchEvent; 48 using blink::WebTouchEvent;
48 using blink::WebTouchPoint; 49 using blink::WebTouchPoint;
49 using ui::DidOverscrollParams; 50 using ui::DidOverscrollParams;
50 51
51 namespace content { 52 namespace content {
52 53
53 namespace { 54 namespace {
54 55
55 int64_t GetEventLatencyMicros(double event_timestamp, base::TimeTicks now) { 56 int64_t GetEventLatencyMicros(double event_timestamp, base::TimeTicks now) {
56 return (now - base::TimeDelta::FromSecondsD(event_timestamp)) 57 return (now - base::TimeDelta::FromSecondsD(event_timestamp))
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 input_event.GetType() == WebInputEvent::kMouseUp)) { 363 input_event.GetType() == WebInputEvent::kMouseUp)) {
363 delegate_->FocusChangeComplete(); 364 delegate_->FocusChangeComplete();
364 } 365 }
365 #endif 366 #endif
366 } 367 }
367 368
368 void RenderWidgetInputHandler::DidOverscrollFromBlink( 369 void RenderWidgetInputHandler::DidOverscrollFromBlink(
369 const WebFloatSize& overscrollDelta, 370 const WebFloatSize& overscrollDelta,
370 const WebFloatSize& accumulatedOverscroll, 371 const WebFloatSize& accumulatedOverscroll,
371 const WebFloatPoint& position, 372 const WebFloatPoint& position,
372 const WebFloatSize& velocity) { 373 const WebFloatSize& velocity,
374 const WebScrollBoundaryBehavior& behavior) {
373 std::unique_ptr<DidOverscrollParams> params(new DidOverscrollParams()); 375 std::unique_ptr<DidOverscrollParams> params(new DidOverscrollParams());
374 params->accumulated_overscroll = gfx::Vector2dF( 376 params->accumulated_overscroll = gfx::Vector2dF(
375 accumulatedOverscroll.width, accumulatedOverscroll.height); 377 accumulatedOverscroll.width, accumulatedOverscroll.height);
376 params->latest_overscroll_delta = 378 params->latest_overscroll_delta =
377 gfx::Vector2dF(overscrollDelta.width, overscrollDelta.height); 379 gfx::Vector2dF(overscrollDelta.width, overscrollDelta.height);
378 params->current_fling_velocity = 380 params->current_fling_velocity =
379 gfx::Vector2dF(velocity.width, velocity.height); 381 gfx::Vector2dF(velocity.width, velocity.height);
380 params->causal_event_viewport_point = gfx::PointF(position.x, position.y); 382 params->causal_event_viewport_point = gfx::PointF(position.x, position.y);
383 params->scroll_boundary_behavior = behavior;
381 384
382 // If we're currently handling an event, stash the overscroll data such that 385 // If we're currently handling an event, stash the overscroll data such that
383 // it can be bundled in the event ack. 386 // it can be bundled in the event ack.
384 if (handling_event_overscroll_) { 387 if (handling_event_overscroll_) {
385 *handling_event_overscroll_ = std::move(params); 388 *handling_event_overscroll_ = std::move(params);
386 return; 389 return;
387 } 390 }
388 391
389 delegate_->OnDidOverscroll(*params); 392 delegate_->OnDidOverscroll(*params);
390 } 393 }
391 394
392 } // namespace content 395 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698