1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:07:36 +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:
MacDue 2023-04-21 18:51:00 +01:00 committed by Andreas Kling
parent a5fa5e55ef
commit 71938550fa
7 changed files with 175 additions and 0 deletions

View file

@ -88,6 +88,11 @@ struct PreserveAspectRatio {
MeetOrSlice meet_or_slice { MeetOrSlice::Meet };
};
enum class GradientUnits {
ObjectBoundingBox,
UserSpaceOnUse
};
class NumberPercentage {
public:
NumberPercentage(float value, bool is_percentage)
@ -127,6 +132,7 @@ public:
static Vector<PathInstruction> parse_path_data(StringView input);
static Optional<Vector<Transform>> parse_transform(StringView input);
static Optional<PreserveAspectRatio> parse_preserve_aspect_ratio(StringView input);
static Optional<GradientUnits> parse_gradient_units(StringView input);
private:
AttributeParser(StringView source);