style: Deduplicate Angle parsing code.

This commit is contained in:
Emilio Cobos Álvarez 2017-12-02 15:30:20 +01:00
parent 55439e6222
commit 3631b1e197
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 41 additions and 26 deletions

View file

@ -714,6 +714,8 @@ impl LineDirection {
let mut _angle = if *compat_mode == CompatMode::Moz {
input.try(|i| Angle::parse(context, i)).ok()
} else {
// Gradients allow unitless zero angles as an exception, see:
// https://github.com/w3c/csswg-drafts/issues/1162
if let Ok(angle) = input.try(|i| Angle::parse_with_unitless(context, i)) {
return Ok(LineDirection::Angle(angle));
}