style::values::specified::image

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§

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>>),
}

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.

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