From 437442719da3ba275273882d402b031200c58196 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Wed, 25 Oct 2023 18:06:54 +0200 Subject: [PATCH] LibWeb: Fix coordinate translation for PaintTextShadow command Fixes regression introduced in 4318bcf447ecb97b867af13dfcba1b72de107049 `shadow_bounding_rect` is used on bitmap allocated for shadow and is not supposed to be in coordinate system of stacking context. Same for `text_rect`. Fixes https://github.com/SerenityOS/serenity/issues/21587 --- Userland/Libraries/LibWeb/Painting/RecordingPainter.cpp | 7 ++----- Userland/Libraries/LibWeb/Painting/RecordingPainter.h | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibWeb/Painting/RecordingPainter.cpp b/Userland/Libraries/LibWeb/Painting/RecordingPainter.cpp index f1c3d877c0..93e487d0ea 100644 --- a/Userland/Libraries/LibWeb/Painting/RecordingPainter.cpp +++ b/Userland/Libraries/LibWeb/Painting/RecordingPainter.cpp @@ -293,9 +293,6 @@ CommandResult PaintInnerBoxShadow::execute(CommandExecutionState& state) const CommandResult PaintTextShadow::execute(CommandExecutionState& state) const { - if (state.would_be_fully_clipped_by_painter(text_rect)) - return CommandResult::Continue; - // FIXME: Figure out the maximum bitmap size for all shadows and then allocate it once and reuse it? auto maybe_shadow_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, shadow_bounding_rect.size()); if (maybe_shadow_bitmap.is_error()) { @@ -758,8 +755,8 @@ void RecordingPainter::paint_text_shadow(int blur_radius, Gfx::IntRect bounding_ { push_command(PaintTextShadow { .blur_radius = blur_radius, - .shadow_bounding_rect = state().translation.map(bounding_rect), - .text_rect = state().translation.map(text_rect), + .shadow_bounding_rect = bounding_rect, + .text_rect = text_rect, .text = String::from_utf8(text.as_string()).release_value_but_fixme_should_propagate_errors(), .font = font, .color = color, diff --git a/Userland/Libraries/LibWeb/Painting/RecordingPainter.h b/Userland/Libraries/LibWeb/Painting/RecordingPainter.h index 6996bb0815..56e12f266f 100644 --- a/Userland/Libraries/LibWeb/Painting/RecordingPainter.h +++ b/Userland/Libraries/LibWeb/Painting/RecordingPainter.h @@ -163,7 +163,7 @@ struct PaintTextShadow { int fragment_baseline; Gfx::IntPoint draw_location; - [[nodiscard]] Gfx::IntRect bounding_rect() const { return shadow_bounding_rect; } + [[nodiscard]] Gfx::IntRect bounding_rect() const { return { draw_location, shadow_bounding_rect.size() }; } [[nodiscard]] CommandResult execute(CommandExecutionState&) const; };