diff options
author | MacDue <macdue@dueutil.tech> | 2023-05-02 22:52:04 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-05-04 16:50:01 +0200 |
commit | eda429111ec04004bbc78651c404126c9d841758 (patch) | |
tree | ac72756e102007f4c50eaf898c6e7b142862bda2 /Userland/Libraries/LibWeb/SVG | |
parent | 9ecc5413dea15071f9ccca332ef7335dcc8eaaf3 (diff) | |
download | serenity-eda429111ec04004bbc78651c404126c9d841758.zip |
LibWeb: Don't inherit SVG color stops if current gradient has stops
The previous behaviour was incorrect, the template's stops should only
be used if the current gradient does not have any stops.
Diffstat (limited to 'Userland/Libraries/LibWeb/SVG')
-rw-r--r-- | Userland/Libraries/LibWeb/SVG/SVGGradientElement.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/SVG/SVGGradientElement.h b/Userland/Libraries/LibWeb/SVG/SVGGradientElement.h index 380a1be774..d4e975132c 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGradientElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGGradientElement.h @@ -44,11 +44,15 @@ protected: template<VoidFunction<SVGStopElement> Callback> void for_each_color_stop(Callback const& callback) const { + bool color_stops_found = false; for_each_child_of_type<SVG::SVGStopElement>([&](auto& stop) { + color_stops_found = true; callback(stop); }); - if (auto href = xlink_href()) - href->for_each_color_stop(callback); + if (!color_stops_found) { + if (auto href = xlink_href()) + href->for_each_color_stop(callback); + } } private: |