1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:37:35 +00:00

LibWeb: Port Path2D interface from DeprecatedString to String

This commit is contained in:
Shannon Booth 2023-08-27 18:55:01 +12:00 committed by Andrew Kaster
parent e8d592ded2
commit 826374d04b
3 changed files with 6 additions and 6 deletions

View file

@ -14,13 +14,13 @@
namespace Web::HTML {
WebIDL::ExceptionOr<JS::NonnullGCPtr<Path2D>> Path2D::construct_impl(JS::Realm& realm, Optional<Variant<JS::Handle<Path2D>, DeprecatedString>> const& path)
WebIDL::ExceptionOr<JS::NonnullGCPtr<Path2D>> Path2D::construct_impl(JS::Realm& realm, Optional<Variant<JS::Handle<Path2D>, String>> const& path)
{
return realm.heap().allocate<Path2D>(realm, realm, path);
}
// https://html.spec.whatwg.org/multipage/canvas.html#dom-path2d
Path2D::Path2D(JS::Realm& realm, Optional<Variant<JS::Handle<Path2D>, DeprecatedString>> const& path)
Path2D::Path2D(JS::Realm& realm, Optional<Variant<JS::Handle<Path2D>, String>> const& path)
: PlatformObject(realm)
, CanvasPath(static_cast<Bindings::PlatformObject&>(*this))
{
@ -37,7 +37,7 @@ Path2D::Path2D(JS::Realm& realm, Optional<Variant<JS::Handle<Path2D>, Deprecated
}
// 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<DeprecatedString>());
auto path_instructions = SVG::AttributeParser::parse_path_data(path->get<String>());
auto svg_path = SVG::path_from_path_instructions(path_instructions);
if (!svg_path.segments().is_empty()) {

View file

@ -22,14 +22,14 @@ class Path2D final
WEB_PLATFORM_OBJECT(Path2D, Bindings::PlatformObject);
public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Path2D>> construct_impl(JS::Realm&, Optional<Variant<JS::Handle<Path2D>, DeprecatedString>> const& path);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<Path2D>> construct_impl(JS::Realm&, Optional<Variant<JS::Handle<Path2D>, String>> const& path);
virtual ~Path2D() override;
WebIDL::ExceptionOr<void> add_path(JS::NonnullGCPtr<Path2D> path, Geometry::DOMMatrix2DInit& transform);
private:
Path2D(JS::Realm&, Optional<Variant<JS::Handle<Path2D>, DeprecatedString>> const&);
Path2D(JS::Realm&, Optional<Variant<JS::Handle<Path2D>, String>> const&);
virtual void initialize(JS::Realm&) override;
};

View file

@ -2,7 +2,7 @@
#import <HTML/Canvas/CanvasPath.idl>
// https://html.spec.whatwg.org/multipage/canvas.html#path2d
[Exposed=(Window,Worker)]
[Exposed=(Window,Worker), UseNewAKString]
interface Path2D {
constructor(optional (Path2D or DOMString) path);