style: Serialize NaN and infinity angles as per spec

`NaN`, `infinity`, and `-infinity` angles should be specially serialized.

Also fixed a few relevant WPT tests which did not follow spec.
(see https://github.com/web-platform-tests/wpt/pull/38825)

Adjusted WPT test expectations, 40 newly pass 🎉

Differential Revision: https://phabricator.services.mozilla.com/D171658
This commit is contained in:
CanadaHonk 2023-03-07 00:02:55 +00:00 committed by Martin Robinson
parent 7b28572309
commit a8fef9d4f2
3 changed files with 66 additions and 16 deletions

View file

@ -836,7 +836,12 @@ impl CalcNode {
Leaf::Angle(ref angle) => Ok(angle.degrees()),
_ => Err(()),
})?;
Ok(Angle::from_calc(crate::values::normalize(degrees)))
let result = Angle::from_calc(if nan_inf_enabled() {
degrees
} else {
crate::values::normalize(degrees)
});
Ok(result)
}
/// Tries to simplify this expression into a `<number>` value.