Struct layout_2020::replaced::NaturalSizes
source · pub(crate) struct NaturalSizes {
pub width: Option<Au>,
pub height: Option<Au>,
pub ratio: Option<CSSFloat>,
}
Expand description
The natural dimensions of a replaced element, including a height, width, and aspect ratio.
-
Raster images always have an natural width and height, with 1 image pixel = 1px. The natural ratio should be based on dividing those. See https://github.com/w3c/csswg-drafts/issues/4572 for the case where either is zero. PNG specifically disallows this but I (SimonSapin) am not sure about other formats.
-
Form controls have both natural width and height but no natural ratio. See https://github.com/w3c/csswg-drafts/issues/1044 and https://drafts.csswg.org/css-images/#natural-dimensions “In general, […]”
-
For SVG, see https://svgwg.org/svg2-draft/coords.html#SizingSVGInCSS and again https://github.com/w3c/csswg-drafts/issues/4572.
-
IFrames do not have natural width and height or natural ratio according to https://drafts.csswg.org/css-images/#intrinsic-dimensions.
Fields§
§width: Option<Au>
§height: Option<Au>
§ratio: Option<CSSFloat>
Implementations§
source§impl NaturalSizes
impl NaturalSizes
Trait Implementations§
source§impl Debug for NaturalSizes
impl Debug for NaturalSizes
Auto Trait Implementations§
impl Freeze for NaturalSizes
impl RefUnwindSafe for NaturalSizes
impl Send for NaturalSizes
impl Sync for NaturalSizes
impl Unpin for NaturalSizes
impl UnwindSafe for NaturalSizes
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> 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