From 0fe84e89b24d4510eb9861db7eea490f9ce1f774 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Tue, 6 Aug 2024 16:17:41 +0300 Subject: [PATCH] LibWeb: Use padding box to get background rect for inline paintable Fixes regression introduced by f574e2b03ab3c9c55a74a86435efeab179a4caa9 --- .../Ref/inline-block-with-css-background.html | 19 +++++++++++++++++++ .../inline-block-with-css-background-ref.html | 19 +++++++++++++++++++ .../LibWeb/Painting/InlinePaintable.cpp | 3 +++ 3 files changed, 41 insertions(+) create mode 100644 Tests/LibWeb/Ref/inline-block-with-css-background.html create mode 100644 Tests/LibWeb/Ref/reference/inline-block-with-css-background-ref.html diff --git a/Tests/LibWeb/Ref/inline-block-with-css-background.html b/Tests/LibWeb/Ref/inline-block-with-css-background.html new file mode 100644 index 00000000000..005967fbac6 --- /dev/null +++ b/Tests/LibWeb/Ref/inline-block-with-css-background.html @@ -0,0 +1,19 @@ + + + +
Text
diff --git a/Tests/LibWeb/Ref/reference/inline-block-with-css-background-ref.html b/Tests/LibWeb/Ref/reference/inline-block-with-css-background-ref.html new file mode 100644 index 00000000000..a9e87657299 --- /dev/null +++ b/Tests/LibWeb/Ref/reference/inline-block-with-css-background-ref.html @@ -0,0 +1,19 @@ + + +
Text
diff --git a/Userland/Libraries/LibWeb/Painting/InlinePaintable.cpp b/Userland/Libraries/LibWeb/Painting/InlinePaintable.cpp index 85a72d88061..c1b689fefc2 100644 --- a/Userland/Libraries/LibWeb/Painting/InlinePaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/InlinePaintable.cpp @@ -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)); }