Struct layout_2020::replaced::ReplacedContent
source · pub(crate) struct ReplacedContent {
pub kind: ReplacedContentKind,
natural_size: NaturalSizes,
base_fragment_info: BaseFragmentInfo,
}
Fields§
§kind: ReplacedContentKind
§natural_size: NaturalSizes
§base_fragment_info: BaseFragmentInfo
Implementations§
source§impl ReplacedContent
impl ReplacedContent
pub fn for_element<'dom>( element: impl NodeExt<'dom>, context: &LayoutContext<'_>, ) -> Option<Self>
pub fn from_image_url<'dom>( element: impl NodeExt<'dom>, context: &LayoutContext<'_>, image_url: &ComputedUrl, ) -> Option<Self>
pub fn from_image<'dom>( element: impl NodeExt<'dom>, context: &LayoutContext<'_>, image: &ComputedImage, ) -> Option<Self>
fn flow_relative_natural_size( &self, writing_mode: WritingMode, ) -> LogicalVec2<Option<Au>>
fn inline_size_over_block_size_intrinsic_ratio( &self, style: &ComputedValues, ) -> Option<CSSFloat>
fn content_size( &self, axis: Direction, preferred_aspect_ratio: Option<AspectRatio>, get_size_in_opposite_axis: &dyn Fn() -> SizeConstraint, get_fallback_size: &dyn Fn() -> Au, ) -> Au
pub fn inline_content_sizes( &self, _: &LayoutContext<'_>, constraint_space: &ConstraintSpace, preferred_aspect_ratio: Option<AspectRatio>, ) -> InlineContentSizesResult
pub fn make_fragments( &self, style: &ServoArc<ComputedValues>, containing_block: &ContainingBlock<'_>, size: PhysicalSize<Au>, ) -> Vec<Fragment>
pub(crate) fn preferred_aspect_ratio( &self, containing_block: &IndefiniteContainingBlock, style: &ComputedValues, ) -> Option<AspectRatio>
sourcepub(crate) fn used_size_as_if_inline_element(
&self,
containing_block: &ContainingBlock<'_>,
style: &ComputedValues,
content_box_sizes_and_pbm: &ContentBoxSizesAndPBM,
) -> LogicalVec2<Au>
pub(crate) fn used_size_as_if_inline_element( &self, containing_block: &ContainingBlock<'_>, style: &ComputedValues, content_box_sizes_and_pbm: &ContentBoxSizesAndPBM, ) -> LogicalVec2<Au>
pub(crate) fn default_object_size() -> PhysicalSize<Au>
pub(crate) fn flow_relative_default_object_size( writing_mode: WritingMode, ) -> LogicalVec2<Au>
sourcepub(crate) fn used_size_as_if_inline_element_from_content_box_sizes(
&self,
containing_block: &ContainingBlock<'_>,
style: &ComputedValues,
box_size: LogicalVec2<Size<Au>>,
min_box_size: LogicalVec2<Size<Au>>,
max_box_size: LogicalVec2<Size<Au>>,
pbm_sums: LogicalVec2<Au>,
) -> LogicalVec2<Au>
pub(crate) fn used_size_as_if_inline_element_from_content_box_sizes( &self, containing_block: &ContainingBlock<'_>, style: &ComputedValues, box_size: LogicalVec2<Size<Au>>, min_box_size: LogicalVec2<Size<Au>>, max_box_size: LogicalVec2<Size<Au>>, pbm_sums: LogicalVec2<Au>, ) -> LogicalVec2<Au>
https://drafts.csswg.org/css2/visudet.html#inline-replaced-width https://drafts.csswg.org/css2/visudet.html#inline-replaced-height
Also used in other cases, for example https://drafts.csswg.org/css2/visudet.html#block-replaced-width
The logic differs from CSS2 in order to properly handle aspect-ratio
and keyword sizes.
Each axis can have preferred, min and max sizing constraints, plus constraints transferred
from the other axis if there is an aspect ratio, plus a natural and default size.
In case of conflict, the order of precedence (from highest to lowest) is:
- Non-transferred min constraint
- Non-transferred max constraint
- Non-transferred preferred constraint
- Transferred min constraint
- Transferred max constraint
- Transferred preferred constraint
- Natural size
- Default object size
https://drafts.csswg.org/css-sizing-4/#aspect-ratio-size-transfers https://github.com/w3c/csswg-drafts/issues/6071#issuecomment-2243986313
Trait Implementations§
source§impl Debug for ReplacedContent
impl Debug for ReplacedContent
Auto Trait Implementations§
impl Freeze for ReplacedContent
impl RefUnwindSafe for ReplacedContent
impl Send for ReplacedContent
impl Sync for ReplacedContent
impl Unpin for ReplacedContent
impl UnwindSafe for ReplacedContent
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert