mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
style: Animate the 'normal' value of font-style as 'oblique 0deg'
This matches what the spec[1] says for font-style: > Animation type: by computed value type; normal animates as oblique 0deg A bunch of WPT tests for font-style animation are landing in https://github.com/web-platform-tests/wpt/pull/37570. Current Gecko passes 66/129 of the testcases there; with this patch applied it passes all the tests. [1] https://drafts.csswg.org/css-fonts-4/#font-style-prop Differential Revision: https://phabricator.services.mozilla.com/D166128
This commit is contained in:
parent
e51b9b8e1c
commit
b7d64ee6a4
1 changed files with 11 additions and 2 deletions
|
@ -1005,7 +1005,10 @@ impl ToAnimatedValue for FontStyle {
|
|||
#[inline]
|
||||
fn to_animated_value(self) -> Self::AnimatedValue {
|
||||
if self == Self::NORMAL {
|
||||
return generics::FontStyle::Normal;
|
||||
// This allows us to animate between normal and oblique values. Per spec,
|
||||
// https://drafts.csswg.org/css-fonts-4/#font-style-prop:
|
||||
// Animation type: by computed value type; 'normal' animates as 'oblique 0deg'
|
||||
return generics::FontStyle::Oblique(Angle::from_degrees(0.0))
|
||||
}
|
||||
if self == Self::ITALIC {
|
||||
return generics::FontStyle::Italic;
|
||||
|
@ -1018,7 +1021,13 @@ impl ToAnimatedValue for FontStyle {
|
|||
match animated {
|
||||
generics::FontStyle::Normal => Self::NORMAL,
|
||||
generics::FontStyle::Italic => Self::ITALIC,
|
||||
generics::FontStyle::Oblique(ref angle) => Self::oblique(angle.degrees()),
|
||||
generics::FontStyle::Oblique(ref angle) =>
|
||||
if angle.degrees() == 0.0 {
|
||||
// Reverse the conversion done in to_animated_value()
|
||||
Self::NORMAL
|
||||
} else {
|
||||
Self::oblique(angle.degrees())
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue