mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Rename LayerImage to ImageLayer and make it a type alias
This commit is contained in:
parent
fa5b46b6ee
commit
73f77e0a53
12 changed files with 47 additions and 101 deletions
|
@ -11,6 +11,7 @@ use cssparser::Color as CSSColor;
|
|||
use std::f32::consts::PI;
|
||||
use std::fmt;
|
||||
use style_traits::ToCss;
|
||||
use values::{Either, None_};
|
||||
use values::computed::{Angle, Context, Length, LengthOrPercentage, NumberOrPercentage, ToComputedValue};
|
||||
use values::computed::position::Position;
|
||||
use values::generics::image::{CompatMode, ColorStop as GenericColorStop, EndingShape as GenericEndingShape};
|
||||
|
@ -20,6 +21,9 @@ use values::generics::image::{ImageRect as GenericImageRect, LineDirection as Ge
|
|||
use values::specified::image::LineDirection as SpecifiedLineDirection;
|
||||
use values::specified::position::{X, Y};
|
||||
|
||||
/// A computed image layer.
|
||||
pub type ImageLayer = Either<None_, Image>;
|
||||
|
||||
/// Computed values for an image according to CSS-IMAGES.
|
||||
/// https://drafts.csswg.org/css-images/#image-values
|
||||
pub type Image = GenericImage<Gradient, ImageRect>;
|
||||
|
@ -126,17 +130,3 @@ impl ToComputedValue for SpecifiedLineDirection {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Computed values for none | <image> | <mask-source>.
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct LayerImage(pub Option<Image>);
|
||||
|
||||
impl ToCss for LayerImage {
|
||||
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
|
||||
match self.0 {
|
||||
None => dest.write_str("none"),
|
||||
Some(ref image) => image.to_css(dest),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue