mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
style: Always compute angle values to degrees.
This matches the spec, https://drafts.csswg.org/css-values/#angles, which says: > All <angle> units are compatible, and deg is their canonical unit. And https://drafts.csswg.org/css-values/#compat, which says: >When serializing computed values [...], compatible units [...] are converted into a single canonical unit. And also other implementations (Blink always serializes angles as degrees in computed style for example). Also allows us to get rid of quite a bit of code, and makes computed angle value representation just a number, which is nice. Differential Revision: https://phabricator.services.mozilla.com/D8619
This commit is contained in:
parent
11fedf18d9
commit
42def5a011
11 changed files with 142 additions and 209 deletions
|
@ -866,7 +866,7 @@ impl ToAnimatedValue for FontStyleAngle {
|
|||
|
||||
#[inline]
|
||||
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
|
||||
FontStyleAngle(Angle::Deg(
|
||||
FontStyleAngle(Angle::from_degrees(
|
||||
animated
|
||||
.degrees()
|
||||
.min(specified::FONT_STYLE_OBLIQUE_MAX_ANGLE_DEGREES)
|
||||
|
@ -899,7 +899,7 @@ impl FontStyle {
|
|||
/// https://drafts.csswg.org/css-fonts-4/#valdef-font-style-oblique-angle
|
||||
#[inline]
|
||||
pub fn default_angle() -> FontStyleAngle {
|
||||
FontStyleAngle(Angle::Deg(
|
||||
FontStyleAngle(Angle::from_degrees(
|
||||
specified::DEFAULT_FONT_STYLE_OBLIQUE_ANGLE_DEGREES,
|
||||
))
|
||||
}
|
||||
|
@ -919,7 +919,7 @@ impl FontStyle {
|
|||
if italic {
|
||||
return generics::FontStyle::Italic;
|
||||
}
|
||||
generics::FontStyle::Oblique(FontStyleAngle(Angle::Deg(angle)))
|
||||
generics::FontStyle::Oblique(FontStyleAngle(Angle::from_degrees(angle)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue