pub(crate) struct BoxFragment {
pub base: BaseFragment,
pub children: Vec<Fragment>,
pub cumulative_containing_block_rect: AtomicRefCell<PhysicalRect<Au>>,
pub padding: PhysicalSides<Au>,
pub border: PhysicalSides<Au>,
pub margin: PhysicalSides<Au>,
baselines: Baselines,
scrollable_overflow: AtomicRefCell<Option<PhysicalRect<Au>>>,
pub background_mode: BackgroundMode,
pub rare_data: AtomicRefCell<Option<Box<BoxFragmentRareData>>>,
pub block_level_layout_info: Option<Box<BlockLevelLayoutInfo>>,
pub spatial_tree_node: AtomicRefCell<Option<ScrollTreeNodeId>>,
}Fields§
§base: BaseFragment§children: Vec<Fragment>§cumulative_containing_block_rect: AtomicRefCell<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: BaselinesWhen 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: AtomicRefCell<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.
background_mode: BackgroundMode§rare_data: AtomicRefCell<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, CSSPixel>,
) -> Option<LayoutTransform>
pub fn calculate_transform_matrix( &self, border_rect: &Rect<Au, CSSPixel>, ) -> Option<LayoutTransform>
Returns the 4D matrix representing this fragment’s transform.
Sourcepub fn calculate_perspective_matrix(
&self,
border_rect: &Rect<Au, CSSPixel>,
) -> Option<LayoutTransform>
pub fn calculate_perspective_matrix( &self, border_rect: &Rect<Au, CSSPixel>, ) -> 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(crate) 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>, ) -> Self
pub(crate) fn with_baselines(self, baselines: Baselines) -> Self
pub(crate) fn style<'a>(&'a self) -> AtomicRef<'a, ServoArc<ComputedValues>>
Sourcepub(crate) fn baselines(&self, writing_mode: WritingMode) -> Baselines
pub(crate) 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(crate) fn add_extra_background(&mut self, extra_background: ExtraBackground)
pub(crate) fn set_does_not_paint_background(&mut self)
pub(crate) fn ensure_rare_data( &self, ) -> AtomicRefMut<'_, Box<BoxFragmentRareData>>
pub(crate) fn specific_layout_info( &self, ) -> Option<AtomicRef<'_, SpecificLayoutInfo>>
pub(crate) fn resolved_sticky_insets( &self, ) -> Option<AtomicRef<'_, Box<PhysicalSides<AuOrAuto>>>>
pub(crate) fn with_block_level_layout_info( self, block_margins_collapsed_with_children: CollapsedBlockMargins, clearance: Option<Au>, ) -> Self
Sourcepub(crate) fn scrollable_overflow(&self) -> PhysicalRect<Au>
pub(crate) fn scrollable_overflow(&self) -> PhysicalRect<Au>
Get the scrollable overflow for this BoxFragment relative to its containing
block, recalculating scrollable overflow when necessary, for instance after a
style change.
Sourcepub(crate) fn clear_scrollable_overflow(&self)
pub(crate) fn clear_scrollable_overflow(&self)
Clear the scrollable overflow on this BoxFragment. This is called
during damage propagation when a fragment is preserved, itself or one of its
descendants has scrollable overflow damage.
Sourcefn calculate_scrollable_overflow(&self) -> PhysicalRect<Au>
fn calculate_scrollable_overflow(&self) -> PhysicalRect<Au>
This is an implementation of:
pub(crate) fn set_containing_block(&self, containing_block: &PhysicalRect<Au>)
pub(crate) fn offset_by_containing_block( &self, rect: &PhysicalRect<Au>, containing_block_computation: ContainingBlockCalculation<'_>, ) -> PhysicalRect<Au>
pub(crate) fn cumulative_content_box_rect( &self, containing_block_computation: ContainingBlockCalculation<'_>, ) -> PhysicalRect<Au>
pub(crate) fn cumulative_padding_box_rect( &self, containing_block_computation: ContainingBlockCalculation<'_>, ) -> PhysicalRect<Au>
pub(crate) fn cumulative_border_box_rect( &self, containing_block_computation: ContainingBlockCalculation<'_>, ) -> PhysicalRect<Au>
pub(crate) fn content_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(crate) 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_from_child: PhysicalRect<Au>,
clipping_rect: PhysicalRect<Au>,
) -> PhysicalRect<Au>
pub(crate) fn clip_wholly_unreachable_scrollable_overflow( &self, scrollable_overflow_from_child: PhysicalRect<Au>, clipping_rect: PhysicalRect<Au>, ) -> PhysicalRect<Au>
Return the clipped scrollable overflow based on its scroll origin, determined by
overflow direction. Return None if the scrollable overflow from child is wholly
unreachable. 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, containing_block_computation: ContainingBlockCalculation<'_>, ) -> 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
pub(crate) fn spatial_tree_node(&self) -> Option<ScrollTreeNodeId>
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 UnsafeUnpin 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