diff --git a/Libraries/LibWeb/Painting/SVGPathPaintable.cpp b/Libraries/LibWeb/Painting/SVGPathPaintable.cpp index 40eeb529748..fe2a14ad446 100644 --- a/Libraries/LibWeb/Painting/SVGPathPaintable.cpp +++ b/Libraries/LibWeb/Painting/SVGPathPaintable.cpp @@ -106,6 +106,7 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const SVG::SVGPaintContext paint_context { .viewport = svg_viewport, .path_bounding_box = computed_path()->bounding_box(), + .paint_transform = paint_transform, }; auto fill_opacity = graphics_element.fill_opacity().value_or(1); diff --git a/Libraries/LibWeb/SVG/SVGGradientElement.cpp b/Libraries/LibWeb/SVG/SVGGradientElement.cpp index e65766a86da..e090a3feae4 100644 --- a/Libraries/LibWeb/SVG/SVGGradientElement.cpp +++ b/Libraries/LibWeb/SVG/SVGGradientElement.cpp @@ -84,7 +84,7 @@ Optional SVGGradientElement::gradient_transform_impl(HashT // The gradient transform, appropriately scaled and combined with the paint transform. Gfx::AffineTransform SVGGradientElement::gradient_paint_transform(SVGPaintContext const& paint_context) const { - Gfx::AffineTransform gradient_paint_transform; + Gfx::AffineTransform gradient_paint_transform = paint_context.paint_transform; auto const& bounding_box = paint_context.path_bounding_box; if (gradient_units() == SVGUnits::ObjectBoundingBox) { diff --git a/Libraries/LibWeb/SVG/SVGGradientElement.h b/Libraries/LibWeb/SVG/SVGGradientElement.h index bfd860ee2bd..81d6f9f5b01 100644 --- a/Libraries/LibWeb/SVG/SVGGradientElement.h +++ b/Libraries/LibWeb/SVG/SVGGradientElement.h @@ -19,6 +19,7 @@ namespace Web::SVG { struct SVGPaintContext { Gfx::FloatRect viewport; Gfx::FloatRect path_bounding_box; + Gfx::AffineTransform paint_transform; }; inline Painting::SVGGradientPaintStyle::SpreadMethod to_painting_spread_method(SpreadMethod spread_method) diff --git a/Tests/LibWeb/Screenshot/expected/svg-gradient-paint-transformation-ref.html b/Tests/LibWeb/Screenshot/expected/svg-gradient-paint-transformation-ref.html new file mode 100644 index 00000000000..c6408feecaf --- /dev/null +++ b/Tests/LibWeb/Screenshot/expected/svg-gradient-paint-transformation-ref.html @@ -0,0 +1,9 @@ + + diff --git a/Tests/LibWeb/Screenshot/images/svg-gradient-paint-transformation-ref.png b/Tests/LibWeb/Screenshot/images/svg-gradient-paint-transformation-ref.png new file mode 100644 index 00000000000..92cd9fa7613 Binary files /dev/null and b/Tests/LibWeb/Screenshot/images/svg-gradient-paint-transformation-ref.png differ diff --git a/Tests/LibWeb/Screenshot/images/svg-text-effects-ref.png b/Tests/LibWeb/Screenshot/images/svg-text-effects-ref.png index 1abce3203ae..2d7db64de61 100644 Binary files a/Tests/LibWeb/Screenshot/images/svg-text-effects-ref.png and b/Tests/LibWeb/Screenshot/images/svg-text-effects-ref.png differ diff --git a/Tests/LibWeb/Screenshot/input/svg-gradient-paint-transformation.html b/Tests/LibWeb/Screenshot/input/svg-gradient-paint-transformation.html new file mode 100644 index 00000000000..779fbb3f0b8 --- /dev/null +++ b/Tests/LibWeb/Screenshot/input/svg-gradient-paint-transformation.html @@ -0,0 +1,13 @@ + + + + + + + + HI +