From 2fdf2b9215db7c3cfbaabe4bf05d47998f8f6035 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 7 Oct 2024 08:09:25 +0200 Subject: [PATCH] LibWeb: Allow SVG root elements to have visible overflow We were overly aggressive in clipping SVG roots, which effectively made them behave as if they always had `overflow: hidden`. This fixes incorrect clipping of the logo on https://basecamp.com/ --- Tests/LibWeb/Ref/reference/svg-overflow-hidden-ref.html | 6 ++++++ Tests/LibWeb/Ref/reference/svg-overflow-visible-ref.html | 6 ++++++ Tests/LibWeb/Ref/svg-overflow-hidden.html | 8 ++++++++ Tests/LibWeb/Ref/svg-overflow-visible.html | 8 ++++++++ Userland/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp | 2 -- 5 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 Tests/LibWeb/Ref/reference/svg-overflow-hidden-ref.html create mode 100644 Tests/LibWeb/Ref/reference/svg-overflow-visible-ref.html create mode 100644 Tests/LibWeb/Ref/svg-overflow-hidden.html create mode 100644 Tests/LibWeb/Ref/svg-overflow-visible.html diff --git a/Tests/LibWeb/Ref/reference/svg-overflow-hidden-ref.html b/Tests/LibWeb/Ref/reference/svg-overflow-hidden-ref.html new file mode 100644 index 0000000000..af93097d4b --- /dev/null +++ b/Tests/LibWeb/Ref/reference/svg-overflow-hidden-ref.html @@ -0,0 +1,6 @@ + + diff --git a/Tests/LibWeb/Ref/reference/svg-overflow-visible-ref.html b/Tests/LibWeb/Ref/reference/svg-overflow-visible-ref.html new file mode 100644 index 0000000000..cd82def5f4 --- /dev/null +++ b/Tests/LibWeb/Ref/reference/svg-overflow-visible-ref.html @@ -0,0 +1,6 @@ + + diff --git a/Tests/LibWeb/Ref/svg-overflow-hidden.html b/Tests/LibWeb/Ref/svg-overflow-hidden.html new file mode 100644 index 0000000000..81ee6bd346 --- /dev/null +++ b/Tests/LibWeb/Ref/svg-overflow-hidden.html @@ -0,0 +1,8 @@ + + + diff --git a/Tests/LibWeb/Ref/svg-overflow-visible.html b/Tests/LibWeb/Ref/svg-overflow-visible.html new file mode 100644 index 0000000000..b57f19093e --- /dev/null +++ b/Tests/LibWeb/Ref/svg-overflow-visible.html @@ -0,0 +1,8 @@ + + + diff --git a/Userland/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp b/Userland/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp index 029e21e870..5fbdf91990 100644 --- a/Userland/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/SVGSVGPaintable.cpp @@ -32,9 +32,7 @@ void SVGSVGPaintable::before_children_paint(PaintContext& context, PaintPhase ph if (phase != PaintPhase::Foreground) return; context.display_list_recorder().save(); - auto clip_rect = absolute_rect(); context.display_list_recorder().set_scroll_frame_id(scroll_frame_id()); - context.display_list_recorder().add_clip_rect(context.enclosing_device_rect(clip_rect).to_type()); } void SVGSVGPaintable::after_children_paint(PaintContext& context, PaintPhase phase) const