mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
LibWeb: Implement SVGGradientElement
This is the base class for all SVG gradient types. This supports: - The `gradientUnits` attribute - The `gradientTransform` attribute - And following `xlink:hrefs` for inheriting <stops>/attributes
This commit is contained in:
parent
a5fa5e55ef
commit
71938550fa
7 changed files with 175 additions and 0 deletions
|
@ -494,6 +494,19 @@ Optional<PreserveAspectRatio> AttributeParser::parse_preserve_aspect_ratio(Strin
|
|||
return PreserveAspectRatio { *align, *meet_or_slice };
|
||||
}
|
||||
|
||||
// https://svgwg.org/svg2-draft/pservers.html#LinearGradientElementGradientUnitsAttribute
|
||||
Optional<GradientUnits> AttributeParser::parse_gradient_units(StringView input)
|
||||
{
|
||||
GenericLexer lexer { input };
|
||||
lexer.ignore_while(whitespace);
|
||||
auto gradient_units_string = lexer.consume_until(whitespace);
|
||||
if (gradient_units_string == "userSpaceOnUse"sv)
|
||||
return GradientUnits::UserSpaceOnUse;
|
||||
if (gradient_units_string == "objectBoundingBox"sv)
|
||||
return GradientUnits::ObjectBoundingBox;
|
||||
return {};
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-transforms/#svg-syntax
|
||||
Optional<Vector<Transform>> AttributeParser::parse_transform()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue