LibWeb: Return a dummy value from various SVG getters

Instead of crashing with a TODO() on half of the test cases generated by
Domato, let's just return a zeroed-out SVGAnimatedLength or
SVGAnimatedNumber from getters that return them.

We'll eventually have to implement these correctly, but crashing is not
productive since it blocks us from finding other issues.
This commit is contained in:
Andreas Kling 2024-03-11 15:34:24 +01:00
parent 35f359c51c
commit 9aefc5c927
Notes: sideshowbarker 2024-07-17 12:02:22 +09:00
4 changed files with 26 additions and 13 deletions

View File

@ -163,22 +163,26 @@ Optional<Gfx::PaintStyle const&> SVGLinearGradientElement::to_gfx_paint_style(SV
JS::NonnullGCPtr<SVGAnimatedLength> SVGLinearGradientElement::x1() const
{
TODO();
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGLinearGradientElement::y1() const
{
TODO();
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGLinearGradientElement::x2() const
{
TODO();
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGLinearGradientElement::y2() const
{
TODO();
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
}

View File

@ -216,32 +216,38 @@ Optional<Gfx::PaintStyle const&> SVGRadialGradientElement::to_gfx_paint_style(SV
JS::NonnullGCPtr<SVGAnimatedLength> SVGRadialGradientElement::cx() const
{
TODO();
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGRadialGradientElement::cy() const
{
TODO();
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGRadialGradientElement::fx() const
{
TODO();
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGRadialGradientElement::fy() const
{
TODO();
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGRadialGradientElement::fr() const
{
TODO();
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGRadialGradientElement::r() const
{
TODO();
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
}

View File

@ -62,7 +62,8 @@ float SVGStopElement::stop_opacity() const
JS::NonnullGCPtr<SVGAnimatedNumber> SVGStopElement::offset() const
{
TODO();
// FIXME: Implement this properly.
return SVGAnimatedNumber::create(realm(), 0, 0);
}
void SVGStopElement::initialize(JS::Realm& realm)

View File

@ -163,12 +163,14 @@ JS::NonnullGCPtr<SVGAnimatedLength> SVGUseElement::y() const
JS::NonnullGCPtr<SVGAnimatedLength> SVGUseElement::width() const
{
TODO();
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
JS::NonnullGCPtr<SVGAnimatedLength> SVGUseElement::height() const
{
TODO();
// FIXME: Implement this properly.
return SVGAnimatedLength::create(realm(), SVGLength::create(realm(), 0, 0), SVGLength::create(realm(), 0, 0));
}
// https://svgwg.org/svg2-draft/struct.html#TermInstanceRoot