Commit graph

5 commits

Author SHA1 Message Date
Callum Law
b33b9a6747 LibWeb: Parse SVG coordinate pair as Gfx::FloatPoint
We ended up converting this to a `Gfx::FloatPoint` in all but one place
any way so this just skips some extra handling and `Vector` allocations.

Also makes `parse_coordinate_pair_{double|triplet}` return `Vectors`
store data inline to avoid a heap alloc.
2026-06-08 12:39:39 +01:00
Callum Law
1026991820 LibWeb: Specialize SVG::PathInstruction structs
Previously we had a single `PathInstruction` struct which stored it's
data in a `Vector<float>`. We now define `PathInstruction` as a
`Variant<>` of structs storing data inline (note that the remaining
`Vector` properties will be replaced with `Gfx::FloatPoint` in a future
commit) - this avoids a `Vector` allocation and avoids magic indices
when accessing data.
2026-06-08 12:39:39 +01:00
Callum Law
8ab9eaf44e LibWeb: Simplify SVG::PathInstruction dumping
This updates dumping to reflect the fact that each instruction only ever
contains a single set of arguments, and that `ClosePath` does not have a
concept of absoluteness (i.e. 'Z' and 'z' are equivalent).
2026-06-08 12:39:39 +01:00
Sam Atkins
8538186ca5 LibWeb/SVG: Add serialization of Paths
CSS users (like the `path()` function) need to be able to serialize
their path data in a canonical form.
2025-07-17 13:59:23 -04:00
Sam Atkins
6b53454b68 LibWeb/SVG: Move path data into Path.{h,cpp}
More things need this than just the `<path>` element, so let's avoid
having to include `SVGPathElement.h` in places that don't need it.

Minor changes at the same time:
- Wrap it in a Path class
- Specify underlying type for PathInstructionType
- Make a couple of free functions into methods
- Give PathInstruction an operator==

No functionality changes.
2025-07-17 13:59:23 -04:00