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

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: rebase Created 3 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 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 input_event.GetType() == WebInputEvent::kMouseUp)) { 416 input_event.GetType() == WebInputEvent::kMouseUp)) {
416 delegate_->FocusChangeComplete(); 417 delegate_->FocusChangeComplete();
417 } 418 }
418 #endif 419 #endif
419 } 420 }
420 421
421 void RenderWidgetInputHandler::DidOverscrollFromBlink( 422 void RenderWidgetInputHandler::DidOverscrollFromBlink(
422 const WebFloatSize& overscrollDelta, 423 const WebFloatSize& overscrollDelta,
423 const WebFloatSize& accumulatedOverscroll, 424 const WebFloatSize& accumulatedOverscroll,
424 const WebFloatPoint& position, 425 const WebFloatPoint& position,
425 const WebFloatSize& velocity) { 426 const WebFloatSize& velocity,
427 const WebScrollBoundaryBehavior& behavior) {
426 std::unique_ptr<DidOverscrollParams> params(new DidOverscrollParams()); 428 std::unique_ptr<DidOverscrollParams> params(new DidOverscrollParams());
427 params->accumulated_overscroll = gfx::Vector2dF( 429 params->accumulated_overscroll = gfx::Vector2dF(
428 accumulatedOverscroll.width, accumulatedOverscroll.height); 430 accumulatedOverscroll.width, accumulatedOverscroll.height);
429 params->latest_overscroll_delta = 431 params->latest_overscroll_delta =
430 gfx::Vector2dF(overscrollDelta.width, overscrollDelta.height); 432 gfx::Vector2dF(overscrollDelta.width, overscrollDelta.height);
431 params->current_fling_velocity = 433 params->current_fling_velocity =
432 gfx::Vector2dF(velocity.width, velocity.height); 434 gfx::Vector2dF(velocity.width, velocity.height);
433 params->causal_event_viewport_point = gfx::PointF(position.x, position.y); 435 params->causal_event_viewport_point = gfx::PointF(position.x, position.y);
436 params->scroll_boundary_behavior = behavior;
434 437
435 // If we're currently handling an event, stash the overscroll data such that 438 // If we're currently handling an event, stash the overscroll data such that
436 // it can be bundled in the event ack. 439 // it can be bundled in the event ack.
437 if (handling_event_overscroll_) { 440 if (handling_event_overscroll_) {
438 *handling_event_overscroll_ = std::move(params); 441 *handling_event_overscroll_ = std::move(params);
439 return; 442 return;
440 } 443 }
441 444
442 delegate_->OnDidOverscroll(*params); 445 delegate_->OnDidOverscroll(*params);
443 } 446 }
444 447
445 } // namespace content 448 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698