mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1836132 - stop setOrientToAngle from asserting if the angle is in turn units r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D179621
This commit is contained in:
parent
3faf6ac817
commit
3729183059
@ -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);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -65,7 +65,7 @@ class SVGMarkerElement final : public SVGMarkerElementBase {
|
||||
already_AddRefed<DOMSVGAnimatedEnumeration> OrientType();
|
||||
already_AddRefed<DOMSVGAnimatedAngle> OrientAngle();
|
||||
void SetOrientToAuto();
|
||||
void SetOrientToAngle(DOMSVGAngle& angle, ErrorResult& rv);
|
||||
void SetOrientToAngle(DOMSVGAngle& aAngle);
|
||||
|
||||
protected:
|
||||
void SetParentCoordCtxProvider(SVGViewportElement* aContext);
|
||||
|
@ -40,7 +40,6 @@ interface SVGMarkerElement : SVGElement {
|
||||
readonly attribute SVGAnimatedAngle orientAngle;
|
||||
|
||||
undefined setOrientToAuto();
|
||||
[Throws]
|
||||
undefined setOrientToAngle(SVGAngle angle);
|
||||
};
|
||||
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user