LibWeb: Use padding box to get background rect for inline paintable

Fixes regression introduced by f574e2b03a
This commit is contained in:
Aliaksandr Kalenik 2024-08-06 16:17:41 +03:00 committed by Andreas Kling
commit 0fe84e89b2
Notes: github-actions[bot] 2024-08-06 14:26:28 +00:00
3 changed files with 41 additions and 0 deletions

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<link rel="match" href="reference/inline-block-with-css-background-ref.html" />
<style type="text/css">
body {
margin: 0;
}
.box {
margin-top: 8px;
width: 200px;
}
.box span {
background: rgb(138, 100, 229);
border: 3px solid orange;
font-size: 16px;
color: rgb(255, 255, 255);
padding: 5px 13px;
}
</style>
<div class="box"><span>Text</span></div>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<style type="text/css">
body {
margin: 0;
}
.box {
width: 200px;
}
.box span {
background: rgb(138, 100, 229);
border: 3px solid orange;
font-size: 16px;
color: rgb(255, 255, 255);
padding: 5px 13px;
display: block;
width: fit-content;
}
</style>
<div class="box"><span>Text</span></div>

View file

@ -278,6 +278,9 @@ void InlinePaintable::resolve_paint_properties()
bottom_left_border_radius);
fragment.set_border_radii_data(border_radii_data);
absolute_fragment_rect.translate_by(0, -box_model().padding.top);
absolute_fragment_rect.set_height(absolute_fragment_rect.height() + box_model().padding.top + box_model().padding.bottom);
auto resolved_background = resolve_background_layers(computed_values.background_layers(), layout_node, computed_values.background_color(), absolute_fragment_rect, border_radii_data);
fragment.set_resolved_background(move(resolved_background));
}