Struct layout_2020::replaced::ReplacedContents
source · pub(crate) struct ReplacedContents {
pub kind: ReplacedContentKind,
natural_size: NaturalSizes,
base_fragment_info: BaseFragmentInfo,
}
Fields§
§kind: ReplacedContentKind
§natural_size: NaturalSizes
§base_fragment_info: BaseFragmentInfo
Implementations§
source§impl ReplacedContents
impl ReplacedContents
sourcefn layout_in_flow_block_level(
&self,
base: &LayoutBoxBase,
layout_context: &LayoutContext<'_>,
containing_block: &ContainingBlock<'_>,
sequential_layout_state: Option<&mut SequentialLayoutState>,
) -> BoxFragment
fn layout_in_flow_block_level( &self, base: &LayoutBoxBase, layout_context: &LayoutContext<'_>, containing_block: &ContainingBlock<'_>, sequential_layout_state: Option<&mut SequentialLayoutState>, ) -> BoxFragment
source§impl ReplacedContents
impl ReplacedContents
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 make_fragments( &self, layout_context: &LayoutContext<'_>, style: &ServoArc<ComputedValues>, size: PhysicalSize<Au>, ) -> Vec<Fragment>
pub(crate) fn preferred_aspect_ratio( &self, style: &ComputedValues, padding_border_sums: &LogicalVec2<Au>, ) -> 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,
preferred_aspect_ratio: Option<AspectRatio>,
block_sizes: &Sizes,
inline_sizes: &Sizes,
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, preferred_aspect_ratio: Option<AspectRatio>, block_sizes: &Sizes, inline_sizes: &Sizes, 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 ComputeInlineContentSizes for ReplacedContents
impl ComputeInlineContentSizes for ReplacedContents
fn compute_inline_content_sizes( &self, _: &LayoutContext<'_>, constraint_space: &ConstraintSpace, ) -> InlineContentSizesResult
source§impl Debug for ReplacedContents
impl Debug for ReplacedContents
Auto Trait Implementations§
impl Freeze for ReplacedContents
impl RefUnwindSafe for ReplacedContents
impl Send for ReplacedContents
impl Sync for ReplacedContents
impl Unpin for ReplacedContents
impl UnwindSafe for ReplacedContents
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