diff --git a/dom/svg/SVGMarkerElement.cpp b/dom/svg/SVGMarkerElement.cpp index f1f592deb45a..5467c4ac11cb 100644 --- a/dom/svg/SVGMarkerElement.cpp +++ b/dom/svg/SVGMarkerElement.cpp @@ -109,13 +109,10 @@ void SVGMarkerElement::SetOrientToAuto() { mOrient.SetBaseType(SVG_MARKER_ORIENT_AUTO, this, IgnoreErrors()); } -void SVGMarkerElement::SetOrientToAngle(DOMSVGAngle& angle, ErrorResult& rv) { - float f = angle.Value(); - if (!std::isfinite(f)) { - rv.ThrowTypeError("Unknown or invalid type"); - return; - } - mOrient.SetBaseValue(f, angle.UnitType(), this, true); +void SVGMarkerElement::SetOrientToAngle(DOMSVGAngle& aAngle) { + nsAutoString angle; + aAngle.GetValueAsString(angle); + mOrient.SetBaseValueString(angle, this, true); } //---------------------------------------------------------------------- diff --git a/dom/svg/SVGMarkerElement.h b/dom/svg/SVGMarkerElement.h index 0fd1e902bd50..3904b36a87c6 100644 --- a/dom/svg/SVGMarkerElement.h +++ b/dom/svg/SVGMarkerElement.h @@ -65,7 +65,7 @@ class SVGMarkerElement final : public SVGMarkerElementBase { already_AddRefed OrientType(); already_AddRefed OrientAngle(); void SetOrientToAuto(); - void SetOrientToAngle(DOMSVGAngle& angle, ErrorResult& rv); + void SetOrientToAngle(DOMSVGAngle& aAngle); protected: void SetParentCoordCtxProvider(SVGViewportElement* aContext); diff --git a/dom/webidl/SVGMarkerElement.webidl b/dom/webidl/SVGMarkerElement.webidl index 4b4d205f43f2..1c5ab43d80b7 100644 --- a/dom/webidl/SVGMarkerElement.webidl +++ b/dom/webidl/SVGMarkerElement.webidl @@ -40,7 +40,6 @@ interface SVGMarkerElement : SVGElement { readonly attribute SVGAnimatedAngle orientAngle; undefined setOrientToAuto(); - [Throws] undefined setOrientToAngle(SVGAngle angle); }; diff --git a/testing/web-platform/tests/svg/types/scripted/SVGAnimatedEnumeration-SVGMarkerElement.html b/testing/web-platform/tests/svg/types/scripted/SVGAnimatedEnumeration-SVGMarkerElement.html index e0266fa612b9..61c44d0d178a 100644 --- a/testing/web-platform/tests/svg/types/scripted/SVGAnimatedEnumeration-SVGMarkerElement.html +++ b/testing/web-platform/tests/svg/types/scripted/SVGAnimatedEnumeration-SVGMarkerElement.html @@ -62,7 +62,7 @@ test(function() { assert_equals(markerElement.orientType.baseVal, SVGMarkerElement.SVG_MARKER_ORIENT_AUTO); // Switch to 'Pi/2 rad' value - via setOrientToAngle(). - anglePiHalfRad = createSVGAngle(); + let anglePiHalfRad = createSVGAngle(); anglePiHalfRad.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_RAD, (Math.PI / 2).toFixed(2)); markerElement.setOrientToAngle(anglePiHalfRad); assert_equals(markerElement.orientAngle.baseVal.value.toFixed(1), "90.0"); @@ -78,7 +78,7 @@ test(function() { assert_equals(markerElement.getAttribute('orient'), "auto"); // Switch to '20deg' value - via setOrientToAngle(). - angle20deg = createSVGAngle(); + let angle20deg = createSVGAngle(); angle20deg.newValueSpecifiedUnits(SVGAngle.SVG_ANGLETYPE_DEG, 20); markerElement.setOrientToAngle(angle20deg); assert_equals(markerElement.orientAngle.baseVal.value, 20); @@ -137,6 +137,12 @@ test(function() { markerElement.setAttribute('orient', '1turn'); assert_equals(markerElement.orientAngle.baseVal.value, 360); assert_equals(markerElement.orientAngle.baseVal.unitType, SVGAngle.SVG_ANGLETYPE_UNKNOWN); + + let angle = createSVGAngle(); + angle = markerElement.orientAngle.baseVal; + angle.value = 720; + markerElement.setOrientToAngle(angle); + assert_equals(markerElement.getAttribute('orient'), "2turn"); }, "Test turn units"); test(function() {