1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:37:36 +00:00

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.
This commit is contained in:
MacDue 2023-05-02 22:52:04 +01:00 committed by Andreas Kling
parent 9ecc5413de
commit eda429111e

View file

@ -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: