Chromium Code Reviews| 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 delegate_->HasTouchEventHandlersAt( | 360 delegate_->HasTouchEventHandlersAt( |
| 361 gfx::ToFlooredPoint(touch_event.touches[i].position))) { | 361 gfx::ToFlooredPoint(touch_event.touches[i].position))) { |
| 362 ack_result = INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 362 ack_result = INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
| 363 break; | 363 break; |
| 364 } | 364 } |
| 365 } | 365 } |
| 366 } | 366 } |
| 367 | 367 |
| 368 // Send mouse wheel events and their disposition to the compositor thread, so | 368 // Send mouse wheel events and their disposition to the compositor thread, so |
| 369 // that they can be used to produce the elastic overscroll effect on Mac. | 369 // that they can be used to produce the elastic overscroll effect on Mac. |
| 370 if (input_event.type == WebInputEvent::MouseWheel) { | 370 if (input_event.type == WebInputEvent::MouseWheel) { |
|
tdresser
2016/03/02 18:26:53
We should make sure that removing all the wheel sp
dtapuska
2016/03/07 18:03:59
Acknowledged.
| |
| 371 const WebMouseWheelEvent& wheel_event = | 371 const WebMouseWheelEvent& wheel_event = |
| 372 static_cast<const WebMouseWheelEvent&>(input_event); | 372 static_cast<const WebMouseWheelEvent&>(input_event); |
| 373 if (wheel_event.canScroll) { | 373 if (wheel_event.canScroll) { |
| 374 delegate_->ObserveWheelEventAndResult( | 374 delegate_->ObserveWheelEventAndResult( |
| 375 wheel_event, | 375 wheel_event, |
| 376 event_overscroll ? event_overscroll->latest_overscroll_delta | 376 event_overscroll ? event_overscroll->latest_overscroll_delta |
| 377 : gfx::Vector2dF(), | 377 : gfx::Vector2dF(), |
| 378 processed != WebInputEventResult::NotHandled); | 378 processed != WebInputEventResult::NotHandled); |
| 379 } | 379 } |
| 380 } else if (input_event.type == WebInputEvent::GestureScrollBegin || | |
| 381 input_event.type == WebInputEvent::GestureScrollEnd || | |
| 382 input_event.type == WebInputEvent::GestureScrollUpdate) { | |
| 383 const WebGestureEvent& gesture_event = | |
| 384 static_cast<const WebGestureEvent&>(input_event); | |
| 385 if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad) { | |
| 386 delegate_->ObserveGestureEventAndResult( | |
| 387 gesture_event, | |
| 388 event_overscroll ? event_overscroll->latest_overscroll_delta | |
| 389 : gfx::Vector2dF(), | |
| 390 processed != WebInputEventResult::NotHandled); | |
| 391 } | |
| 380 } | 392 } |
| 381 | 393 |
| 382 bool frame_pending = | 394 bool frame_pending = |
| 383 widget_->compositor() && widget_->compositor()->BeginMainFrameRequested(); | 395 widget_->compositor() && widget_->compositor()->BeginMainFrameRequested(); |
| 384 | 396 |
| 385 // If we don't have a fast and accurate Now(), we assume the input handlers | 397 // If we don't have a fast and accurate Now(), we assume the input handlers |
| 386 // are heavy and rate limit them. | 398 // are heavy and rate limit them. |
| 387 bool rate_limiting_wanted = input_event.type == WebInputEvent::MouseMove || | 399 bool rate_limiting_wanted = input_event.type == WebInputEvent::MouseMove || |
| 388 input_event.type == WebInputEvent::MouseWheel; | 400 input_event.type == WebInputEvent::MouseWheel; |
| 389 if (rate_limiting_wanted && !start_time.is_null()) { | 401 if (rate_limiting_wanted && !start_time.is_null()) { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 527 if (pending_input_event_ack_) { | 539 if (pending_input_event_ack_) { |
| 528 TRACE_EVENT_ASYNC_END0("input", | 540 TRACE_EVENT_ASYNC_END0("input", |
| 529 "RenderWidgetInputHandler::ThrottledInputEventAck", | 541 "RenderWidgetInputHandler::ThrottledInputEventAck", |
| 530 pending_input_event_ack_.get()); | 542 pending_input_event_ack_.get()); |
| 531 delegate_->OnInputEventAck(std::move(pending_input_event_ack_)); | 543 delegate_->OnInputEventAck(std::move(pending_input_event_ack_)); |
| 532 } | 544 } |
| 533 total_input_handling_time_this_frame_ = base::TimeDelta(); | 545 total_input_handling_time_this_frame_ = base::TimeDelta(); |
| 534 } | 546 } |
| 535 | 547 |
| 536 } // namespace content | 548 } // namespace content |
| OLD | NEW |