Type Alias Image

Source
pub type Image = Image<Gradient, SpecifiedUrl, Color, Percentage, Resolution>;
Expand description

Specified values for an image according to CSS-IMAGES. https://drafts.csswg.org/css-images/#image-values

Aliased Type§

#[repr(C, u8)]
pub enum Image { None, Url(CssUrl), Gradient(Box<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>>), PaintWorklet(Box<PaintWorklet>), CrossFade(Box<GenericCrossFade<GenericImage<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>, CssUrl, Color, Percentage, Resolution>, Color, Percentage>>), ImageSet(Box<GenericImageSet<GenericImage<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>, CssUrl, Color, Percentage, Resolution>, Resolution>>), LightDark(Box<GenericLightDark<GenericImage<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>, CssUrl, Color, Percentage, Resolution>>>), }

Variants§

§

None

none variant.

§

Url(CssUrl)

A <url()> image.

§

Gradient(Box<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>>)

A <gradient> image. Gradients are rather large, and not nearly as common as urls, so we box them here to keep the size of this enum sane.

§

PaintWorklet(Box<PaintWorklet>)

§

CrossFade(Box<GenericCrossFade<GenericImage<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>, CssUrl, Color, Percentage, Resolution>, Color, Percentage>>)

A <cross-fade()> image. Storing this directly inside of GenericImage increases the size by 8 bytes so we box it here and store images directly inside of cross-fade instead of boxing them there.

§

ImageSet(Box<GenericImageSet<GenericImage<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>, CssUrl, Color, Percentage, Resolution>, Resolution>>)

An image-set() function.

§

LightDark(Box<GenericLightDark<GenericImage<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>, CssUrl, Color, Percentage, Resolution>>>)

A light-dark() function. NOTE(emilio): #[css(skip)] only affects SpecifiedValueInfo. Remove or make conditional if/when shipping light-dark() for content.

Implementations§

Source§

impl Image

Source

fn parse_with_cors_mode<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, cors_mode: CorsMode, flags: ParseImageFlags, ) -> Result<Image, ParseError<'i>>

Source§

impl Image

Source

pub fn for_cascade(url: Arc<Url>) -> Self

Creates an already specified image value from an already resolved URL for insertion in the cascade.

Source

pub fn parse_with_cors_anonymous<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Image, ParseError<'i>>

Provides an alternate method for parsing that associates the URL with anonymous CORS headers.

Source

pub fn parse_forbid_none<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Image, ParseError<'i>>

Provides an alternate method for parsing, but forbidding none

Source

pub fn parse_only_url<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Image, ParseError<'i>>

Provides an alternate method for parsing, but only for urls.

Trait Implementations§

Source§

impl Parse for Image

Source§

fn parse<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Image, ParseError<'i>>

Parse a value of this type. Read more
Source§

impl ToComputedValue for Image

Source§

type ComputedValue = GenericImage<GenericGradient<LineDirection, LengthPercentage, NonNegative<CSSPixelLength>, NonNegative<LengthPercentage>, GenericPosition<LengthPercentage, LengthPercentage>, Angle, AngleOrPercentage, GenericColor<Percentage>>, ComputedUrl, GenericColor<Percentage>, Percentage, Resolution>

The computed value type we’re going to be converted to.
Source§

fn to_computed_value(&self, context: &Context<'_>) -> Self::ComputedValue

Convert a specified value to a computed value, using itself and the data inside the Context.
Source§

fn from_computed_value(computed: &Self::ComputedValue) -> Self

Convert a computed value to specified value form. Read more