fix: don't use deprecated ui::MouseEvent constructor (#44919)
* refactor: do not use deprecated gfx::Point constructor for MouseEvent Deprecated in https://chromium-review.googlesource.com/c/1444251 Co-authored-by: Charles Kerr <charles@charleskerr.com> * refactor: use WebInputEvent::GetTypeAsUiEventType() instead of rolling our own Added in https://chromium-review.googlesource.com/c/chromium/src/+/2180291 Co-authored-by: Charles Kerr <charles@charleskerr.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
parent
1c2015ed1f
commit
fa98b4d542
1 changed files with 6 additions and 31 deletions
|
@ -56,31 +56,6 @@ namespace {
|
|||
const float kDefaultScaleFactor = 1.0;
|
||||
|
||||
ui::MouseEvent UiMouseEventFromWebMouseEvent(blink::WebMouseEvent event) {
|
||||
ui::EventType type = ui::EventType::kUnknown;
|
||||
switch (event.GetType()) {
|
||||
case blink::WebInputEvent::Type::kMouseDown:
|
||||
type = ui::EventType::kMousePressed;
|
||||
break;
|
||||
case blink::WebInputEvent::Type::kMouseUp:
|
||||
type = ui::EventType::kMouseReleased;
|
||||
break;
|
||||
case blink::WebInputEvent::Type::kMouseMove:
|
||||
type = ui::EventType::kMouseMoved;
|
||||
break;
|
||||
case blink::WebInputEvent::Type::kMouseEnter:
|
||||
type = ui::EventType::kMouseEntered;
|
||||
break;
|
||||
case blink::WebInputEvent::Type::kMouseLeave:
|
||||
type = ui::EventType::kMouseExited;
|
||||
break;
|
||||
case blink::WebInputEvent::Type::kMouseWheel:
|
||||
type = ui::EventType::kMousewheel;
|
||||
break;
|
||||
default:
|
||||
type = ui::EventType::kUnknown;
|
||||
break;
|
||||
}
|
||||
|
||||
int button_flags = 0;
|
||||
switch (event.button) {
|
||||
case blink::WebMouseEvent::Button::kBack:
|
||||
|
@ -103,12 +78,12 @@ ui::MouseEvent UiMouseEventFromWebMouseEvent(blink::WebMouseEvent event) {
|
|||
break;
|
||||
}
|
||||
|
||||
ui::MouseEvent ui_event(type,
|
||||
gfx::Point(std::floor(event.PositionInWidget().x()),
|
||||
std::floor(event.PositionInWidget().y())),
|
||||
gfx::Point(std::floor(event.PositionInWidget().x()),
|
||||
std::floor(event.PositionInWidget().y())),
|
||||
ui::EventTimeForNow(), button_flags, button_flags);
|
||||
ui::MouseEvent ui_event{event.GetTypeAsUiEventType(),
|
||||
event.PositionInWidget(),
|
||||
event.PositionInWidget(),
|
||||
ui::EventTimeForNow(),
|
||||
button_flags,
|
||||
button_flags};
|
||||
ui_event.SetClickCount(event.click_count);
|
||||
|
||||
return ui_event;
|
||||
|
|
Loading…
Reference in a new issue