From bc8a97589f428393e0a32d433a148bf678f48e8e Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 4 Jun 2025 14:31:08 +0100 Subject: [PATCH] LibWeb/SVG: Add stop-color and stop-opacity to AttributeNames --- Libraries/LibWeb/SVG/AttributeNames.h | 2 ++ Libraries/LibWeb/SVG/SVGStopElement.cpp | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Libraries/LibWeb/SVG/AttributeNames.h b/Libraries/LibWeb/SVG/AttributeNames.h index 0ca66ad76b5..8a0549c628d 100644 --- a/Libraries/LibWeb/SVG/AttributeNames.h +++ b/Libraries/LibWeb/SVG/AttributeNames.h @@ -76,6 +76,8 @@ namespace Web::SVG::AttributeNames { __ENUMERATE_SVG_ATTRIBUTE(startOffset, "startOffset") \ __ENUMERATE_SVG_ATTRIBUTE(stdDeviation, "stdDeviation") \ __ENUMERATE_SVG_ATTRIBUTE(stitchTiles, "stitchTiles") \ + __ENUMERATE_SVG_ATTRIBUTE(stopColor, "stop-color") \ + __ENUMERATE_SVG_ATTRIBUTE(stopOpacity, "stop-opacity") \ __ENUMERATE_SVG_ATTRIBUTE(surfaceScale, "surfaceScale") \ __ENUMERATE_SVG_ATTRIBUTE(systemLanguage, "systemLanguage") \ __ENUMERATE_SVG_ATTRIBUTE(tableValues, "tableValues") \ diff --git a/Libraries/LibWeb/SVG/SVGStopElement.cpp b/Libraries/LibWeb/SVG/SVGStopElement.cpp index 7d2d4a9dece..436ddac3639 100644 --- a/Libraries/LibWeb/SVG/SVGStopElement.cpp +++ b/Libraries/LibWeb/SVG/SVGStopElement.cpp @@ -35,9 +35,7 @@ bool SVGStopElement::is_presentational_hint(FlyString const& name) const if (Base::is_presentational_hint(name)) return true; - return first_is_one_of(name, - "stop-color"sv, - "stop-opacity"sv); + return first_is_one_of(name, SVG::AttributeNames::stopColor, SVG::AttributeNames::stopOpacity); } void SVGStopElement::apply_presentational_hints(GC::Ref cascaded_properties) const @@ -45,11 +43,11 @@ void SVGStopElement::apply_presentational_hints(GC::Ref CSS::Parser::ParsingParams parsing_context { document() }; for_each_attribute([&](auto& name, auto& value) { CSS::Parser::ParsingParams parsing_context { document() }; - if (name.equals_ignoring_ascii_case("stop-color"sv)) { + if (name == SVG::AttributeNames::stopColor) { if (auto stop_color = parse_css_value(parsing_context, value, CSS::PropertyID::StopColor)) { cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::StopColor, stop_color.release_nonnull()); } - } else if (name.equals_ignoring_ascii_case("stop-opacity"sv)) { + } else if (name == SVG::AttributeNames::stopOpacity) { if (auto stop_opacity = parse_css_value(parsing_context, value, CSS::PropertyID::StopOpacity)) { cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::StopOpacity, stop_opacity.release_nonnull()); }