From 958c79da64a10bab58f2a0a361b599b39acaf1e8 Mon Sep 17 00:00:00 2001 From: Bastiaan van der Plaat Date: Mon, 31 Jul 2023 14:15:22 +0200 Subject: [PATCH] LibWeb: Don't clear clip rect history but restore previous state --- Userland/Libraries/LibWeb/Painting/ButtonPaintable.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Painting/ButtonPaintable.cpp b/Userland/Libraries/LibWeb/Painting/ButtonPaintable.cpp index 9395f55b30..108783fada 100644 --- a/Userland/Libraries/LibWeb/Painting/ButtonPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/ButtonPaintable.cpp @@ -60,6 +60,7 @@ void ButtonPaintable::paint(PaintContext& context, PaintPhase phase) const // Paint button text clipped to button rect auto& painter = context.painter(); + painter.save(); painter.add_clip_rect(button_rect.to_type()); painter.draw_text( text_rect.to_type(), @@ -67,7 +68,7 @@ void ButtonPaintable::paint(PaintContext& context, PaintPhase phase) const FontCache::the().scaled_font(layout_box().font(), context.device_pixels_per_css_pixel()), Gfx::TextAlignment::Center, computed_values().color()); - painter.clear_clip_rect(); + painter.restore(); } }