mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:57:34 +00:00
LibJS: Make Heap::allocate<T>() infallible
Stop worrying about tiny OOMs. Work towards #20449. While going through these, I also changed the function signature in many places where returning ThrowCompletionOr<T> is no longer necessary.
This commit is contained in:
parent
980e7164fe
commit
72c9f56c66
337 changed files with 1229 additions and 1251 deletions
|
@ -9,9 +9,9 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<SVGAnimatedLength>> SVGAnimatedLength::create(JS::Realm& realm, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val)
|
||||
JS::NonnullGCPtr<SVGAnimatedLength> SVGAnimatedLength::create(JS::Realm& realm, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val)
|
||||
{
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVGAnimatedLength>(realm, realm, move(base_val), move(anim_val)));
|
||||
return realm.heap().allocate<SVGAnimatedLength>(realm, realm, move(base_val), move(anim_val));
|
||||
}
|
||||
|
||||
SVGAnimatedLength::SVGAnimatedLength(JS::Realm& realm, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val)
|
||||
|
|
|
@ -16,7 +16,7 @@ class SVGAnimatedLength final : public Bindings::PlatformObject {
|
|||
WEB_PLATFORM_OBJECT(SVGAnimatedLength, Bindings::PlatformObject);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<SVGAnimatedLength>> create(JS::Realm&, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val);
|
||||
[[nodiscard]] static JS::NonnullGCPtr<SVGAnimatedLength> create(JS::Realm&, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val);
|
||||
virtual ~SVGAnimatedLength() override;
|
||||
|
||||
JS::NonnullGCPtr<SVGLength> base_val() const { return m_base_val; }
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<SVGAnimatedNumber>> SVGAnimatedNumber::create(JS::Realm& realm, float base_val, float anim_val)
|
||||
JS::NonnullGCPtr<SVGAnimatedNumber> SVGAnimatedNumber::create(JS::Realm& realm, float base_val, float anim_val)
|
||||
{
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVGAnimatedNumber>(realm, realm, base_val, anim_val));
|
||||
return realm.heap().allocate<SVGAnimatedNumber>(realm, realm, base_val, anim_val);
|
||||
}
|
||||
|
||||
SVGAnimatedNumber::SVGAnimatedNumber(JS::Realm& realm, float base_val, float anim_val)
|
||||
|
|
|
@ -16,7 +16,7 @@ class SVGAnimatedNumber final : public Bindings::PlatformObject {
|
|||
WEB_PLATFORM_OBJECT(SVGAnimatedNumber, Bindings::PlatformObject);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<SVGAnimatedNumber>> create(JS::Realm&, float base_val, float anim_val);
|
||||
[[nodiscard]] static JS::NonnullGCPtr<SVGAnimatedNumber> create(JS::Realm&, float base_val, float anim_val);
|
||||
virtual ~SVGAnimatedNumber() override;
|
||||
|
||||
float base_val() const { return m_base_val; }
|
||||
|
|
|
@ -82,9 +82,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGCircleElement::cx() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_center_x.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_center_x.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_center_x.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_center_x.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#CircleElementCYAttribute
|
||||
|
@ -92,9 +92,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGCircleElement::cy() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_center_y.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_center_y.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_center_y.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_center_y.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#CircleElementRAttribute
|
||||
|
@ -102,9 +102,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGCircleElement::r() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_radius.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_radius.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_radius.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_radius.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ void SVGElement::initialize(JS::Realm& realm)
|
|||
Base::initialize(realm);
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGElementPrototype>(realm, "SVGElement"));
|
||||
|
||||
m_dataset = MUST(HTML::DOMStringMap::create(*this));
|
||||
m_dataset = HTML::DOMStringMap::create(*this);
|
||||
}
|
||||
|
||||
void SVGElement::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -87,9 +87,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGEllipseElement::cx() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_center_x.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_center_x.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_center_x.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_center_x.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#EllipseElementCYAttribute
|
||||
|
@ -97,9 +97,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGEllipseElement::cy() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_center_y.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_center_y.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_center_y.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_center_y.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#EllipseElementRXAttribute
|
||||
|
@ -107,9 +107,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGEllipseElement::rx() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_radius_x.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_radius_x.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_radius_x.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_radius_x.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#EllipseElementRYAttribute
|
||||
|
@ -117,9 +117,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGEllipseElement::ry() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_radius_y.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_radius_y.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_radius_y.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_radius_y.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,10 +28,10 @@ void SVGForeignObjectElement::initialize(JS::Realm& realm)
|
|||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGForeignObjectElementPrototype>(realm, "SVGForeignObjectElement"));
|
||||
|
||||
// FIXME: These never actually get updated!
|
||||
m_x = MUST(SVGAnimatedLength::create(realm, MUST(SVGLength::create(realm, 0, 0)), MUST(SVGLength::create(realm, 0, 0))));
|
||||
m_y = MUST(SVGAnimatedLength::create(realm, MUST(SVGLength::create(realm, 0, 0)), MUST(SVGLength::create(realm, 0, 0))));
|
||||
m_width = MUST(SVGAnimatedLength::create(realm, MUST(SVGLength::create(realm, 0, 0)), MUST(SVGLength::create(realm, 0, 0))));
|
||||
m_height = MUST(SVGAnimatedLength::create(realm, MUST(SVGLength::create(realm, 0, 0)), MUST(SVGLength::create(realm, 0, 0))));
|
||||
m_x = SVGAnimatedLength::create(realm, SVGLength::create(realm, 0, 0), SVGLength::create(realm, 0, 0));
|
||||
m_y = SVGAnimatedLength::create(realm, SVGLength::create(realm, 0, 0), SVGLength::create(realm, 0, 0));
|
||||
m_width = SVGAnimatedLength::create(realm, SVGLength::create(realm, 0, 0), SVGLength::create(realm, 0, 0));
|
||||
m_height = SVGAnimatedLength::create(realm, SVGLength::create(realm, 0, 0), SVGLength::create(realm, 0, 0));
|
||||
}
|
||||
|
||||
void SVGForeignObjectElement::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
namespace Web::SVG {
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<SVGLength>> SVGLength::create(JS::Realm& realm, u8 unit_type, float value)
|
||||
JS::NonnullGCPtr<SVGLength> SVGLength::create(JS::Realm& realm, u8 unit_type, float value)
|
||||
{
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVGLength>(realm, realm, unit_type, value));
|
||||
return realm.heap().allocate<SVGLength>(realm, realm, unit_type, value);
|
||||
}
|
||||
|
||||
SVGLength::SVGLength(JS::Realm& realm, u8 unit_type, float value)
|
||||
|
|
|
@ -16,7 +16,7 @@ class SVGLength : public Bindings::PlatformObject {
|
|||
WEB_PLATFORM_OBJECT(SVGLength, Bindings::PlatformObject);
|
||||
|
||||
public:
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<SVGLength>> create(JS::Realm&, u8 unit_type, float value);
|
||||
[[nodiscard]] static JS::NonnullGCPtr<SVGLength> create(JS::Realm&, u8 unit_type, float value);
|
||||
virtual ~SVGLength() override;
|
||||
|
||||
u8 unit_type() const { return m_unit_type; }
|
||||
|
|
|
@ -67,9 +67,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGLineElement::x1() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_x1.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_x1.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_x1.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_x1.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#LineElementY1Attribute
|
||||
|
@ -77,9 +77,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGLineElement::y1() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_y1.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_y1.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_y1.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_y1.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#LineElementX2Attribute
|
||||
|
@ -87,9 +87,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGLineElement::x2() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_x2.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_x2.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_x2.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_x2.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#LineElementY2Attribute
|
||||
|
@ -97,9 +97,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGLineElement::y2() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_y2.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_y2.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_y2.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_y2.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -164,9 +164,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::x() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_x.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_x.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_x.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_x.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#RectElementYAttribute
|
||||
|
@ -174,9 +174,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::y() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_y.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_y.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_y.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_y.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#RectElementWidthAttribute
|
||||
|
@ -184,9 +184,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::width() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_width.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_width.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_width.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_width.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#RectElementHeightAttribute
|
||||
|
@ -194,9 +194,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::height() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_height.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_height.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_height.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_height.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#RectElementRXAttribute
|
||||
|
@ -204,9 +204,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::rx() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_radius_x.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_radius_x.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_radius_x.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_radius_x.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#RectElementRYAttribute
|
||||
|
@ -214,9 +214,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGRectElement::ry() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_radius_y.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_radius_y.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_radius_y.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_radius_y.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,12 +27,12 @@ void SVGUseElement::initialize(JS::Realm& realm)
|
|||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGUseElementPrototype>(realm, "SVGUseElement"));
|
||||
|
||||
// The shadow tree is open (inspectable by script), but read-only.
|
||||
auto shadow_root = MUST(heap().allocate<DOM::ShadowRoot>(realm, document(), *this, Bindings::ShadowRootMode::Open));
|
||||
auto shadow_root = heap().allocate<DOM::ShadowRoot>(realm, document(), *this, Bindings::ShadowRootMode::Open);
|
||||
|
||||
// The user agent must create a use-element shadow tree whose host is the ‘use’ element itself
|
||||
set_shadow_root(shadow_root);
|
||||
|
||||
m_document_observer = MUST(realm.heap().allocate<DOM::DocumentObserver>(realm, realm, document()));
|
||||
m_document_observer = realm.heap().allocate<DOM::DocumentObserver>(realm, realm, document());
|
||||
m_document_observer->document_completely_loaded = [this]() {
|
||||
clone_element_tree_as_our_shadow_tree(referenced_element());
|
||||
};
|
||||
|
@ -136,9 +136,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGUseElement::x() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_x.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_x.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_x.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_x.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG11/shapes.html#RectElementYAttribute
|
||||
|
@ -146,9 +146,9 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGUseElement::y() const
|
|||
{
|
||||
// FIXME: Populate the unit type when it is parsed (0 here is "unknown").
|
||||
// FIXME: Create a proper animated value when animations are supported.
|
||||
auto base_length = SVGLength::create(realm(), 0, m_y.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_y.value_or(0)).release_value_but_fixme_should_propagate_errors();
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length)).release_value_but_fixme_should_propagate_errors();
|
||||
auto base_length = SVGLength::create(realm(), 0, m_y.value_or(0));
|
||||
auto anim_length = SVGLength::create(realm(), 0, m_y.value_or(0));
|
||||
return SVGAnimatedLength::create(realm(), move(base_length), move(anim_length));
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<SVGAnimatedLength> SVGUseElement::width() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue