mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: Infinity angles should degenerate compute to 0
Also adjusted WPT tests to always expect deg like similar past changes. WPT tests: https://github.com/web-platform-tests/wpt/blob/master/css/css-values/calc-infinity-nan-computed.html#L57-L71 Differential Revision: https://phabricator.services.mozilla.com/D172401
This commit is contained in:
parent
23d6ecfc57
commit
2dad1f0fd7
1 changed files with 8 additions and 1 deletions
|
@ -114,7 +114,14 @@ impl ToComputedValue for Angle {
|
|||
|
||||
#[inline]
|
||||
fn to_computed_value(&self, _context: &Context) -> Self::ComputedValue {
|
||||
ComputedAngle::from_degrees(crate::values::normalize(self.degrees()))
|
||||
let degrees = self.degrees();
|
||||
|
||||
// NaN and +-infinity should degenerate to 0: https://github.com/w3c/csswg-drafts/issues/6105
|
||||
ComputedAngle::from_degrees(if degrees.is_finite() {
|
||||
degrees
|
||||
} else {
|
||||
0.0
|
||||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue