1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:37:34 +00:00

LibWeb+WebContent+headless-browser: Use CSSPixels for PageClient events

...and also for hit testing, which is involved in most of them.

Much of this is temporary conversions and other awkwardness, which
should resolve itself as the rest of LibWeb is converted to these new
types. Hopefully. :thousandyakstare:
This commit is contained in:
Sam Atkins 2022-11-02 17:35:53 +00:00 committed by Linus Groh
parent 045aa8530c
commit 3c7bd5a317
27 changed files with 169 additions and 159 deletions

View file

@ -52,13 +52,13 @@ MouseEvent* MouseEvent::create(JS::Realm& realm, FlyString const& event_name, Mo
return realm.heap().allocate<MouseEvent>(realm, realm, event_name, event_init);
}
MouseEvent* MouseEvent::create_from_platform_event(JS::Realm& realm, FlyString const& event_name, double offset_x, double offset_y, double client_x, double client_y, unsigned buttons, unsigned mouse_button)
MouseEvent* MouseEvent::create_from_platform_event(JS::Realm& realm, FlyString const& event_name, CSSPixels offset_x, CSSPixels offset_y, CSSPixels client_x, CSSPixels client_y, unsigned buttons, unsigned mouse_button)
{
MouseEventInit event_init {};
event_init.offset_x = offset_x;
event_init.offset_y = offset_y;
event_init.client_x = client_x;
event_init.client_y = client_y;
event_init.offset_x = static_cast<double>(offset_x.value());
event_init.offset_y = static_cast<double>(offset_y.value());
event_init.client_x = static_cast<double>(client_x.value());
event_init.client_y = static_cast<double>(client_y.value());
event_init.button = determine_button(mouse_button);
event_init.buttons = buttons;
return MouseEvent::create(realm, event_name, event_init);