From 94695311002462c9db8ef15054250e4dae913b15 Mon Sep 17 00:00:00 2001 From: Bastiaan van der Plaat Date: Mon, 31 Jul 2023 14:14:40 +0200 Subject: [PATCH] LibWeb: Convert text_indent css pixels to device pixels --- Userland/Libraries/LibWeb/Painting/ButtonPaintable.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Painting/ButtonPaintable.cpp b/Userland/Libraries/LibWeb/Painting/ButtonPaintable.cpp index 1653fbe7e4..9395f55b30 100644 --- a/Userland/Libraries/LibWeb/Painting/ButtonPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/ButtonPaintable.cpp @@ -47,8 +47,10 @@ void ButtonPaintable::paint(PaintContext& context, PaintPhase phase) const auto text_rect = button_rect; // Apply CSS text-indent property to text rect + // FIXME: The second parameter to to_px() needs to be the block container’s own inline-axis inner size: + // https://drafts.csswg.org/css-text-3/#propdef-text-indent auto text_indent = computed_values().text_indent().to_px(layout_box(), CSSPixels()); - text_rect.translate_by(text_indent.to_int(), 0); + text_rect.translate_by(context.rounded_device_pixels(text_indent), 0); // Apply button pressed state offset if (being_pressed()) {