| OLD | NEW |
| 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 27 matching lines...) Expand all Loading... |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 using blink::WebFloatPoint; | 40 using blink::WebFloatPoint; |
| 41 using blink::WebFloatSize; | 41 using blink::WebFloatSize; |
| 42 using blink::WebGestureEvent; | 42 using blink::WebGestureEvent; |
| 43 using blink::WebInputEvent; | 43 using blink::WebInputEvent; |
| 44 using blink::WebInputEventResult; | 44 using blink::WebInputEventResult; |
| 45 using blink::WebKeyboardEvent; | 45 using blink::WebKeyboardEvent; |
| 46 using blink::WebMouseEvent; | 46 using blink::WebMouseEvent; |
| 47 using blink::WebMouseWheelEvent; | 47 using blink::WebMouseWheelEvent; |
| 48 using blink::WebScrollBoundaryBehavior; |
| 48 using blink::WebTouchEvent; | 49 using blink::WebTouchEvent; |
| 49 using blink::WebTouchPoint; | 50 using blink::WebTouchPoint; |
| 50 using ui::DidOverscrollParams; | 51 using ui::DidOverscrollParams; |
| 51 | 52 |
| 52 namespace content { | 53 namespace content { |
| 53 | 54 |
| 54 namespace { | 55 namespace { |
| 55 | 56 |
| 56 int64_t GetEventLatencyMicros(double event_timestamp, base::TimeTicks now) { | 57 int64_t GetEventLatencyMicros(double event_timestamp, base::TimeTicks now) { |
| 57 return (now - base::TimeDelta::FromSecondsD(event_timestamp)) | 58 return (now - base::TimeDelta::FromSecondsD(event_timestamp)) |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 delegate_->FocusChangeComplete(); | 440 delegate_->FocusChangeComplete(); |
| 440 } | 441 } |
| 441 #endif | 442 #endif |
| 442 return ack_result; | 443 return ack_result; |
| 443 } | 444 } |
| 444 | 445 |
| 445 void RenderWidgetInputHandler::DidOverscrollFromBlink( | 446 void RenderWidgetInputHandler::DidOverscrollFromBlink( |
| 446 const WebFloatSize& overscrollDelta, | 447 const WebFloatSize& overscrollDelta, |
| 447 const WebFloatSize& accumulatedOverscroll, | 448 const WebFloatSize& accumulatedOverscroll, |
| 448 const WebFloatPoint& position, | 449 const WebFloatPoint& position, |
| 449 const WebFloatSize& velocity) { | 450 const WebFloatSize& velocity, |
| 451 const WebScrollBoundaryBehavior& behavior) { |
| 450 std::unique_ptr<DidOverscrollParams> params(new DidOverscrollParams()); | 452 std::unique_ptr<DidOverscrollParams> params(new DidOverscrollParams()); |
| 451 params->accumulated_overscroll = gfx::Vector2dF( | 453 params->accumulated_overscroll = gfx::Vector2dF( |
| 452 accumulatedOverscroll.width, accumulatedOverscroll.height); | 454 accumulatedOverscroll.width, accumulatedOverscroll.height); |
| 453 params->latest_overscroll_delta = | 455 params->latest_overscroll_delta = |
| 454 gfx::Vector2dF(overscrollDelta.width, overscrollDelta.height); | 456 gfx::Vector2dF(overscrollDelta.width, overscrollDelta.height); |
| 455 params->current_fling_velocity = | 457 params->current_fling_velocity = |
| 456 gfx::Vector2dF(velocity.width, velocity.height); | 458 gfx::Vector2dF(velocity.width, velocity.height); |
| 457 params->causal_event_viewport_point = gfx::PointF(position.x, position.y); | 459 params->causal_event_viewport_point = gfx::PointF(position.x, position.y); |
| 460 params->scroll_boundary_behavior = behavior; |
| 458 | 461 |
| 459 // If we're currently handling an event, stash the overscroll data such that | 462 // If we're currently handling an event, stash the overscroll data such that |
| 460 // it can be bundled in the event ack. | 463 // it can be bundled in the event ack. |
| 461 if (handling_event_overscroll_) { | 464 if (handling_event_overscroll_) { |
| 462 *handling_event_overscroll_ = std::move(params); | 465 *handling_event_overscroll_ = std::move(params); |
| 463 return; | 466 return; |
| 464 } | 467 } |
| 465 | 468 |
| 466 delegate_->OnDidOverscroll(*params); | 469 delegate_->OnDidOverscroll(*params); |
| 467 } | 470 } |
| 468 | 471 |
| 469 } // namespace content | 472 } // namespace content |
| OLD | NEW |