mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:47:34 +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
|
@ -232,7 +232,7 @@ void PageHost::page_did_request_scroll(i32 x_delta, i32 y_delta)
|
|||
|
||||
void PageHost::page_did_request_scroll_to(Web::CSSPixelPoint scroll_position)
|
||||
{
|
||||
m_client.async_did_request_scroll_to({ scroll_position.x().value(), scroll_position.y().value() });
|
||||
m_client.async_did_request_scroll_to({ scroll_position.x().to_int(), scroll_position.y().to_int() });
|
||||
}
|
||||
|
||||
void PageHost::page_did_request_scroll_into_view(Web::CSSPixelRect const& rect)
|
||||
|
@ -246,7 +246,7 @@ void PageHost::page_did_request_scroll_into_view(Web::CSSPixelRect const& rect)
|
|||
|
||||
void PageHost::page_did_enter_tooltip_area(Web::CSSPixelPoint content_position, DeprecatedString const& title)
|
||||
{
|
||||
m_client.async_did_enter_tooltip_area({ content_position.x().value(), content_position.y().value() }, title);
|
||||
m_client.async_did_enter_tooltip_area({ content_position.x().to_int(), content_position.y().to_int() }, title);
|
||||
}
|
||||
|
||||
void PageHost::page_did_leave_tooltip_area()
|
||||
|
@ -367,12 +367,12 @@ void PageHost::page_did_change_favicon(Gfx::Bitmap const& favicon)
|
|||
void PageHost::page_did_request_image_context_menu(Web::CSSPixelPoint content_position, URL const& url, DeprecatedString const& target, unsigned modifiers, Gfx::Bitmap const* bitmap_pointer)
|
||||
{
|
||||
auto bitmap = bitmap_pointer ? bitmap_pointer->to_shareable_bitmap() : Gfx::ShareableBitmap();
|
||||
m_client.async_did_request_image_context_menu({ content_position.x().value(), content_position.y().value() }, url, target, modifiers, bitmap);
|
||||
m_client.async_did_request_image_context_menu({ content_position.x().to_int(), content_position.y().to_int() }, url, target, modifiers, bitmap);
|
||||
}
|
||||
|
||||
void PageHost::page_did_request_video_context_menu(Web::CSSPixelPoint content_position, URL const& url, DeprecatedString const& target, unsigned modifiers, bool is_playing, bool has_user_agent_controls, bool is_looping)
|
||||
{
|
||||
m_client.async_did_request_video_context_menu({ content_position.x().value(), content_position.y().value() }, url, target, modifiers, is_playing, has_user_agent_controls, is_looping);
|
||||
m_client.async_did_request_video_context_menu({ content_position.x().to_int(), content_position.y().to_int() }, url, target, modifiers, is_playing, has_user_agent_controls, is_looping);
|
||||
}
|
||||
|
||||
Vector<Web::Cookie::Cookie> PageHost::page_did_request_all_cookies(URL const& url)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue