mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +00:00
LibWeb: Port Path2D interface from DeprecatedString to String
This commit is contained in:
parent
e8d592ded2
commit
826374d04b
3 changed files with 6 additions and 6 deletions
|
@ -14,13 +14,13 @@
|
||||||
|
|
||||||
namespace Web::HTML {
|
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);
|
return realm.heap().allocate<Path2D>(realm, realm, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/canvas.html#dom-path2d
|
// 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)
|
: PlatformObject(realm)
|
||||||
, CanvasPath(static_cast<Bindings::PlatformObject&>(*this))
|
, 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]
|
// 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);
|
auto svg_path = SVG::path_from_path_instructions(path_instructions);
|
||||||
|
|
||||||
if (!svg_path.segments().is_empty()) {
|
if (!svg_path.segments().is_empty()) {
|
||||||
|
|
|
@ -22,14 +22,14 @@ class Path2D final
|
||||||
WEB_PLATFORM_OBJECT(Path2D, Bindings::PlatformObject);
|
WEB_PLATFORM_OBJECT(Path2D, Bindings::PlatformObject);
|
||||||
|
|
||||||
public:
|
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;
|
virtual ~Path2D() override;
|
||||||
|
|
||||||
WebIDL::ExceptionOr<void> add_path(JS::NonnullGCPtr<Path2D> path, Geometry::DOMMatrix2DInit& transform);
|
WebIDL::ExceptionOr<void> add_path(JS::NonnullGCPtr<Path2D> path, Geometry::DOMMatrix2DInit& transform);
|
||||||
|
|
||||||
private:
|
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;
|
virtual void initialize(JS::Realm&) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#import <HTML/Canvas/CanvasPath.idl>
|
#import <HTML/Canvas/CanvasPath.idl>
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/canvas.html#path2d
|
// https://html.spec.whatwg.org/multipage/canvas.html#path2d
|
||||||
[Exposed=(Window,Worker)]
|
[Exposed=(Window,Worker), UseNewAKString]
|
||||||
interface Path2D {
|
interface Path2D {
|
||||||
constructor(optional (Path2D or DOMString) path);
|
constructor(optional (Path2D or DOMString) path);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue