mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Use generics for the filter property
This introduces an additional shadow type for drop-shadow().
This commit is contained in:
parent
e41b7d06b4
commit
6f4061d4ad
21 changed files with 822 additions and 496 deletions
|
@ -28,6 +28,7 @@ pub use self::background::BackgroundSize;
|
|||
pub use self::border::{BorderImageSlice, BorderImageWidth, BorderImageSideWidth};
|
||||
pub use self::border::{BorderRadius, BorderCornerRadius};
|
||||
pub use self::color::{Color, RGBAColor};
|
||||
pub use self::effects::FilterList;
|
||||
pub use self::flex::FlexBasis;
|
||||
pub use self::image::{Gradient, GradientItem, ImageLayer, LineDirection, Image, ImageRect};
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -49,6 +50,7 @@ pub mod background;
|
|||
pub mod basic_shape;
|
||||
pub mod border;
|
||||
pub mod color;
|
||||
pub mod effects;
|
||||
pub mod flex;
|
||||
pub mod image;
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -249,6 +251,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 {
|
||||
self.iter().map(|item| item.to_computed_value(context)).collect::<Vec<_>>().into_boxed_slice()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
|
||||
computed.iter().map(T::from_computed_value).collect::<Vec<_>>().into_boxed_slice()
|
||||
}
|
||||
}
|
||||
|
||||
/// A marker trait to represent that the specified value is also the computed
|
||||
/// value.
|
||||
pub trait ComputedValueAsSpecified {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue