1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27:45 +00:00

LibWeb: Add support for the SVG gradient spreadMethod attribute

This commit is contained in:
MacDue 2023-08-20 15:45:02 +01:00 committed by Andreas Kling
parent 1ecb2cf28c
commit 46f42d9755
6 changed files with 52 additions and 0 deletions

View file

@ -509,6 +509,21 @@ Optional<GradientUnits> AttributeParser::parse_gradient_units(StringView input)
return {};
}
// https://svgwg.org/svg2-draft/pservers.html#RadialGradientElementSpreadMethodAttribute
Optional<SpreadMethod> AttributeParser::parse_spread_method(StringView input)
{
GenericLexer lexer { input };
lexer.ignore_while(whitespace);
auto spread_method_string = lexer.consume_until(whitespace);
if (spread_method_string == "pad"sv)
return SpreadMethod::Pad;
if (spread_method_string == "repeat"sv)
return SpreadMethod::Repeat;
if (spread_method_string == "reflect"sv)
return SpreadMethod::Reflect;
return {};
}
// https://drafts.csswg.org/css-transforms/#svg-syntax
Optional<Vector<Transform>> AttributeParser::parse_transform()
{