#[repr(C, u8)]pub(crate) enum GenericSize<LengthPercent> {
LengthPercentage(LengthPercent),
Auto,
MaxContent,
MinContent,
FitContent,
WebkitFillAvailable,
Stretch,
FitContentFunction(LengthPercent),
AnchorSizeFunction(Box<GenericAnchorSizeFunction<GenericSize<LengthPercent>>>),
AnchorContainingCalcFunction(LengthPercent),
}
Expand description
A generic value for the width
, height
, min-width
, or min-height
property.
Unlike max-width
or max-height
properties, a Size can be auto
,
and cannot be none
.
Note that it only accepts non-negative values.
Variants§
LengthPercentage(LengthPercent)
Auto
MaxContent
MinContent
FitContent
WebkitFillAvailable
Stretch
FitContentFunction(LengthPercent)
AnchorSizeFunction(Box<GenericAnchorSizeFunction<GenericSize<LengthPercent>>>)
AnchorContainingCalcFunction(LengthPercent)
Implementations§
Source§impl<LengthPercentage> GenericSize<LengthPercentage>
impl<LengthPercentage> GenericSize<LengthPercentage>
Source§impl GenericSize<NonNegative<LengthPercentage>>
impl GenericSize<NonNegative<LengthPercentage>>
Sourcepub fn parse_quirky<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
allow_quirks: AllowQuirks,
) -> Result<GenericSize<NonNegative<LengthPercentage>>, ParseError<'i, StyleParseErrorKind<'i>>>
pub fn parse_quirky<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, allow_quirks: AllowQuirks, ) -> Result<GenericSize<NonNegative<LengthPercentage>>, ParseError<'i, StyleParseErrorKind<'i>>>
Parses, with quirks.
Sourcepub fn parse_size_for_width_or_height_quirky<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
allow_quirks: AllowQuirks,
) -> Result<GenericSize<NonNegative<LengthPercentage>>, ParseError<'i, StyleParseErrorKind<'i>>>
pub fn parse_size_for_width_or_height_quirky<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, allow_quirks: AllowQuirks, ) -> Result<GenericSize<NonNegative<LengthPercentage>>, ParseError<'i, StyleParseErrorKind<'i>>>
Parse a size for width or height, where -webkit-fill-available support is only controlled by one pref (vs. other properties where there’s an additional pref check): TODO(dholbert) Remove this custom parse func in bug 1989073, along with ‘layout.css.webkit-fill-available.all-size-properties.enabled’.
Sourcepub fn parse_size_for_width_or_height<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
) -> Result<GenericSize<NonNegative<LengthPercentage>>, ParseError<'i, StyleParseErrorKind<'i>>>
pub fn parse_size_for_width_or_height<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<GenericSize<NonNegative<LengthPercentage>>, ParseError<'i, StyleParseErrorKind<'i>>>
Parse a size for width or height, where -webkit-fill-available support is only controlled by one pref (vs. other properties where there’s an additional pref check): TODO(dholbert) Remove this custom parse func in bug 1989073, along with ‘layout.css.webkit-fill-available.all-size-properties.enabled’.
Sourcepub fn zero_percent() -> GenericSize<NonNegative<LengthPercentage>>
pub fn zero_percent() -> GenericSize<NonNegative<LengthPercentage>>
Returns 0%
.
Trait Implementations§
Source§impl<LengthPercent> Animate for GenericSize<LengthPercent>where
LengthPercent: Animate,
impl<LengthPercent> Animate for GenericSize<LengthPercent>where
LengthPercent: Animate,
Source§fn animate(
&self,
other: &GenericSize<LengthPercent>,
procedure: Procedure,
) -> Result<GenericSize<LengthPercent>, ()>
fn animate( &self, other: &GenericSize<LengthPercent>, procedure: Procedure, ) -> Result<GenericSize<LengthPercent>, ()>
Source§impl<LengthPercent> Clone for GenericSize<LengthPercent>where
LengthPercent: Clone,
impl<LengthPercent> Clone for GenericSize<LengthPercent>where
LengthPercent: Clone,
Source§fn clone(&self) -> GenericSize<LengthPercent>
fn clone(&self) -> GenericSize<LengthPercent>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<LengthPercent> ComputeSquaredDistance for GenericSize<LengthPercent>where
LengthPercent: ComputeSquaredDistance,
impl<LengthPercent> ComputeSquaredDistance for GenericSize<LengthPercent>where
LengthPercent: ComputeSquaredDistance,
Source§fn compute_squared_distance(
&self,
other: &GenericSize<LengthPercent>,
) -> Result<SquaredDistance, ()>
fn compute_squared_distance( &self, other: &GenericSize<LengthPercent>, ) -> Result<SquaredDistance, ()>
Source§impl<LengthPercent> Debug for GenericSize<LengthPercent>where
LengthPercent: Debug,
impl<LengthPercent> Debug for GenericSize<LengthPercent>where
LengthPercent: Debug,
Source§impl From<GenericSize<NonNegative<LengthPercentage>>> for Size<LengthPercentage>
impl From<GenericSize<NonNegative<LengthPercentage>>> for Size<LengthPercentage>
Source§impl<LengthPercent> MallocSizeOf for GenericSize<LengthPercent>where
LengthPercent: MallocSizeOf,
impl<LengthPercent> MallocSizeOf for GenericSize<LengthPercent>where
LengthPercent: MallocSizeOf,
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Source§impl Parse for GenericSize<NonNegative<LengthPercentage>>
impl Parse for GenericSize<NonNegative<LengthPercentage>>
Source§fn parse<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
) -> Result<GenericSize<NonNegative<LengthPercentage>>, ParseError<'i, StyleParseErrorKind<'i>>>
fn parse<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<GenericSize<NonNegative<LengthPercentage>>, ParseError<'i, StyleParseErrorKind<'i>>>
Source§impl<LengthPercent> PartialEq for GenericSize<LengthPercent>where
LengthPercent: PartialEq,
impl<LengthPercent> PartialEq for GenericSize<LengthPercent>where
LengthPercent: PartialEq,
Source§impl<LengthPercent> SpecifiedValueInfo for GenericSize<LengthPercent>where
LengthPercent: SpecifiedValueInfo,
impl<LengthPercent> SpecifiedValueInfo for GenericSize<LengthPercent>where
LengthPercent: SpecifiedValueInfo,
Source§fn collect_completion_keywords(f: &mut dyn FnMut(&[&'static str]))
fn collect_completion_keywords(f: &mut dyn FnMut(&[&'static str]))
Source§const SUPPORTED_TYPES: u8 = 0u8
const SUPPORTED_TYPES: u8 = 0u8
Source§impl<LengthPercent> ToAnimatedValue for GenericSize<LengthPercent>where
LengthPercent: ToAnimatedValue,
impl<LengthPercent> ToAnimatedValue for GenericSize<LengthPercent>where
LengthPercent: ToAnimatedValue,
Source§type AnimatedValue = GenericSize<<LengthPercent as ToAnimatedValue>::AnimatedValue>
type AnimatedValue = GenericSize<<LengthPercent as ToAnimatedValue>::AnimatedValue>
Source§fn from_animated_value(
from: <GenericSize<LengthPercent> as ToAnimatedValue>::AnimatedValue,
) -> GenericSize<LengthPercent>
fn from_animated_value( from: <GenericSize<LengthPercent> as ToAnimatedValue>::AnimatedValue, ) -> GenericSize<LengthPercent>
Source§fn to_animated_value(
self,
context: &Context<'_>,
) -> <GenericSize<LengthPercent> as ToAnimatedValue>::AnimatedValue
fn to_animated_value( self, context: &Context<'_>, ) -> <GenericSize<LengthPercent> as ToAnimatedValue>::AnimatedValue
Source§impl<LengthPercent> ToAnimatedZero for GenericSize<LengthPercent>where
LengthPercent: ToAnimatedZero,
impl<LengthPercent> ToAnimatedZero for GenericSize<LengthPercent>where
LengthPercent: ToAnimatedZero,
Source§fn to_animated_zero(&self) -> Result<GenericSize<LengthPercent>, ()>
fn to_animated_zero(&self) -> Result<GenericSize<LengthPercent>, ()>
Source§impl<LengthPercent> ToComputedValue for GenericSize<LengthPercent>where
LengthPercent: ToComputedValue,
impl<LengthPercent> ToComputedValue for GenericSize<LengthPercent>where
LengthPercent: ToComputedValue,
Source§type ComputedValue = GenericSize<<LengthPercent as ToComputedValue>::ComputedValue>
type ComputedValue = GenericSize<<LengthPercent as ToComputedValue>::ComputedValue>
Source§fn from_computed_value(
from: &<GenericSize<LengthPercent> as ToComputedValue>::ComputedValue,
) -> GenericSize<LengthPercent>
fn from_computed_value( from: &<GenericSize<LengthPercent> as ToComputedValue>::ComputedValue, ) -> GenericSize<LengthPercent>
Source§fn to_computed_value(
&self,
context: &Context<'_>,
) -> <GenericSize<LengthPercent> as ToComputedValue>::ComputedValue
fn to_computed_value( &self, context: &Context<'_>, ) -> <GenericSize<LengthPercent> as ToComputedValue>::ComputedValue
Context
.Source§impl<LengthPercent> ToCss for GenericSize<LengthPercent>where
LengthPercent: ToCss,
impl<LengthPercent> ToCss for GenericSize<LengthPercent>where
LengthPercent: ToCss,
Source§fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Result<(), Error>where
W: Write,
fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Result<(), Error>where
W: Write,
self
in CSS syntax, writing to dest
.Source§fn to_css_string(&self) -> String
fn to_css_string(&self) -> String
self
in CSS syntax and return a string. Read moreSource§fn to_css_cssstring(&self) -> String
fn to_css_cssstring(&self) -> String
self
in CSS syntax and return a CssString. Read moreSource§impl<LengthPercent> ToResolvedValue for GenericSize<LengthPercent>where
LengthPercent: ToResolvedValue,
impl<LengthPercent> ToResolvedValue for GenericSize<LengthPercent>where
LengthPercent: ToResolvedValue,
Source§type ResolvedValue = GenericSize<<LengthPercent as ToResolvedValue>::ResolvedValue>
type ResolvedValue = GenericSize<<LengthPercent as ToResolvedValue>::ResolvedValue>
Source§fn from_resolved_value(
from: <GenericSize<LengthPercent> as ToResolvedValue>::ResolvedValue,
) -> GenericSize<LengthPercent>
fn from_resolved_value( from: <GenericSize<LengthPercent> as ToResolvedValue>::ResolvedValue, ) -> GenericSize<LengthPercent>
Source§fn to_resolved_value(
self,
context: &Context<'_>,
) -> <GenericSize<LengthPercent> as ToResolvedValue>::ResolvedValue
fn to_resolved_value( self, context: &Context<'_>, ) -> <GenericSize<LengthPercent> as ToResolvedValue>::ResolvedValue
Source§impl<LengthPercent> ToShmem for GenericSize<LengthPercent>where
LengthPercent: ToShmem,
impl<LengthPercent> ToShmem for GenericSize<LengthPercent>where
LengthPercent: ToShmem,
Source§fn to_shmem(
&self,
builder: &mut SharedMemoryBuilder,
) -> Result<ManuallyDrop<GenericSize<LengthPercent>>, String>
fn to_shmem( &self, builder: &mut SharedMemoryBuilder, ) -> Result<ManuallyDrop<GenericSize<LengthPercent>>, String>
Source§impl<LengthPercent> ToTyped for GenericSize<LengthPercent>
impl<LengthPercent> ToTyped for GenericSize<LengthPercent>
Source§fn to_typed(&self) -> Option<TypedValue>
fn to_typed(&self) -> Option<TypedValue>
impl<LengthPercent> StructuralPartialEq for GenericSize<LengthPercent>
Auto Trait Implementations§
impl<LengthPercent> Freeze for GenericSize<LengthPercent>where
LengthPercent: Freeze,
impl<LengthPercent> RefUnwindSafe for GenericSize<LengthPercent>where
LengthPercent: RefUnwindSafe,
impl<LengthPercent> Send for GenericSize<LengthPercent>where
LengthPercent: Send,
impl<LengthPercent> Sync for GenericSize<LengthPercent>where
LengthPercent: Sync,
impl<LengthPercent> Unpin for GenericSize<LengthPercent>where
LengthPercent: Unpin,
impl<LengthPercent> UnwindSafe for GenericSize<LengthPercent>where
LengthPercent: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more