Struct layout_2020::fragment_tree::box_fragment::BoxFragment
source · pub(crate) struct BoxFragment {Show 13 fields
pub base: BaseFragment,
pub style: Arc<ComputedValues>,
pub children: Vec<ArcRefCell<Fragment>>,
pub content_rect: PhysicalRect<Au>,
pub padding: PhysicalSides<Au>,
pub border: PhysicalSides<Au>,
pub margin: PhysicalSides<Au>,
pub clearance: Option<Au>,
baselines: Baselines,
pub block_margins_collapsed_with_children: CollapsedBlockMargins,
pub scrollable_overflow_from_children: PhysicalRect<Au>,
pub(crate) resolved_sticky_insets: Option<PhysicalSides<AuOrAuto>>,
pub background_mode: BackgroundMode,
}
Fields§
§base: BaseFragment
§style: Arc<ComputedValues>
§children: Vec<ArcRefCell<Fragment>>
§content_rect: PhysicalRect<Au>
The content rect of this fragment in the parent fragment’s content rectangle. This does not include padding, border, or margin – it only includes content.
padding: PhysicalSides<Au>
§border: PhysicalSides<Au>
§margin: PhysicalSides<Au>
§clearance: Option<Au>
When the clear
property is not set to none
, it may introduce clearance.
Clearance is some extra spacing that is added above the top margin,
so that the element doesn’t overlap earlier floats in the same BFC.
The presence of clearance prevents the top margin from collapsing with
earlier margins or with the bottom margin of the parent block.
https://drafts.csswg.org/css2/#clearance
baselines: Baselines
When this BoxFragment
is for content that has a baseline, this tracks
the first and last baselines of that content. This is used to propagate baselines
to things such as tables and inline formatting contexts.
block_margins_collapsed_with_children: CollapsedBlockMargins
§scrollable_overflow_from_children: PhysicalRect<Au>
The scrollable overflow of this box fragment.
resolved_sticky_insets: Option<PhysicalSides<AuOrAuto>>
The resolved box insets if this box is position: sticky
. These are calculated
during stacking context tree construction because they rely on the size of the
scroll container.
background_mode: BackgroundMode
Implementations§
source§impl BoxFragment
impl BoxFragment
fn get_stacking_context_type(&self) -> Option<StackingContextType>
fn get_stacking_context_section(&self) -> StackingContextSection
fn build_stacking_context_tree( &mut self, fragment: &ArcRefCell<Fragment>, display_list: &mut DisplayList, containing_block: &ContainingBlock, containing_block_info: &ContainingBlockManager<'_, ContainingBlock>, parent_stacking_context: &mut StackingContext, )
fn build_stacking_context_tree_maybe_creating_reference_frame( &mut self, fragment: &ArcRefCell<Fragment>, display_list: &mut DisplayList, containing_block: &ContainingBlock, containing_block_info: &ContainingBlockManager<'_, ContainingBlock>, parent_stacking_context: &mut StackingContext, )
fn build_stacking_context_tree_maybe_creating_stacking_context( &mut self, fragment: &ArcRefCell<Fragment>, display_list: &mut DisplayList, containing_block: &ContainingBlock, containing_block_info: &ContainingBlockManager<'_, ContainingBlock>, parent_stacking_context: &mut StackingContext, )
fn build_stacking_context_tree_for_children( &mut self, fragment: &ArcRefCell<Fragment>, display_list: &mut DisplayList, containing_block: &ContainingBlock, containing_block_info: &ContainingBlockManager<'_, ContainingBlock>, stacking_context: &mut StackingContext, )
fn build_clip_frame_if_necessary( &self, display_list: &mut DisplayList, parent_scroll_node_id: &ScrollTreeNodeId, parent_clip_chain_id: &ClipChainId, containing_block_rect: &PhysicalRect<Au>, ) -> Option<ClipChainId>
fn build_scroll_frame_if_necessary( &self, display_list: &mut DisplayList, parent_scroll_node_id: &ScrollTreeNodeId, parent_clip_id: &ClipChainId, containing_block_rect: &PhysicalRect<Au>, ) -> Option<ScrollFrameData>
fn build_sticky_frame_if_necessary( &mut self, display_list: &mut DisplayList, parent_scroll_node_id: &ScrollTreeNodeId, containing_block_rect: &PhysicalRect<Au>, scroll_frame_size: &Option<LayoutSize>, ) -> Option<ScrollTreeNodeId>
sourcefn reference_frame_data_if_necessary(
&self,
containing_block_rect: &PhysicalRect<Au>,
) -> Option<ReferenceFrameData>
fn reference_frame_data_if_necessary( &self, containing_block_rect: &PhysicalRect<Au>, ) -> Option<ReferenceFrameData>
Optionally returns the data for building a reference frame, without yet building it.
sourcefn has_non_invertible_transform_or_zero_scale(
&self,
containing_block: &Rect<Au>,
) -> bool
fn has_non_invertible_transform_or_zero_scale( &self, containing_block: &Rect<Au>, ) -> bool
Returns true if the given style contains a transform that is not invertible.
sourcepub fn calculate_transform_matrix(
&self,
border_rect: &Rect<Au>,
) -> Option<LayoutTransform>
pub fn calculate_transform_matrix( &self, border_rect: &Rect<Au>, ) -> Option<LayoutTransform>
Returns the 4D matrix representing this fragment’s transform.
sourcepub fn calculate_perspective_matrix(
&self,
border_rect: &Rect<Au>,
) -> Option<LayoutTransform>
pub fn calculate_perspective_matrix( &self, border_rect: &Rect<Au>, ) -> Option<LayoutTransform>
Returns the 4D matrix representing this fragment’s perspective.
source§impl BoxFragment
impl BoxFragment
pub fn new( base_fragment_info: BaseFragmentInfo, style: ServoArc<ComputedValues>, children: Vec<Fragment>, content_rect: PhysicalRect<Au>, padding: PhysicalSides<Au>, border: PhysicalSides<Au>, margin: PhysicalSides<Au>, clearance: Option<Au>, block_margins_collapsed_with_children: CollapsedBlockMargins, ) -> BoxFragment
pub fn with_baselines(self, baselines: Baselines) -> Self
sourcepub fn baselines(&self, writing_mode: WritingMode) -> Baselines
pub fn baselines(&self, writing_mode: WritingMode) -> Baselines
Get the baselines for this BoxFragment
if they are compatible with the given WritingMode
.
If they are not compatible, Baselines::default()
is returned.
pub fn add_extra_background(&mut self, extra_background: ExtraBackground)
pub fn set_does_not_paint_background(&mut self)
pub fn scrollable_overflow(&self) -> PhysicalRect<Au>
pub(crate) fn padding_rect(&self) -> PhysicalRect<Au>
pub(crate) fn border_rect(&self) -> PhysicalRect<Au>
pub(crate) fn margin_rect(&self) -> PhysicalRect<Au>
pub(crate) fn padding_border_margin(&self) -> PhysicalSides<Au>
pub fn print(&self, tree: &mut PrintTree)
pub fn scrollable_overflow_for_parent(&self) -> PhysicalRect<Au>
pub(crate) fn calculate_resolved_insets_if_positioned( &self, containing_block: &PhysicalRect<Au>, ) -> PhysicalSides<AuOrAuto>
sourcepub(crate) fn is_inline_box(&self) -> bool
pub(crate) fn is_inline_box(&self) -> bool
Whether this is a non-replaced inline-level box whose inner display type is flow
.
https://drafts.csswg.org/css-display-3/#inline-box
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BoxFragment
impl !RefUnwindSafe for BoxFragment
impl Send for BoxFragment
impl Sync for BoxFragment
impl Unpin for BoxFragment
impl !UnwindSafe for BoxFragment
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