Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: content/browser/devtools/protocol/input_handler.cc

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Rebased, fixed a comment in web_input_event_builders_mac.mm Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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.setPositionInWidget(x * page_scale_factor_, y * page_scale_factor_);
366 event.y = y * page_scale_factor_; 366 event.setPositionInScreen(x * page_scale_factor_, y * page_scale_factor_);
367 event.globalX = x * page_scale_factor_;
368 event.globalY = y * page_scale_factor_;
369 event.clickCount = click_count.fromMaybe(0); 367 event.clickCount = click_count.fromMaybe(0);
370 event.pointerType = blink::WebPointerProperties::PointerType::Mouse; 368 event.pointerType = blink::WebPointerProperties::PointerType::Mouse;
371 369
372 if (!host_ || !host_->GetRenderWidgetHost()) 370 if (!host_ || !host_->GetRenderWidgetHost())
373 callback->sendFailure(Response::InternalError()); 371 callback->sendFailure(Response::InternalError());
374 372
375 host_->GetRenderWidgetHost()->Focus(); 373 host_->GetRenderWidgetHost()->Focus();
376 input_queued_ = false; 374 input_queued_ = false;
377 pending_mouse_callbacks_.push_back(std::move(callback)); 375 pending_mouse_callbacks_.push_back(std::move(callback));
378 host_->GetRenderWidgetHost()->ForwardMouseEvent(event); 376 host_->GetRenderWidgetHost()->ForwardMouseEvent(event);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 } else { 431 } else {
434 mouse_event = new blink::WebMouseEvent( 432 mouse_event = new blink::WebMouseEvent(
435 event_type, GetEventModifiers( 433 event_type, GetEventModifiers(
436 modifiers.fromMaybe(blink::WebInputEvent::NoModifiers), 434 modifiers.fromMaybe(blink::WebInputEvent::NoModifiers),
437 false, false) | 435 false, false) |
438 button_modifiers, 436 button_modifiers,
439 GetEventTimestamp(timestamp)); 437 GetEventTimestamp(timestamp));
440 event.reset(mouse_event); 438 event.reset(mouse_event);
441 } 439 }
442 440
443 mouse_event->x = x; 441 mouse_event->setPositionInWidget(x, y);
444 mouse_event->y = y;
445 mouse_event->button = event_button; 442 mouse_event->button = event_button;
446 mouse_event->globalX = x; 443 mouse_event->setPositionInScreen(x, y);
447 mouse_event->globalY = y;
448 mouse_event->clickCount = click_count.fromMaybe(0); 444 mouse_event->clickCount = click_count.fromMaybe(0);
449 mouse_event->pointerType = blink::WebPointerProperties::PointerType::Touch; 445 mouse_event->pointerType = blink::WebPointerProperties::PointerType::Touch;
450 446
451 if (!host_ || !host_->GetRenderWidgetHost()) 447 if (!host_ || !host_->GetRenderWidgetHost())
452 return Response::InternalError(); 448 return Response::InternalError();
453 449
454 if (wheel_event) 450 if (wheel_event)
455 host_->GetRenderWidgetHost()->ForwardWheelEvent(*wheel_event); 451 host_->GetRenderWidgetHost()->ForwardWheelEvent(*wheel_event);
456 else 452 else
457 host_->GetRenderWidgetHost()->ForwardMouseEvent(*mouse_event); 453 host_->GetRenderWidgetHost()->ForwardMouseEvent(*mouse_event);
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 for (auto& callback : pending_key_callbacks_) 636 for (auto& callback : pending_key_callbacks_)
641 callback->sendSuccess(); 637 callback->sendSuccess();
642 pending_key_callbacks_.clear(); 638 pending_key_callbacks_.clear();
643 for (auto& callback : pending_mouse_callbacks_) 639 for (auto& callback : pending_mouse_callbacks_)
644 callback->sendSuccess(); 640 callback->sendSuccess();
645 pending_mouse_callbacks_.clear(); 641 pending_mouse_callbacks_.clear();
646 } 642 }
647 643
648 } // namespace protocol 644 } // namespace protocol
649 } // namespace content 645 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/protocol/color_picker.cc ('k') | content/browser/frame_host/render_widget_host_view_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698