mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-23 17:33:12 +00:00
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.
This commit is contained in:
parent
07b5b7ffb6
commit
6b53454b68
Notes:
github-actions[bot]
2025-07-17 18:00:44 +00:00
Author: https://github.com/AtkinsSJ
Commit: 6b53454b68
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5491
Reviewed-by: https://github.com/kalenikaliaksandr ✅
9 changed files with 322 additions and 272 deletions
|
@ -11,7 +11,7 @@
|
|||
#include <LibWeb/Geometry/DOMMatrix.h>
|
||||
#include <LibWeb/HTML/Path2D.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
#include <LibWeb/SVG/SVGPathElement.h>
|
||||
#include <LibWeb/SVG/Path.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
@ -41,7 +41,7 @@ Path2D::Path2D(JS::Realm& realm, Optional<Variant<GC::Root<Path2D>, String>> con
|
|||
|
||||
// 4. Let svgPath be the result of parsing and interpreting path according to SVG 2's rules for path data. [SVG]
|
||||
auto path_instructions = SVG::AttributeParser::parse_path_data(path->get<String>());
|
||||
auto svg_path = SVG::path_from_path_instructions(path_instructions);
|
||||
auto svg_path = path_instructions.to_gfx_path();
|
||||
|
||||
if (!svg_path.is_empty()) {
|
||||
// 5. Let (x, y) be the last point in svgPath.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue