mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Implement ToComputedValue for Box<T>
This commit is contained in:
parent
4e64ccde60
commit
7c31202dda
4 changed files with 27 additions and 3 deletions
|
@ -408,7 +408,7 @@ impl ToComputedValue for specified::LengthOrPercentage {
|
|||
LengthOrPercentage::Percentage(value)
|
||||
}
|
||||
specified::LengthOrPercentage::Calc(ref calc) => {
|
||||
LengthOrPercentage::Calc(calc.to_computed_value(context))
|
||||
LengthOrPercentage::Calc((**calc).to_computed_value(context))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ impl ToComputedValue for specified::LengthOrPercentageOrAuto {
|
|||
LengthOrPercentageOrAuto::Auto
|
||||
}
|
||||
specified::LengthOrPercentageOrAuto::Calc(ref calc) => {
|
||||
LengthOrPercentageOrAuto::Calc(calc.to_computed_value(context))
|
||||
LengthOrPercentageOrAuto::Calc((**calc).to_computed_value(context))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -591,7 +591,7 @@ impl ToComputedValue for specified::LengthOrPercentageOrNone {
|
|||
LengthOrPercentageOrNone::Percentage(value)
|
||||
}
|
||||
specified::LengthOrPercentageOrNone::Calc(ref calc) => {
|
||||
LengthOrPercentageOrNone::Calc(calc.to_computed_value(context))
|
||||
LengthOrPercentageOrNone::Calc((**calc).to_computed_value(context))
|
||||
}
|
||||
specified::LengthOrPercentageOrNone::None => {
|
||||
LengthOrPercentageOrNone::None
|
||||
|
|
|
@ -296,6 +296,22 @@ impl<T> ToComputedValue for Vec<T>
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> ToComputedValue for Box<T>
|
||||
where T: ToComputedValue
|
||||
{
|
||||
type ComputedValue = Box<<T as ToComputedValue>::ComputedValue>;
|
||||
|
||||
#[inline]
|
||||
fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
|
||||
Box::new(T::to_computed_value(self, context))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
|
||||
Box::new(T::from_computed_value(computed))
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> ToComputedValue for Box<[T]>
|
||||
where T: ToComputedValue
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue