Explorar o código

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.
Andreas Kling hai 1 ano
pai
achega
9aefc5c927

+ 8 - 4
Userland/Libraries/LibWeb/SVG/SVGLinearGradientElement.cpp

@@ -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));
 }
 
 }

+ 12 - 6
Userland/Libraries/LibWeb/SVG/SVGRadialGradientElement.cpp

@@ -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));
 }
 
 }

+ 2 - 1
Userland/Libraries/LibWeb/SVG/SVGStopElement.cpp

@@ -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)

+ 4 - 2
Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp

@@ -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