| 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 |
| 11 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
| 14 #include "base/trace_event/trace_event_synthetic_delay.h" | 14 #include "base/trace_event/trace_event_synthetic_delay.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "cc/trees/swap_promise_monitor.h" | 16 #include "cc/trees/swap_promise_monitor.h" |
| 17 #include "content/common/input/input_event_ack.h" | 17 #include "content/common/input/input_event_ack.h" |
| 18 #include "content/common/input/input_event_ack_state.h" | 18 #include "content/common/input/input_event_ack_state.h" |
| 19 #include "content/public/common/content_switches.h" | 19 #include "content/public/common/content_switches.h" |
| 20 #include "content/public/renderer/render_frame.h" |
| 20 #include "content/renderer/gpu/render_widget_compositor.h" | 21 #include "content/renderer/gpu/render_widget_compositor.h" |
| 21 #include "content/renderer/ime_event_guard.h" | 22 #include "content/renderer/ime_event_guard.h" |
| 22 #include "content/renderer/input/render_widget_input_handler_delegate.h" | 23 #include "content/renderer/input/render_widget_input_handler_delegate.h" |
| 23 #include "content/renderer/render_thread_impl.h" | 24 #include "content/renderer/render_thread_impl.h" |
| 24 #include "content/renderer/render_widget.h" | 25 #include "content/renderer/render_widget.h" |
| 25 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 26 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| 26 #include "third_party/WebKit/public/platform/WebFloatSize.h" | 27 #include "third_party/WebKit/public/platform/WebFloatSize.h" |
| 27 #include "third_party/WebKit/public/platform/WebGestureEvent.h" | 28 #include "third_party/WebKit/public/platform/WebGestureEvent.h" |
| 28 #include "third_party/WebKit/public/platform/WebKeyboardEvent.h" | 29 #include "third_party/WebKit/public/platform/WebKeyboardEvent.h" |
| 29 #include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" | 30 #include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 handling_event_overscroll_(nullptr), | 200 handling_event_overscroll_(nullptr), |
| 200 handling_event_type_(WebInputEvent::kUndefined), | 201 handling_event_type_(WebInputEvent::kUndefined), |
| 201 suppress_next_char_events_(false) { | 202 suppress_next_char_events_(false) { |
| 202 DCHECK(delegate); | 203 DCHECK(delegate); |
| 203 DCHECK(widget); | 204 DCHECK(widget); |
| 204 delegate->SetInputHandler(this); | 205 delegate->SetInputHandler(this); |
| 205 } | 206 } |
| 206 | 207 |
| 207 RenderWidgetInputHandler::~RenderWidgetInputHandler() {} | 208 RenderWidgetInputHandler::~RenderWidgetInputHandler() {} |
| 208 | 209 |
| 210 int RenderWidgetInputHandler::HitTestFrameAt(const gfx::PointF& point) { |
| 211 return RenderFrame::GetRoutingIdForWebFrame( |
| 212 widget_->GetWebWidget()->HitTestFrameAt( |
| 213 blink::WebFloatPoint(point.x(), point.y()))); |
| 214 } |
| 215 |
| 209 void RenderWidgetInputHandler::HandleInputEvent( | 216 void RenderWidgetInputHandler::HandleInputEvent( |
| 210 const blink::WebCoalescedInputEvent& coalesced_event, | 217 const blink::WebCoalescedInputEvent& coalesced_event, |
| 211 const ui::LatencyInfo& latency_info, | 218 const ui::LatencyInfo& latency_info, |
| 212 HandledEventCallback callback) { | 219 HandledEventCallback callback) { |
| 213 const WebInputEvent& input_event = coalesced_event.Event(); | 220 const WebInputEvent& input_event = coalesced_event.Event(); |
| 214 base::AutoReset<bool> handling_input_event_resetter(&handling_input_event_, | 221 base::AutoReset<bool> handling_input_event_resetter(&handling_input_event_, |
| 215 true); | 222 true); |
| 216 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter( | 223 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter( |
| 217 &handling_event_type_, input_event.GetType()); | 224 &handling_event_type_, input_event.GetType()); |
| 218 | 225 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 // it can be bundled in the event ack. | 447 // it can be bundled in the event ack. |
| 441 if (handling_event_overscroll_) { | 448 if (handling_event_overscroll_) { |
| 442 *handling_event_overscroll_ = std::move(params); | 449 *handling_event_overscroll_ = std::move(params); |
| 443 return; | 450 return; |
| 444 } | 451 } |
| 445 | 452 |
| 446 delegate_->OnDidOverscroll(*params); | 453 delegate_->OnDidOverscroll(*params); |
| 447 } | 454 } |
| 448 | 455 |
| 449 } // namespace content | 456 } // namespace content |
| OLD | NEW |