mirror of
https://github.com/servo/servo.git
synced 2025-08-08 15:05:35 +01:00
Add from_computed_value() function for converting computed values to specified
This commit is contained in:
parent
153ec64c15
commit
d81c6af59c
17 changed files with 555 additions and 1 deletions
|
@ -456,7 +456,7 @@ enum CalcUnit {
|
|||
Time,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Copy, Debug)]
|
||||
#[derive(Clone, PartialEq, Copy, Debug, Default)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct CalcLengthOrPercentage {
|
||||
pub absolute: Option<Au>,
|
||||
|
@ -1565,6 +1565,11 @@ impl ToComputedValue for Number {
|
|||
|
||||
#[inline]
|
||||
fn to_computed_value(&self, _: &Context) -> CSSFloat { self.0 }
|
||||
|
||||
#[inline]
|
||||
fn from_computed_value(computed: &CSSFloat) -> Self {
|
||||
Number(*computed)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for Number {
|
||||
|
@ -1598,6 +1603,11 @@ impl ToComputedValue for Opacity {
|
|||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn from_computed_value(computed: &CSSFloat) -> Self {
|
||||
Opacity(*computed)
|
||||
}
|
||||
}
|
||||
|
||||
impl ToCss for Opacity {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue