mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Implement css(dimension) and derive ToCss for a bunch of stuff.
For css(dimension), it'd be nice to derive(Parse) too, I think...
This commit is contained in:
parent
1b533f9bdc
commit
4927786d90
10 changed files with 98 additions and 153 deletions
|
@ -57,12 +57,12 @@ impl ToComputedValue for Angle {
|
|||
impl Angle {
|
||||
/// Creates an angle with the given value in degrees.
|
||||
pub fn from_degrees(value: CSSFloat, was_calc: bool) -> Self {
|
||||
Angle { value: ComputedAngle::Degree(value), was_calc }
|
||||
Angle { value: ComputedAngle::Deg(value), was_calc }
|
||||
}
|
||||
|
||||
/// Creates an angle with the given value in gradians.
|
||||
pub fn from_gradians(value: CSSFloat, was_calc: bool) -> Self {
|
||||
Angle { value: ComputedAngle::Gradian(value), was_calc }
|
||||
Angle { value: ComputedAngle::Grad(value), was_calc }
|
||||
}
|
||||
|
||||
/// Creates an angle with the given value in turns.
|
||||
|
@ -72,7 +72,7 @@ impl Angle {
|
|||
|
||||
/// Creates an angle with the given value in radians.
|
||||
pub fn from_radians(value: CSSFloat, was_calc: bool) -> Self {
|
||||
Angle { value: ComputedAngle::Radian(value), was_calc }
|
||||
Angle { value: ComputedAngle::Rad(value), was_calc }
|
||||
}
|
||||
|
||||
/// Returns the amount of radians this angle represents.
|
||||
|
@ -89,7 +89,7 @@ impl Angle {
|
|||
/// Returns an `Angle` parsed from a `calc()` expression.
|
||||
pub fn from_calc(radians: CSSFloat) -> Self {
|
||||
Angle {
|
||||
value: ComputedAngle::Radian(radians),
|
||||
value: ComputedAngle::Rad(radians),
|
||||
was_calc: true,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue