mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
style: Compare degrees for font-style to account for compute_angle introducing error.
This commit is contained in:
parent
1f5d90568d
commit
16ca8de6df
1 changed files with 4 additions and 1 deletions
|
@ -912,7 +912,10 @@ impl ToCss for FontStyle {
|
||||||
generics::FontStyle::Italic => dest.write_str("italic"),
|
generics::FontStyle::Italic => dest.write_str("italic"),
|
||||||
generics::FontStyle::Oblique(ref angle) => {
|
generics::FontStyle::Oblique(ref angle) => {
|
||||||
dest.write_str("oblique")?;
|
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(' ')?;
|
dest.write_char(' ')?;
|
||||||
angle.to_css(dest)?;
|
angle.to_css(dest)?;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue