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

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, 3 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 input_event.GetType() == WebInputEvent::kMouseUp)) { 370 input_event.GetType() == WebInputEvent::kMouseUp)) {
370 delegate_->FocusChangeComplete(); 371 delegate_->FocusChangeComplete();
371 } 372 }
372 #endif 373 #endif
373 } 374 }
374 375
375 void RenderWidgetInputHandler::DidOverscrollFromBlink( 376 void RenderWidgetInputHandler::DidOverscrollFromBlink(
376 const WebFloatSize& overscrollDelta, 377 const WebFloatSize& overscrollDelta,
377 const WebFloatSize& accumulatedOverscroll, 378 const WebFloatSize& accumulatedOverscroll,
378 const WebFloatPoint& position, 379 const WebFloatPoint& position,
379 const WebFloatSize& velocity) { 380 const WebFloatSize& velocity,
381 const WebScrollBoundaryBehavior& behavior) {
380 std::unique_ptr<DidOverscrollParams> params(new DidOverscrollParams()); 382 std::unique_ptr<DidOverscrollParams> params(new DidOverscrollParams());
381 params->accumulated_overscroll = gfx::Vector2dF( 383 params->accumulated_overscroll = gfx::Vector2dF(
382 accumulatedOverscroll.width, accumulatedOverscroll.height); 384 accumulatedOverscroll.width, accumulatedOverscroll.height);
383 params->latest_overscroll_delta = 385 params->latest_overscroll_delta =
384 gfx::Vector2dF(overscrollDelta.width, overscrollDelta.height); 386 gfx::Vector2dF(overscrollDelta.width, overscrollDelta.height);
385 params->current_fling_velocity = 387 params->current_fling_velocity =
386 gfx::Vector2dF(velocity.width, velocity.height); 388 gfx::Vector2dF(velocity.width, velocity.height);
387 params->causal_event_viewport_point = gfx::PointF(position.x, position.y); 389 params->causal_event_viewport_point = gfx::PointF(position.x, position.y);
390 params->scroll_boundary_behavior = behavior;
388 391
389 // If we're currently handling an event, stash the overscroll data such that 392 // If we're currently handling an event, stash the overscroll data such that
390 // it can be bundled in the event ack. 393 // it can be bundled in the event ack.
391 if (handling_event_overscroll_) { 394 if (handling_event_overscroll_) {
392 *handling_event_overscroll_ = std::move(params); 395 *handling_event_overscroll_ = std::move(params);
393 return; 396 return;
394 } 397 }
395 398
396 delegate_->OnDidOverscroll(*params); 399 delegate_->OnDidOverscroll(*params);
397 } 400 }
398 401
399 bool RenderWidgetInputHandler::ProcessTouchAction( 402 bool RenderWidgetInputHandler::ProcessTouchAction(
400 cc::TouchAction touch_action) { 403 cc::TouchAction touch_action) {
401 // Ignore setTouchAction calls that result from synthetic touch events (eg. 404 // Ignore setTouchAction calls that result from synthetic touch events (eg.
402 // when blink is emulating touch with mouse). 405 // when blink is emulating touch with mouse).
403 if (handling_event_type_ != WebInputEvent::kTouchStart) 406 if (handling_event_type_ != WebInputEvent::kTouchStart)
404 return false; 407 return false;
405 408
406 handling_touch_action_ = touch_action; 409 handling_touch_action_ = touch_action;
407 return true; 410 return true;
408 } 411 }
409 412
410 } // namespace content 413 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/input/render_widget_input_handler.h ('k') | content/renderer/input/widget_input_handler_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698