mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Implement #[compute(clone)] for #[derive(ToComputedValue)]
This commit is contained in:
parent
efc852f6e3
commit
735e093de7
6 changed files with 37 additions and 95 deletions
|
@ -18,8 +18,7 @@ use values::generics::image::{CompatMode, ColorStop as GenericColorStop, EndingS
|
|||
use values::generics::image::{Gradient as GenericGradient, GradientItem as GenericGradientItem};
|
||||
use values::generics::image::{Image as GenericImage, GradientKind as GenericGradientKind};
|
||||
use values::generics::image::{LineDirection as GenericLineDirection, MozImageRect as GenericMozImageRect};
|
||||
use values::specified::image::{Gradient as SpecifiedGradient, LineDirection as SpecifiedLineDirection};
|
||||
use values::specified::image::{GradientKind as SpecifiedGradientKind};
|
||||
use values::specified::image::LineDirection as SpecifiedLineDirection;
|
||||
use values::specified::position::{X, Y};
|
||||
|
||||
/// A computed image layer.
|
||||
|
@ -181,25 +180,3 @@ impl ToComputedValue for SpecifiedLineDirection {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToComputedValue for SpecifiedGradient {
|
||||
type ComputedValue = Gradient;
|
||||
|
||||
fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
|
||||
Self::ComputedValue {
|
||||
kind: self.kind.to_computed_value(context),
|
||||
items: self.items.to_computed_value(context),
|
||||
repeating: self.repeating,
|
||||
compat_mode: self.compat_mode
|
||||
}
|
||||
}
|
||||
|
||||
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
|
||||
Self {
|
||||
kind: SpecifiedGradientKind::from_computed_value(&computed.kind),
|
||||
items: ToComputedValue::from_computed_value(&computed.items),
|
||||
repeating: computed.repeating,
|
||||
compat_mode: computed.compat_mode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue