mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:37:42 +00:00
LibWeb: Resolve border radius during layout and save it in paintables
This change fixes a problem that we should not call `to_px()` to resolve any length or percentage values during paintables traversal because that is supposed to happen while performing layout. Also it improves performance because before we were resolving border radii during each painting phase but now it happens only once during layout.
This commit is contained in:
parent
da134f6867
commit
d1d6da6ab6
8 changed files with 139 additions and 75 deletions
|
@ -393,15 +393,10 @@ void PaintableBox::paint_box_shadow(PaintContext& context) const
|
|||
|
||||
BorderRadiiData PaintableBox::normalized_border_radii_data(ShrinkRadiiForBorders shrink) const
|
||||
{
|
||||
auto border_radius_data = Painting::normalized_border_radii_data(layout_box(),
|
||||
absolute_border_box_rect(),
|
||||
computed_values().border_top_left_radius(),
|
||||
computed_values().border_top_right_radius(),
|
||||
computed_values().border_bottom_right_radius(),
|
||||
computed_values().border_bottom_left_radius());
|
||||
auto border_radii_data = this->border_radii_data();
|
||||
if (shrink == ShrinkRadiiForBorders::Yes)
|
||||
border_radius_data.shrink(computed_values().border_top().width, computed_values().border_right().width, computed_values().border_bottom().width, computed_values().border_left().width);
|
||||
return border_radius_data;
|
||||
border_radii_data.shrink(computed_values().border_top().width, computed_values().border_right().width, computed_values().border_bottom().width, computed_values().border_left().width);
|
||||
return border_radii_data;
|
||||
}
|
||||
|
||||
Optional<CSSPixelRect> PaintableBox::calculate_overflow_clipped_rect() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue