style: Compare degrees for font-style to account for compute_angle introducing error.

This commit is contained in:
Emilio Cobos Álvarez 2018-04-28 09:24:57 +02:00
parent 1f5d90568d
commit 16ca8de6df
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -912,7 +912,10 @@ impl ToCss for FontStyle {
generics::FontStyle::Italic => dest.write_str("italic"),
generics::FontStyle::Oblique(ref angle) => {
dest.write_str("oblique")?;
if *angle != Self::default_angle() {
// Use `degrees` instead of just comparing Angle because
// `degrees` can return slightly different values due to
// floating point conversions.
if angle.0.degrees() != Self::default_angle().0.degrees() {
dest.write_char(' ')?;
angle.to_css(dest)?;
}