diff --git a/Userland/Libraries/LibGfx/PaintStyle.h b/Userland/Libraries/LibGfx/PaintStyle.h index 955d4d82fc8..21265e26e42 100644 --- a/Userland/Libraries/LibGfx/PaintStyle.h +++ b/Userland/Libraries/LibGfx/PaintStyle.h @@ -161,6 +161,8 @@ public: } ReadonlySpan color_stops() const { return m_color_stops; } + void set_color_stops(Vector&& color_stops) { m_color_stops = move(color_stops); } + Optional repeat_length() const { return m_repeat_length; } private: @@ -314,6 +316,9 @@ public: m_spread_method = spread_method; } + void set_inverse_transform(AffineTransform transform) { m_inverse_transform = transform; } + void set_scale(float scale) { m_scale = scale; } + protected: Optional const& scale_adjusted_inverse_gradient_transform() const { return m_inverse_transform; } float gradient_transform_scale() const { return m_scale; } @@ -342,15 +347,15 @@ public: m_p1 = end_point; } -private: - virtual void paint(IntRect physical_bounding_box, PaintFunction paint) const override; - SVGLinearGradientPaintStyle(FloatPoint p0, FloatPoint p1) : m_p0(p0) , m_p1(p1) { } +private: + virtual void paint(IntRect physical_bounding_box, PaintFunction paint) const override; + FloatPoint m_p0; FloatPoint m_p1; }; @@ -382,9 +387,6 @@ public: m_end_radius = end_radius; } -private: - virtual void paint(IntRect physical_bounding_box, PaintFunction paint) const override; - SVGRadialGradientPaintStyle(FloatPoint start_center, float start_radius, FloatPoint end_center, float end_radius) : m_start_center(start_center) , m_start_radius(start_radius) @@ -393,6 +395,9 @@ private: { } +private: + virtual void paint(IntRect physical_bounding_box, PaintFunction paint) const override; + FloatPoint m_start_center; float m_start_radius { 0.0f }; FloatPoint m_end_center; diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 351fe75ad72..a72ef85f302 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -553,6 +553,7 @@ set(SOURCES Painting/MediaPaintable.cpp Painting/NestedBrowsingContextPaintable.cpp Painting/PaintContext.cpp + Painting/PaintStyle.cpp Painting/Paintable.cpp Painting/PaintableBox.cpp Painting/PaintableFragment.cpp diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h index 00e30ccd6db..b17c9ba688c 100644 --- a/Userland/Libraries/LibWeb/Forward.h +++ b/Userland/Libraries/LibWeb/Forward.h @@ -7,6 +7,7 @@ #pragma once +#include #include namespace Web { @@ -24,6 +25,8 @@ class XMLDocumentBuilder; namespace Web::Painting { class RecordingPainter; +class SVGGradientPaintStyle; +using PaintStyle = RefPtr; } namespace Web::Animations { diff --git a/Userland/Libraries/LibWeb/Painting/Command.h b/Userland/Libraries/LibWeb/Painting/Command.h index ac0fc5220c8..dede121f8db 100644 --- a/Userland/Libraries/LibWeb/Painting/Command.h +++ b/Userland/Libraries/LibWeb/Painting/Command.h @@ -33,6 +33,7 @@ #include #include #include +#include namespace Web::Painting { @@ -198,7 +199,7 @@ struct FillPathUsingColor { struct FillPathUsingPaintStyle { Gfx::IntRect path_bounding_rect; Gfx::Path path; - NonnullRefPtr paint_style; + PaintStyle paint_style; Gfx::WindingRule winding_rule; float opacity; Gfx::FloatPoint aa_translation; @@ -231,7 +232,7 @@ struct StrokePathUsingColor { struct StrokePathUsingPaintStyle { Gfx::IntRect path_bounding_rect; Gfx::Path path; - NonnullRefPtr paint_style; + PaintStyle paint_style; float thickness; float opacity = 1.0f; Gfx::FloatPoint aa_translation; diff --git a/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.cpp b/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.cpp index 0ce7209cfc9..8f428d557fe 100644 --- a/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.cpp +++ b/Userland/Libraries/LibWeb/Painting/CommandExecutorCPU.cpp @@ -333,8 +333,9 @@ CommandResult CommandExecutorCPU::fill_path_using_color(FillPathUsingColor const CommandResult CommandExecutorCPU::fill_path_using_paint_style(FillPathUsingPaintStyle const& command) { Gfx::AntiAliasingPainter aa_painter(painter()); + auto gfx_paint_style = command.paint_style->create_gfx_paint_style(); aa_painter.translate(command.aa_translation); - aa_painter.fill_path(command.path, command.paint_style, command.opacity, command.winding_rule); + aa_painter.fill_path(command.path, gfx_paint_style, command.opacity, command.winding_rule); return CommandResult::Continue; } @@ -349,8 +350,9 @@ CommandResult CommandExecutorCPU::stroke_path_using_color(StrokePathUsingColor c CommandResult CommandExecutorCPU::stroke_path_using_paint_style(StrokePathUsingPaintStyle const& command) { Gfx::AntiAliasingPainter aa_painter(painter()); + auto gfx_paint_style = command.paint_style->create_gfx_paint_style(); aa_painter.translate(command.aa_translation); - aa_painter.stroke_path(command.path, command.paint_style, command.thickness, command.opacity); + aa_painter.stroke_path(command.path, gfx_paint_style, command.thickness, command.opacity); return CommandResult::Continue; } diff --git a/Userland/Libraries/LibWeb/Painting/PaintStyle.cpp b/Userland/Libraries/LibWeb/Painting/PaintStyle.cpp new file mode 100644 index 00000000000..19bc02f1a96 --- /dev/null +++ b/Userland/Libraries/LibWeb/Painting/PaintStyle.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2024, Aliaksandr Kalenik + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include + +namespace Web::Painting { + +void SVGGradientPaintStyle::set_gradient_transform(Gfx::AffineTransform transform) +{ + // Note: The scaling is removed so enough points on the gradient line are generated. + // Otherwise, if you scale a tiny path the gradient looks pixelated. + m_scale = 1.0f; + if (auto inverse = transform.inverse(); inverse.has_value()) { + auto transform_scale = transform.scale(); + m_scale = max(transform_scale.x(), transform_scale.y()); + m_inverse_transform = Gfx::AffineTransform {}.scale(m_scale, m_scale).multiply(*inverse); + } else { + m_inverse_transform = OptionalNone {}; + } +} + +NonnullRefPtr SVGLinearGradientPaintStyle::create_gfx_paint_style() const +{ + auto gfx_paint_style = adopt_ref(*new Gfx::SVGLinearGradientPaintStyle(m_start_point, m_end_point)); + + Vector color_stops; + for (auto const& color_stop : m_color_stops) + color_stops.append({ color_stop.color, color_stop.position, color_stop.transition_hint }); + gfx_paint_style->set_color_stops(move(color_stops)); + + if (m_repeat_length.has_value()) + gfx_paint_style->set_repeat_length(*m_repeat_length); + + if (m_inverse_transform.has_value()) + gfx_paint_style->set_inverse_transform(*m_inverse_transform); + + gfx_paint_style->set_scale(m_scale); + + auto spread_method = static_cast(to_underlying(m_spread_method)); + gfx_paint_style->set_spread_method(spread_method); + + return gfx_paint_style; +} + +NonnullRefPtr SVGRadialGradientPaintStyle::create_gfx_paint_style() const +{ + auto gfx_paint_style = adopt_ref(*new Gfx::SVGRadialGradientPaintStyle(m_start_center, m_start_radius, m_end_center, m_end_radius)); + + Vector color_stops; + for (auto const& color_stop : m_color_stops) + color_stops.append({ color_stop.color, color_stop.position, color_stop.transition_hint }); + gfx_paint_style->set_color_stops(move(color_stops)); + + if (m_repeat_length.has_value()) + gfx_paint_style->set_repeat_length(*m_repeat_length); + + if (m_inverse_transform.has_value()) + gfx_paint_style->set_inverse_transform(*m_inverse_transform); + + gfx_paint_style->set_scale(m_scale); + + auto spread_method = static_cast(to_underlying(m_spread_method)); + gfx_paint_style->set_spread_method(spread_method); + + return gfx_paint_style; +} + +} diff --git a/Userland/Libraries/LibWeb/Painting/PaintStyle.h b/Userland/Libraries/LibWeb/Painting/PaintStyle.h new file mode 100644 index 00000000000..dde375a9582 --- /dev/null +++ b/Userland/Libraries/LibWeb/Painting/PaintStyle.h @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2024, Aliaksandr Kalenik + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include +#include + +namespace Web::Painting { + +struct ColorStop { + Color color; + float position = AK::NaN; + Optional transition_hint = {}; +}; + +class SVGGradientPaintStyle : public RefCounted { +public: + virtual NonnullRefPtr create_gfx_paint_style() const { VERIFY_NOT_REACHED(); } + + void set_gradient_transform(Gfx::AffineTransform transform); + + enum class SpreadMethod { + Pad, + Repeat, + Reflect + }; + + void set_spread_method(SpreadMethod spread_method) { m_spread_method = spread_method; } + + Optional const& scale_adjusted_inverse_gradient_transform() const { return m_inverse_transform; } + float gradient_transform_scale() const { return m_scale; } + SpreadMethod spread_method() const { return m_spread_method; } + + void add_color_stop(float position, Color color, Optional transition_hint = {}) + { + return add_color_stop(ColorStop { color, position, transition_hint }); + } + + void add_color_stop(ColorStop stop, bool sort = true) + { + m_color_stops.append(stop); + if (sort) + quick_sort(m_color_stops, [](auto& a, auto& b) { return a.position < b.position; }); + } + + ReadonlySpan color_stops() const { return m_color_stops; } + Optional repeat_length() const { return m_repeat_length; } + + virtual ~SVGGradientPaintStyle() {}; + +protected: + Vector m_color_stops; + Optional m_repeat_length; + + Optional m_inverse_transform {}; + float m_scale { 1.0f }; + SpreadMethod m_spread_method { SpreadMethod::Pad }; +}; + +class SVGLinearGradientPaintStyle final : public SVGGradientPaintStyle { +public: + static NonnullRefPtr create(Gfx::FloatPoint start_point, Gfx::FloatPoint end_point) + { + return adopt_ref(*new SVGLinearGradientPaintStyle(start_point, end_point)); + } + + NonnullRefPtr create_gfx_paint_style() const override; + + void set_start_point(Gfx::FloatPoint start_point) { m_start_point = start_point; } + void set_end_point(Gfx::FloatPoint end_point) { m_end_point = end_point; } + +private: + SVGLinearGradientPaintStyle(Gfx::FloatPoint start_point, Gfx::FloatPoint end_point) + : m_start_point(start_point) + , m_end_point(end_point) + { + } + + Gfx::FloatPoint m_start_point; + Gfx::FloatPoint m_end_point; +}; + +class SVGRadialGradientPaintStyle final : public SVGGradientPaintStyle { +public: + static NonnullRefPtr create(Gfx::FloatPoint start_center, float start_radius, Gfx::FloatPoint end_center, float end_radius) + { + return adopt_ref(*new SVGRadialGradientPaintStyle(start_center, start_radius, end_center, end_radius)); + } + + NonnullRefPtr create_gfx_paint_style() const override; + + void set_start_center(Gfx::FloatPoint start_center) { m_start_center = start_center; } + void set_start_radius(float start_radius) { m_start_radius = start_radius; } + void set_end_center(Gfx::FloatPoint end_center) { m_end_center = end_center; } + void set_end_radius(float end_radius) { m_end_radius = end_radius; } + +private: + SVGRadialGradientPaintStyle(Gfx::FloatPoint start_center, float start_radius, Gfx::FloatPoint end_center, float end_radius) + : m_start_center(start_center) + , m_start_radius(start_radius) + , m_end_center(end_center) + , m_end_radius(end_radius) + { + } + + Gfx::FloatPoint m_start_center; + float m_start_radius { 0.0f }; + Gfx::FloatPoint m_end_center; + float m_end_radius { 0.0f }; +}; + +} diff --git a/Userland/Libraries/LibWeb/Painting/RecordingPainter.h b/Userland/Libraries/LibWeb/Painting/RecordingPainter.h index f735bf85011..ca1fc99aca7 100644 --- a/Userland/Libraries/LibWeb/Painting/RecordingPainter.h +++ b/Userland/Libraries/LibWeb/Painting/RecordingPainter.h @@ -35,6 +35,7 @@ #include #include #include +#include namespace Web::Painting { @@ -55,7 +56,7 @@ public: struct FillPathUsingPaintStyleParams { Gfx::Path path; - NonnullRefPtr paint_style; + PaintStyle paint_style; Gfx::WindingRule winding_rule = Gfx::WindingRule::EvenOdd; float opacity; Optional translation = {}; @@ -72,7 +73,7 @@ public: struct StrokePathUsingPaintStyleParams { Gfx::Path path; - NonnullRefPtr paint_style; + PaintStyle paint_style; float thickness; float opacity; Optional translation = {}; diff --git a/Userland/Libraries/LibWeb/SVG/SVGGradientElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGGradientElement.cpp index 65baf83d723..612cd9c7c9d 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGradientElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGGradientElement.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -93,7 +94,7 @@ Gfx::AffineTransform SVGGradientElement::gradient_paint_transform(SVGPaintContex return Gfx::AffineTransform { paint_context.transform }.multiply(transform); } -void SVGGradientElement::add_color_stops(Gfx::SVGGradientPaintStyle& paint_style) const +void SVGGradientElement::add_color_stops(Painting::SVGGradientPaintStyle& paint_style) const { for_each_color_stop([&](auto& stop) { // https://svgwg.org/svg2-draft/pservers.html#StopNotes @@ -104,7 +105,7 @@ void SVGGradientElement::add_color_stops(Gfx::SVGGradientPaintStyle& paint_style // stop's offset value. If a given gradient stop's offset value is not equal to or greater than all // previous offset values, then the offset value is adjusted to be equal to the largest of all previous // offset values. - paint_style.add_color_stop(stop_offset, stop.stop_color().with_opacity(stop.stop_opacity())).release_value_but_fixme_should_propagate_errors(); + paint_style.add_color_stop(stop_offset, stop.stop_color().with_opacity(stop.stop_opacity())); }); } diff --git a/Userland/Libraries/LibWeb/SVG/SVGGradientElement.h b/Userland/Libraries/LibWeb/SVG/SVGGradientElement.h index f03e38cd597..f2beddcf8ce 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGradientElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGGradientElement.h @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -20,15 +21,15 @@ struct SVGPaintContext { Gfx::AffineTransform transform; }; -inline Gfx::SVGGradientPaintStyle::SpreadMethod to_gfx_spread_method(SpreadMethod spread_method) +inline Painting::SVGGradientPaintStyle::SpreadMethod to_painting_spread_method(SpreadMethod spread_method) { switch (spread_method) { case SpreadMethod::Pad: - return Gfx::SVGGradientPaintStyle::SpreadMethod::Pad; + return Painting::SVGGradientPaintStyle::SpreadMethod::Pad; case SpreadMethod::Reflect: - return Gfx::SVGGradientPaintStyle::SpreadMethod::Reflect; + return Painting::SVGGradientPaintStyle::SpreadMethod::Reflect; case SpreadMethod::Repeat: - return Gfx::SVGGradientPaintStyle::SpreadMethod::Repeat; + return Painting::SVGGradientPaintStyle::SpreadMethod::Repeat; default: VERIFY_NOT_REACHED(); } @@ -42,7 +43,7 @@ public: virtual void attribute_changed(FlyString const& name, Optional const& value) override; - virtual Optional to_gfx_paint_style(SVGPaintContext const&) const = 0; + virtual Optional to_gfx_paint_style(SVGPaintContext const&) const = 0; GradientUnits gradient_units() const; @@ -66,7 +67,7 @@ protected: return for_each_color_stop_impl(callback, seen_gradients); } - void add_color_stops(Gfx::SVGGradientPaintStyle&) const; + void add_color_stops(Painting::SVGGradientPaintStyle&) const; private: template Callback> diff --git a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp index af86377b49f..110d085dcc8 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -48,7 +49,7 @@ void SVGGraphicsElement::attribute_changed(FlyString const& name, Optional SVGGraphicsElement::svg_paint_computed_value_to_gfx_paint_style(SVGPaintContext const& paint_context, Optional const& paint_value) const +Optional SVGGraphicsElement::svg_paint_computed_value_to_gfx_paint_style(SVGPaintContext const& paint_context, Optional const& paint_value) const { // FIXME: This entire function is an ad-hoc hack: if (!paint_value.has_value() || !paint_value->is_url()) @@ -58,14 +59,14 @@ Optional SVGGraphicsElement::svg_paint_computed_value_to return {}; } -Optional SVGGraphicsElement::fill_paint_style(SVGPaintContext const& paint_context) const +Optional SVGGraphicsElement::fill_paint_style(SVGPaintContext const& paint_context) const { if (!layout_node()) return {}; return svg_paint_computed_value_to_gfx_paint_style(paint_context, layout_node()->computed_values().fill()); } -Optional SVGGraphicsElement::stroke_paint_style(SVGPaintContext const& paint_context) const +Optional SVGGraphicsElement::stroke_paint_style(SVGPaintContext const& paint_context) const { if (!layout_node()) return {}; diff --git a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h index 9448abd26a4..95fb35eb511 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h @@ -51,8 +51,8 @@ public: Gfx::AffineTransform get_transform() const; - Optional fill_paint_style(SVGPaintContext const&) const; - Optional stroke_paint_style(SVGPaintContext const&) const; + Optional fill_paint_style(SVGPaintContext const&) const; + Optional stroke_paint_style(SVGPaintContext const&) const; JS::GCPtr mask() const; JS::GCPtr clip_path() const; @@ -70,7 +70,7 @@ protected: return m_transform; } - Optional svg_paint_computed_value_to_gfx_paint_style(SVGPaintContext const& paint_context, Optional const& paint_value) const; + Optional svg_paint_computed_value_to_gfx_paint_style(SVGPaintContext const& paint_context, Optional const& paint_value) const; Gfx::AffineTransform m_transform = {}; diff --git a/Userland/Libraries/LibWeb/SVG/SVGLinearGradientElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGLinearGradientElement.cpp index edafe1b3ed1..4ee3deae913 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLinearGradientElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGLinearGradientElement.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -34,16 +35,12 @@ void SVGLinearGradientElement::attribute_changed(FlyString const& name, Optional // FIXME: Should allow for ` | ` for x1, x2, y1, y2 if (name == SVG::AttributeNames::x1) { m_x1 = AttributeParser::parse_number_percentage(value.value_or(String {})); - m_paint_style = nullptr; } else if (name == SVG::AttributeNames::y1) { m_y1 = AttributeParser::parse_number_percentage(value.value_or(String {})); - m_paint_style = nullptr; } else if (name == SVG::AttributeNames::x2) { m_x2 = AttributeParser::parse_number_percentage(value.value_or(String {})); - m_paint_style = nullptr; } else if (name == SVG::AttributeNames::y2) { m_y2 = AttributeParser::parse_number_percentage(value.value_or(String {})); - m_paint_style = nullptr; } } @@ -115,7 +112,7 @@ NumberPercentage SVGLinearGradientElement::end_y_impl(HashTable SVGLinearGradientElement::to_gfx_paint_style(SVGPaintContext const& paint_context) const +Optional SVGLinearGradientElement::to_gfx_paint_style(SVGPaintContext const& paint_context) const { auto units = gradient_units(); // FIXME: Resolve percentages properly @@ -148,8 +145,7 @@ Optional SVGLinearGradientElement::to_gfx_paint_style(SV } if (!m_paint_style) { - m_paint_style = Gfx::SVGLinearGradientPaintStyle::create(start_point, end_point) - .release_value_but_fixme_should_propagate_errors(); + m_paint_style = Painting::SVGLinearGradientPaintStyle::create(start_point, end_point); // FIXME: Update stops in DOM changes: add_color_stops(*m_paint_style); } else { @@ -158,7 +154,7 @@ Optional SVGLinearGradientElement::to_gfx_paint_style(SV } m_paint_style->set_gradient_transform(gradient_paint_transform(paint_context)); - m_paint_style->set_spread_method(to_gfx_spread_method(spread_method())); + m_paint_style->set_spread_method(to_painting_spread_method(spread_method())); return *m_paint_style; } diff --git a/Userland/Libraries/LibWeb/SVG/SVGLinearGradientElement.h b/Userland/Libraries/LibWeb/SVG/SVGLinearGradientElement.h index 4b60c4e50f2..fb31ff54751 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLinearGradientElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGLinearGradientElement.h @@ -21,7 +21,7 @@ public: virtual void attribute_changed(FlyString const& name, Optional const& value) override; - virtual Optional to_gfx_paint_style(SVGPaintContext const&) const override; + virtual Optional to_gfx_paint_style(SVGPaintContext const&) const override; JS::NonnullGCPtr x1() const; JS::NonnullGCPtr y1() const; @@ -56,7 +56,7 @@ private: Optional m_x2; Optional m_y2; - mutable RefPtr m_paint_style; + mutable RefPtr m_paint_style; }; } diff --git a/Userland/Libraries/LibWeb/SVG/SVGRadialGradientElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGRadialGradientElement.cpp index 518c6bc0586..28b2209c134 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGRadialGradientElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGRadialGradientElement.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -160,7 +161,7 @@ NumberPercentage SVGRadialGradientElement::end_circle_radius_impl(HashTable SVGRadialGradientElement::to_gfx_paint_style(SVGPaintContext const& paint_context) const +Optional SVGRadialGradientElement::to_gfx_paint_style(SVGPaintContext const& paint_context) const { auto units = gradient_units(); Gfx::FloatPoint start_center; @@ -200,8 +201,7 @@ Optional SVGRadialGradientElement::to_gfx_paint_style(SV } if (!m_paint_style) { - m_paint_style = Gfx::SVGRadialGradientPaintStyle::create(start_center, start_radius, end_center, end_radius) - .release_value_but_fixme_should_propagate_errors(); + m_paint_style = Painting::SVGRadialGradientPaintStyle::create(start_center, start_radius, end_center, end_radius); // FIXME: Update stops in DOM changes: add_color_stops(*m_paint_style); } else { @@ -211,7 +211,7 @@ Optional SVGRadialGradientElement::to_gfx_paint_style(SV m_paint_style->set_end_radius(end_radius); } m_paint_style->set_gradient_transform(gradient_paint_transform(paint_context)); - m_paint_style->set_spread_method(to_gfx_spread_method(spread_method())); + m_paint_style->set_spread_method(to_painting_spread_method(spread_method())); return *m_paint_style; } diff --git a/Userland/Libraries/LibWeb/SVG/SVGRadialGradientElement.h b/Userland/Libraries/LibWeb/SVG/SVGRadialGradientElement.h index 8fa5c62f14e..c0d43a5b4e1 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGRadialGradientElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGRadialGradientElement.h @@ -21,7 +21,7 @@ public: virtual void attribute_changed(FlyString const& name, Optional const& value) override; - virtual Optional to_gfx_paint_style(SVGPaintContext const&) const override; + virtual Optional to_gfx_paint_style(SVGPaintContext const&) const override; JS::NonnullGCPtr cx() const; JS::NonnullGCPtr cy() const; @@ -64,7 +64,7 @@ private: Optional m_fr; Optional m_r; - mutable RefPtr m_paint_style; + mutable RefPtr m_paint_style; }; }