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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 if (input_event.type == WebInputEvent::MouseWheel) { | 357 if (input_event.type == WebInputEvent::MouseWheel) { |
358 const WebMouseWheelEvent& wheel_event = | 358 const WebMouseWheelEvent& wheel_event = |
359 static_cast<const WebMouseWheelEvent&>(input_event); | 359 static_cast<const WebMouseWheelEvent&>(input_event); |
360 if (wheel_event.canScroll) { | 360 if (wheel_event.canScroll) { |
361 delegate_->ObserveWheelEventAndResult( | 361 delegate_->ObserveWheelEventAndResult( |
362 wheel_event, | 362 wheel_event, |
363 event_overscroll ? event_overscroll->latest_overscroll_delta | 363 event_overscroll ? event_overscroll->latest_overscroll_delta |
364 : gfx::Vector2dF(), | 364 : gfx::Vector2dF(), |
365 processed != WebInputEventResult::NotHandled); | 365 processed != WebInputEventResult::NotHandled); |
366 } | 366 } |
| 367 } else if (input_event.type == WebInputEvent::GestureScrollBegin || |
| 368 input_event.type == WebInputEvent::GestureScrollEnd || |
| 369 input_event.type == WebInputEvent::GestureScrollUpdate) { |
| 370 const WebGestureEvent& gesture_event = |
| 371 static_cast<const WebGestureEvent&>(input_event); |
| 372 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad) { |
| 373 delegate_->ObserveGestureEventAndResult( |
| 374 gesture_event, |
| 375 event_overscroll ? event_overscroll->latest_overscroll_delta |
| 376 : gfx::Vector2dF(), |
| 377 processed != WebInputEventResult::NotHandled); |
| 378 } |
367 } | 379 } |
368 | 380 |
369 bool frame_pending = | 381 bool frame_pending = |
370 widget_->compositor() && widget_->compositor()->BeginMainFrameRequested(); | 382 widget_->compositor() && widget_->compositor()->BeginMainFrameRequested(); |
371 | 383 |
372 // If we don't have a fast and accurate Now(), we assume the input handlers | 384 // If we don't have a fast and accurate Now(), we assume the input handlers |
373 // are heavy and rate limit them. | 385 // are heavy and rate limit them. |
374 bool rate_limiting_wanted = input_event.type == WebInputEvent::MouseMove || | 386 bool rate_limiting_wanted = input_event.type == WebInputEvent::MouseMove || |
375 input_event.type == WebInputEvent::MouseWheel; | 387 input_event.type == WebInputEvent::MouseWheel; |
376 if (rate_limiting_wanted && !start_time.is_null()) { | 388 if (rate_limiting_wanted && !start_time.is_null()) { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 if (pending_input_event_ack_) { | 526 if (pending_input_event_ack_) { |
515 TRACE_EVENT_ASYNC_END0("input", | 527 TRACE_EVENT_ASYNC_END0("input", |
516 "RenderWidgetInputHandler::ThrottledInputEventAck", | 528 "RenderWidgetInputHandler::ThrottledInputEventAck", |
517 pending_input_event_ack_.get()); | 529 pending_input_event_ack_.get()); |
518 delegate_->OnInputEventAck(std::move(pending_input_event_ack_)); | 530 delegate_->OnInputEventAck(std::move(pending_input_event_ack_)); |
519 } | 531 } |
520 total_input_handling_time_this_frame_ = base::TimeDelta(); | 532 total_input_handling_time_this_frame_ = base::TimeDelta(); |
521 } | 533 } |
522 | 534 |
523 } // namespace content | 535 } // namespace content |
OLD | NEW |