| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 context_menu_source_type_(ui::MENU_SOURCE_MOUSE), | 183 context_menu_source_type_(ui::MENU_SOURCE_MOUSE), |
| 184 suppress_next_char_events_(false) { | 184 suppress_next_char_events_(false) { |
| 185 DCHECK(delegate); | 185 DCHECK(delegate); |
| 186 DCHECK(widget); | 186 DCHECK(widget); |
| 187 delegate->SetInputHandler(this); | 187 delegate->SetInputHandler(this); |
| 188 } | 188 } |
| 189 | 189 |
| 190 RenderWidgetInputHandler::~RenderWidgetInputHandler() {} | 190 RenderWidgetInputHandler::~RenderWidgetInputHandler() {} |
| 191 | 191 |
| 192 void RenderWidgetInputHandler::HandleInputEvent( | 192 void RenderWidgetInputHandler::HandleInputEvent( |
| 193 const WebInputEvent& input_event, | 193 const blink::CoalescedWebInputEvent& coalesced_event, |
| 194 const ui::LatencyInfo& latency_info, | 194 const ui::LatencyInfo& latency_info, |
| 195 InputEventDispatchType dispatch_type) { | 195 InputEventDispatchType dispatch_type) { |
| 196 const WebInputEvent input_event = coalesced_event.event(); |
| 196 base::AutoReset<bool> handling_input_event_resetter(&handling_input_event_, | 197 base::AutoReset<bool> handling_input_event_resetter(&handling_input_event_, |
| 197 true); | 198 true); |
| 198 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter( | 199 base::AutoReset<WebInputEvent::Type> handling_event_type_resetter( |
| 199 &handling_event_type_, input_event.type); | 200 &handling_event_type_, input_event.type); |
| 200 | 201 |
| 201 // Calls into |didOverscroll()| while handling this event will populate | 202 // Calls into |didOverscroll()| while handling this event will populate |
| 202 // |event_overscroll|, which in turn will be bundled with the event ack. | 203 // |event_overscroll|, which in turn will be bundled with the event ack. |
| 203 std::unique_ptr<DidOverscrollParams> event_overscroll; | 204 std::unique_ptr<DidOverscrollParams> event_overscroll; |
| 204 base::AutoReset<std::unique_ptr<DidOverscrollParams>*> | 205 base::AutoReset<std::unique_ptr<DidOverscrollParams>*> |
| 205 handling_event_overscroll_resetter(&handling_event_overscroll_, | 206 handling_event_overscroll_resetter(&handling_event_overscroll_, |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 prevent_default = | 310 prevent_default = |
| 310 prevent_default || delegate_->WillHandleGestureEvent(gesture_event); | 311 prevent_default || delegate_->WillHandleGestureEvent(gesture_event); |
| 311 } | 312 } |
| 312 | 313 |
| 313 WebInputEventResult processed = prevent_default | 314 WebInputEventResult processed = prevent_default |
| 314 ? WebInputEventResult::HandledSuppressed | 315 ? WebInputEventResult::HandledSuppressed |
| 315 : WebInputEventResult::NotHandled; | 316 : WebInputEventResult::NotHandled; |
| 316 if (input_event.type != WebInputEvent::Char || !suppress_next_char_events_) { | 317 if (input_event.type != WebInputEvent::Char || !suppress_next_char_events_) { |
| 317 suppress_next_char_events_ = false; | 318 suppress_next_char_events_ = false; |
| 318 if (processed == WebInputEventResult::NotHandled && widget_->GetWebWidget()) | 319 if (processed == WebInputEventResult::NotHandled && widget_->GetWebWidget()) |
| 319 processed = widget_->GetWebWidget()->handleInputEvent(input_event); | 320 processed = widget_->GetWebWidget()->handleInputEvent(coalesced_event); |
| 320 } | 321 } |
| 321 | 322 |
| 322 // TODO(dtapuska): Use the input_event.timeStampSeconds as the start | 323 // TODO(dtapuska): Use the input_event.timeStampSeconds as the start |
| 323 // ideally this should be when the event was sent by the compositor to the | 324 // ideally this should be when the event was sent by the compositor to the |
| 324 // renderer. crbug.com/565348 | 325 // renderer. crbug.com/565348 |
| 325 if (input_event.type == WebInputEvent::TouchStart || | 326 if (input_event.type == WebInputEvent::TouchStart || |
| 326 input_event.type == WebInputEvent::TouchMove || | 327 input_event.type == WebInputEvent::TouchMove || |
| 327 input_event.type == WebInputEvent::TouchEnd) { | 328 input_event.type == WebInputEvent::TouchEnd) { |
| 328 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event); | 329 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event); |
| 329 | 330 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 // it can be bundled in the event ack. | 471 // it can be bundled in the event ack. |
| 471 if (handling_event_overscroll_) { | 472 if (handling_event_overscroll_) { |
| 472 *handling_event_overscroll_ = std::move(params); | 473 *handling_event_overscroll_ = std::move(params); |
| 473 return; | 474 return; |
| 474 } | 475 } |
| 475 | 476 |
| 476 delegate_->OnDidOverscroll(*params); | 477 delegate_->OnDidOverscroll(*params); |
| 477 } | 478 } |
| 478 | 479 |
| 479 } // namespace content | 480 } // namespace content |
| OLD | NEW |