mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47:35 +00:00
LibWeb+WebContent: Forbid access to underlying type of CSSPixels
Although DistinctNumeric, which is supposed to abstract the underlying type, was used to represent CSSPixels, we have a whole bunch of places in the layout code that assume CSSPixels::value() returns a floating-point type. This assumption makes it difficult to replace the underlying type in CSSPixels with a non-floating type. To make it easier to transition CSSPixels to fixed-point math, one step we can take is to prevent access to the underlying type using value() and instead use explicit conversions with the to_float(), to_double(), and to_int() methods.
This commit is contained in:
parent
5a54c686a7
commit
147c3b3d97
43 changed files with 340 additions and 220 deletions
|
@ -39,10 +39,10 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<WheelEvent>> WheelEvent::create(JS::Realm&
|
|||
WebIDL::ExceptionOr<JS::NonnullGCPtr<WheelEvent>> WheelEvent::create_from_platform_event(JS::Realm& realm, FlyString const& event_name, CSSPixels offset_x, CSSPixels offset_y, CSSPixels client_x, CSSPixels client_y, double delta_x, double delta_y, unsigned buttons, unsigned button)
|
||||
{
|
||||
WheelEventInit event_init {};
|
||||
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.offset_x = offset_x.to_double();
|
||||
event_init.offset_y = offset_y.to_double();
|
||||
event_init.client_x = client_x.to_double();
|
||||
event_init.client_y = client_y.to_double();
|
||||
event_init.button = button;
|
||||
event_init.buttons = buttons;
|
||||
event_init.delta_x = delta_x;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue