LibWeb/SVG: Add stop-color and stop-opacity to AttributeNames

This commit is contained in:
Sam Atkins 2025-06-04 14:31:08 +01:00
commit bc8a97589f
Notes: github-actions[bot] 2025-06-05 11:11:27 +00:00
2 changed files with 5 additions and 5 deletions

View file

@ -76,6 +76,8 @@ namespace Web::SVG::AttributeNames {
__ENUMERATE_SVG_ATTRIBUTE(startOffset, "startOffset") \ __ENUMERATE_SVG_ATTRIBUTE(startOffset, "startOffset") \
__ENUMERATE_SVG_ATTRIBUTE(stdDeviation, "stdDeviation") \ __ENUMERATE_SVG_ATTRIBUTE(stdDeviation, "stdDeviation") \
__ENUMERATE_SVG_ATTRIBUTE(stitchTiles, "stitchTiles") \ __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(surfaceScale, "surfaceScale") \
__ENUMERATE_SVG_ATTRIBUTE(systemLanguage, "systemLanguage") \ __ENUMERATE_SVG_ATTRIBUTE(systemLanguage, "systemLanguage") \
__ENUMERATE_SVG_ATTRIBUTE(tableValues, "tableValues") \ __ENUMERATE_SVG_ATTRIBUTE(tableValues, "tableValues") \

View file

@ -35,9 +35,7 @@ bool SVGStopElement::is_presentational_hint(FlyString const& name) const
if (Base::is_presentational_hint(name)) if (Base::is_presentational_hint(name))
return true; return true;
return first_is_one_of(name, return first_is_one_of(name, SVG::AttributeNames::stopColor, SVG::AttributeNames::stopOpacity);
"stop-color"sv,
"stop-opacity"sv);
} }
void SVGStopElement::apply_presentational_hints(GC::Ref<CSS::CascadedProperties> cascaded_properties) const void SVGStopElement::apply_presentational_hints(GC::Ref<CSS::CascadedProperties> cascaded_properties) const
@ -45,11 +43,11 @@ void SVGStopElement::apply_presentational_hints(GC::Ref<CSS::CascadedProperties>
CSS::Parser::ParsingParams parsing_context { document() }; CSS::Parser::ParsingParams parsing_context { document() };
for_each_attribute([&](auto& name, auto& value) { for_each_attribute([&](auto& name, auto& value) {
CSS::Parser::ParsingParams parsing_context { document() }; 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)) { 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()); 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)) { 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()); cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::StopOpacity, stop_opacity.release_nonnull());
} }