mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:57:45 +00:00
LibWeb: When growing or shrinking a border-radius, ignore it if it's 0
This function is used to calculate a matching radius that goes inside or outside of the border. For example, if the border-radius is 10px and we are 5px further out, the radius needs to be 15px to look right. However, if the radius is 0 it isn't rounded, and we want to keep the same sharp corner no matter how far we go. This makes our outline rendering better match Chrome and Firefox.
This commit is contained in:
parent
d1aea87889
commit
29b2022303
1 changed files with 4 additions and 2 deletions
|
@ -33,7 +33,9 @@ struct BorderRadiusData {
|
||||||
|
|
||||||
inline void shrink(CSSPixels horizontal, CSSPixels vertical)
|
inline void shrink(CSSPixels horizontal, CSSPixels vertical)
|
||||||
{
|
{
|
||||||
|
if (horizontal_radius != 0)
|
||||||
horizontal_radius = max(CSSPixels(0), horizontal_radius - horizontal);
|
horizontal_radius = max(CSSPixels(0), horizontal_radius - horizontal);
|
||||||
|
if (vertical_radius != 0)
|
||||||
vertical_radius = max(CSSPixels(0), vertical_radius - vertical);
|
vertical_radius = max(CSSPixels(0), vertical_radius - vertical);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue