pub(crate) struct BoxFragment {Show 15 fields
pub base: BaseFragment,
pub style: Arc<ComputedValues>,
pub children: Vec<Fragment>,
pub content_rect: PhysicalRect<Au>,
pub cumulative_containing_block_rect: PhysicalRect<Au>,
pub padding: PhysicalSides<Au>,
pub border: PhysicalSides<Au>,
pub margin: PhysicalSides<Au>,
baselines: Baselines,
scrollable_overflow: Option<PhysicalRect<Au>>,
pub(crate) resolved_sticky_insets: AtomicRefCell<Option<PhysicalSides<AuOrAuto>>>,
pub background_mode: BackgroundMode,
pub rare_data: Option<Box<BoxFragmentRareData>>,
pub block_level_layout_info: Option<Box<BlockLevelLayoutInfo>>,
pub spatial_tree_node: AtomicRefCell<Option<ScrollTreeNodeId>>,
}
Fields§
§base: BaseFragment
§style: Arc<ComputedValues>
§children: Vec<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.
cumulative_containing_block_rect: PhysicalRect<Au>
This BoxFragment
’s containing block rectangle in coordinates relative to
the initial containing block, but not taking into account any transforms.
padding: PhysicalSides<Au>
§border: PhysicalSides<Au>
§margin: PhysicalSides<Au>
§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.
scrollable_overflow: Option<PhysicalRect<Au>>
The scrollable overflow of this box fragment in the same coordiante system as
Self::content_rect
ie a rectangle within the parent fragment’s content
rectangle. This does not take into account any transforms this fragment applies.
This is handled when calling Self::scrollable_overflow_for_parent
.
resolved_sticky_insets: AtomicRefCell<Option<PhysicalSides<AuOrAuto>>>
The resolved box insets if this box is position: sticky
. These are calculated
during StackingContextTree
construction because they rely on the size of the
scroll container.
background_mode: BackgroundMode
§rare_data: Option<Box<BoxFragmentRareData>>
Rare data that not all kinds of BoxFragment
would have.
block_level_layout_info: Option<Box<BlockLevelLayoutInfo>>
Additional information for block-level boxes.
spatial_tree_node: AtomicRefCell<Option<ScrollTreeNodeId>>
The containing spatial tree node of this BoxFragment
. This is assigned during
StackingContextTree
construction, so isn’t available before that time. This is
used to for determining final viewport size and position of this node and will
also be used in the future for hit testing.
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( &self, fragment: Fragment, stacking_context_tree: &mut StackingContextTree, containing_block: &ContainingBlock, containing_block_info: &ContainingBlockManager<'_, ContainingBlock>, parent_stacking_context: &mut StackingContext, text_decorations: &Arc<Vec<FragmentTextDecoration>>, )
fn build_stacking_context_tree_maybe_creating_reference_frame( &self, fragment: Fragment, stacking_context_tree: &mut StackingContextTree, containing_block: &ContainingBlock, containing_block_info: &ContainingBlockManager<'_, ContainingBlock>, parent_stacking_context: &mut StackingContext, text_decorations: &Arc<Vec<FragmentTextDecoration>>, )
fn build_stacking_context_tree_maybe_creating_stacking_context( &self, fragment: Fragment, stacking_context_tree: &mut StackingContextTree, containing_block: &ContainingBlock, containing_block_info: &ContainingBlockManager<'_, ContainingBlock>, parent_stacking_context: &mut StackingContext, text_decorations: &Arc<Vec<FragmentTextDecoration>>, )
fn build_stacking_context_tree_for_children( &self, fragment: Fragment, stacking_context_tree: &mut StackingContextTree, containing_block: &ContainingBlock, containing_block_info: &ContainingBlockManager<'_, ContainingBlock>, stacking_context: &mut StackingContext, text_decorations: &Arc<Vec<FragmentTextDecoration>>, )
fn build_clip_frame_if_necessary( &self, stacking_context_tree: &mut StackingContextTree, parent_scroll_node_id: &ScrollTreeNodeId, parent_clip_id: ClipId, containing_block_rect: &PhysicalRect<Au>, ) -> Option<ClipId>
fn build_overflow_frame_if_necessary( &self, stacking_context_tree: &mut StackingContextTree, parent_scroll_node_id: &ScrollTreeNodeId, parent_clip_id: ClipId, containing_block_rect: &PhysicalRect<Au>, ) -> Option<OverflowFrameData>
fn build_sticky_frame_if_necessary( &self, stacking_context_tree: &mut StackingContextTree, 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.
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.
fn clear_spatial_tree_node_including_descendants(&self)
Source§impl BoxFragment
impl BoxFragment
fn border_radius(&self) -> BorderRadius
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>, specific_layout_info: Option<SpecificLayoutInfo>, ) -> 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 specific_layout_info(&self) -> Option<&SpecificLayoutInfo>
pub fn with_block_level_layout_info( self, block_margins_collapsed_with_children: CollapsedBlockMargins, clearance: Option<Au>, ) -> Self
Sourcepub fn scrollable_overflow(&self) -> PhysicalRect<Au>
pub fn scrollable_overflow(&self) -> PhysicalRect<Au>
Get the scrollable overflow for this BoxFragment
relative to its
containing block.
Sourcepub(crate) fn calculate_scrollable_overflow(&mut self)
pub(crate) fn calculate_scrollable_overflow(&mut self)
This is an implementation of:
pub(crate) fn set_containing_block( &mut self, containing_block: &PhysicalRect<Au>, )
pub fn offset_by_containing_block( &self, rect: &PhysicalRect<Au>, ) -> PhysicalRect<Au>
pub(crate) fn cumulative_content_box_rect(&self) -> PhysicalRect<Au>
pub(crate) fn cumulative_padding_box_rect(&self) -> PhysicalRect<Au>
pub(crate) fn cumulative_border_box_rect(&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(crate) fn is_root_element(&self) -> bool
pub(crate) fn is_body_element_of_html_element_root(&self) -> bool
pub fn print(&self, tree: &mut PrintTree)
pub(crate) fn scrollable_overflow_for_parent(&self) -> PhysicalRect<Au>
Sourcepub(crate) fn clip_wholly_unreachable_scrollable_overflow(
&self,
scrollable_overflow: PhysicalRect<Au>,
clipping_rect: PhysicalRect<Au>,
) -> PhysicalRect<Au>
pub(crate) fn clip_wholly_unreachable_scrollable_overflow( &self, scrollable_overflow: PhysicalRect<Au>, clipping_rect: PhysicalRect<Au>, ) -> PhysicalRect<Au>
Return the clipped the scrollable overflow based on its scroll origin, determined by overflow direction. For an element, the clip rect is the padding rect and for viewport, it is the initial containing block.
pub(crate) fn calculate_resolved_insets_if_positioned( &self, ) -> 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
Sourcepub(crate) fn is_atomic_inline_level(&self) -> bool
pub(crate) fn is_atomic_inline_level(&self) -> bool
Whether this is an atomic inline-level box. https://drafts.csswg.org/css-display-3/#atomic-inline
Sourcepub(crate) fn is_table_wrapper(&self) -> bool
pub(crate) fn is_table_wrapper(&self) -> bool
Whether this is a table wrapper box. https://www.w3.org/TR/css-tables-3/#table-wrapper-box
pub(crate) fn has_collapsed_borders(&self) -> bool
Trait Implementations§
Source§impl MallocSizeOf for BoxFragment
impl MallocSizeOf for BoxFragment
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
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> 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