OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/devtools/protocol/input_handler.h" | 5 #include "content/browser/devtools/protocol/input_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 } | 355 } |
356 | 356 |
357 blink::WebMouseEvent event( | 357 blink::WebMouseEvent event( |
358 event_type, | 358 event_type, |
359 GetEventModifiers(modifiers.fromMaybe(blink::WebInputEvent::NoModifiers), | 359 GetEventModifiers(modifiers.fromMaybe(blink::WebInputEvent::NoModifiers), |
360 false, false) | | 360 false, false) | |
361 button_modifiers, | 361 button_modifiers, |
362 GetEventTimestamp(std::move(timestamp))); | 362 GetEventTimestamp(std::move(timestamp))); |
363 | 363 |
364 event.button = event_button; | 364 event.button = event_button; |
365 event.x = x * page_scale_factor_; | 365 event.position.x = x * page_scale_factor_; |
366 event.y = y * page_scale_factor_; | 366 event.position.y = y * page_scale_factor_; |
367 event.globalX = x * page_scale_factor_; | 367 event.screenPosition.x = x * page_scale_factor_; |
368 event.globalY = y * page_scale_factor_; | 368 event.screenPosition.y = y * page_scale_factor_; |
369 event.clickCount = click_count.fromMaybe(0); | 369 event.clickCount = click_count.fromMaybe(0); |
370 event.pointerType = blink::WebPointerProperties::PointerType::Mouse; | 370 event.pointerType = blink::WebPointerProperties::PointerType::Mouse; |
371 | 371 |
372 if (!host_ || !host_->GetRenderWidgetHost()) | 372 if (!host_ || !host_->GetRenderWidgetHost()) |
373 callback->sendFailure(Response::InternalError()); | 373 callback->sendFailure(Response::InternalError()); |
374 | 374 |
375 host_->GetRenderWidgetHost()->Focus(); | 375 host_->GetRenderWidgetHost()->Focus(); |
376 input_queued_ = false; | 376 input_queued_ = false; |
377 pending_mouse_callbacks_.push_back(std::move(callback)); | 377 pending_mouse_callbacks_.push_back(std::move(callback)); |
378 host_->GetRenderWidgetHost()->ForwardMouseEvent(event); | 378 host_->GetRenderWidgetHost()->ForwardMouseEvent(event); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 } else { | 433 } else { |
434 mouse_event = new blink::WebMouseEvent( | 434 mouse_event = new blink::WebMouseEvent( |
435 event_type, GetEventModifiers( | 435 event_type, GetEventModifiers( |
436 modifiers.fromMaybe(blink::WebInputEvent::NoModifiers), | 436 modifiers.fromMaybe(blink::WebInputEvent::NoModifiers), |
437 false, false) | | 437 false, false) | |
438 button_modifiers, | 438 button_modifiers, |
439 GetEventTimestamp(timestamp)); | 439 GetEventTimestamp(timestamp)); |
440 event.reset(mouse_event); | 440 event.reset(mouse_event); |
441 } | 441 } |
442 | 442 |
443 mouse_event->x = x; | 443 mouse_event->position.x = x; |
444 mouse_event->y = y; | 444 mouse_event->position.y = y; |
445 mouse_event->button = event_button; | 445 mouse_event->button = event_button; |
446 mouse_event->globalX = x; | 446 mouse_event->screenPosition.x = x; |
447 mouse_event->globalY = y; | 447 mouse_event->screenPosition.y = y; |
448 mouse_event->clickCount = click_count.fromMaybe(0); | 448 mouse_event->clickCount = click_count.fromMaybe(0); |
449 mouse_event->pointerType = blink::WebPointerProperties::PointerType::Touch; | 449 mouse_event->pointerType = blink::WebPointerProperties::PointerType::Touch; |
450 | 450 |
451 if (!host_ || !host_->GetRenderWidgetHost()) | 451 if (!host_ || !host_->GetRenderWidgetHost()) |
452 return Response::InternalError(); | 452 return Response::InternalError(); |
453 | 453 |
454 if (wheel_event) | 454 if (wheel_event) |
455 host_->GetRenderWidgetHost()->ForwardWheelEvent(*wheel_event); | 455 host_->GetRenderWidgetHost()->ForwardWheelEvent(*wheel_event); |
456 else | 456 else |
457 host_->GetRenderWidgetHost()->ForwardMouseEvent(*mouse_event); | 457 host_->GetRenderWidgetHost()->ForwardMouseEvent(*mouse_event); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 for (auto& callback : pending_key_callbacks_) | 640 for (auto& callback : pending_key_callbacks_) |
641 callback->sendSuccess(); | 641 callback->sendSuccess(); |
642 pending_key_callbacks_.clear(); | 642 pending_key_callbacks_.clear(); |
643 for (auto& callback : pending_mouse_callbacks_) | 643 for (auto& callback : pending_mouse_callbacks_) |
644 callback->sendSuccess(); | 644 callback->sendSuccess(); |
645 pending_mouse_callbacks_.clear(); | 645 pending_mouse_callbacks_.clear(); |
646 } | 646 } |
647 | 647 |
648 } // namespace protocol | 648 } // namespace protocol |
649 } // namespace content | 649 } // namespace content |
OLD | NEW |