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

LibWeb: Add .shrink() to BorderRadiusData and BorderRadiiData

This commit is contained in:
MacDue 2022-07-02 22:52:47 +01:00 committed by Andreas Kling
parent 44057c9482
commit 0070c28714

View file

@ -28,6 +28,12 @@ struct BorderRadiusData {
{ {
return static_cast<int>(horizontal_radius) > 0 && static_cast<int>(vertical_radius) > 0; return static_cast<int>(horizontal_radius) > 0 && static_cast<int>(vertical_radius) > 0;
} }
inline void shrink(float horizontal, float vertical)
{
horizontal_radius = max(0, horizontal_radius - horizontal);
vertical_radius = max(0, vertical_radius - vertical);
}
}; };
struct BorderRadiiData { struct BorderRadiiData {
@ -40,6 +46,14 @@ struct BorderRadiiData {
{ {
return top_left || top_right || bottom_right || bottom_left; return top_left || top_right || bottom_right || bottom_left;
} }
inline void shrink(float top, float right, float bottom, float left)
{
top_left.shrink(left, top);
top_right.shrink(right, top);
bottom_right.shrink(right, bottom);
bottom_left.shrink(left, bottom);
}
}; };
BorderRadiiData normalized_border_radii_data(Layout::Node const&, Gfx::FloatRect const&, CSS::BorderRadiusData top_left_radius, CSS::BorderRadiusData top_right_radius, CSS::BorderRadiusData bottom_right_radius, CSS::BorderRadiusData bottom_left_radius); BorderRadiiData normalized_border_radii_data(Layout::Node const&, Gfx::FloatRect const&, CSS::BorderRadiusData top_left_radius, CSS::BorderRadiusData top_right_radius, CSS::BorderRadiusData bottom_right_radius, CSS::BorderRadiusData bottom_left_radius);