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

source

fn get_stacking_context_type(&self) -> Option<StackingContextType>

source

fn get_stacking_context_section(&self) -> StackingContextSection

source

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, )

source

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, )

source

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, )

source

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, )

source

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>

source

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>

source

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>

source

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.

source

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.

source

pub fn calculate_transform_matrix( &self, border_rect: &Rect<Au>, ) -> Option<LayoutTransform>

Returns the 4D matrix representing this fragment’s transform.

source

pub fn calculate_perspective_matrix( &self, border_rect: &Rect<Au>, ) -> Option<LayoutTransform>

Returns the 4D matrix representing this fragment’s perspective.

source§

impl BoxFragment

source

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

source

pub fn with_baselines(self, baselines: Baselines) -> Self

source

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.

source

pub fn add_extra_background(&mut self, extra_background: ExtraBackground)

source

pub fn set_does_not_paint_background(&mut self)

source

pub fn scrollable_overflow(&self) -> PhysicalRect<Au>

source

pub(crate) fn padding_rect(&self) -> PhysicalRect<Au>

source

pub(crate) fn border_rect(&self) -> PhysicalRect<Au>

source

pub(crate) fn margin_rect(&self) -> PhysicalRect<Au>

source

pub(crate) fn padding_border_margin(&self) -> PhysicalSides<Au>

source

pub fn print(&self, tree: &mut PrintTree)

source

pub fn scrollable_overflow_for_parent(&self) -> PhysicalRect<Au>

source

pub(crate) fn calculate_resolved_insets_if_positioned( &self, containing_block: &PhysicalRect<Au>, ) -> PhysicalSides<AuOrAuto>

source

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§

source§

impl Serialize for BoxFragment

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Downcast<T> for T

source§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
source§

impl<T> MaybeBoxed<Box<T>> for T

source§

fn maybe_boxed(self) -> Box<T>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Upcast<T> for T

source§

fn upcast(&self) -> Option<&T>

source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T

source§

impl<T> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSendSync for T

source§

impl<T> WasmNotSync for T
where T: Sync,