pub(crate) struct PositioningContext {
absolutes: Vec<HoistedAbsolutelyPositionedBox>,
}
Fields§
§absolutes: Vec<HoistedAbsolutelyPositionedBox>
Implementations§
Source§impl PositioningContext
impl PositioningContext
pub(crate) fn new_for_layout_box_base( layout_box_base: &LayoutBoxBase, ) -> Option<Self>
fn new_for_style_and_fragment_flags( style: &ComputedValues, flags: &FragmentFlags, ) -> Option<Self>
Sourcepub(crate) fn adjust_static_position_of_hoisted_fragments(
&mut self,
parent_fragment: &Fragment,
index: PositioningContextLength,
)
pub(crate) fn adjust_static_position_of_hoisted_fragments( &mut self, parent_fragment: &Fragment, index: PositioningContextLength, )
Absolute and fixed position fragments are hoisted up to their containing blocks from their tree position. When these fragments have static inset start positions, that position (relative to the ancestor containing block) needs to be included with the hoisted fragment so that it can be laid out properly at the containing block.
This function is used to update the static position of hoisted boxes added after
the given index at every level of the fragment tree as the hoisted fragments move
up to their containing blocks. Once an ancestor fragment is laid out, this
function can be used to aggregate its offset to any descendent boxes that are
being hoisted. In this case, the appropriate index to use is the result of
PositioningContext::len()
cached before laying out the Fragment
.
Sourcepub(crate) fn adjust_static_position_of_hoisted_fragments_with_offset(
&mut self,
offset: &PhysicalVec<Au>,
index: PositioningContextLength,
)
pub(crate) fn adjust_static_position_of_hoisted_fragments_with_offset( &mut self, offset: &PhysicalVec<Au>, index: PositioningContextLength, )
See documentation for PositioningContext::adjust_static_position_of_hoisted_fragments.
Sourcepub(crate) fn layout_maybe_position_relative_fragment(
&mut self,
layout_context: &LayoutContext<'_>,
containing_block: &ContainingBlock<'_>,
base: &LayoutBoxBase,
fragment_layout_fn: impl FnOnce(&mut Self) -> BoxFragment,
) -> BoxFragment
pub(crate) fn layout_maybe_position_relative_fragment( &mut self, layout_context: &LayoutContext<'_>, containing_block: &ContainingBlock<'_>, base: &LayoutBoxBase, fragment_layout_fn: impl FnOnce(&mut Self) -> BoxFragment, ) -> BoxFragment
Given fragment_layout_fn
, a closure which lays out a fragment in a provided
PositioningContext
, create a new positioning context if necessary for the fragment and
lay out the fragment and all its children. Returns the newly created BoxFragment
.
fn take_boxes_for_fragment( &mut self, new_fragment: &BoxFragment, boxes_to_layout_out: &mut Vec<HoistedAbsolutelyPositionedBox>, boxes_to_continue_hoisting_out: &mut Vec<HoistedAbsolutelyPositionedBox>, )
pub(crate) fn layout_collected_children( &mut self, layout_context: &LayoutContext<'_>, new_fragment: &mut BoxFragment, )
pub(crate) fn push(&mut self, hoisted_box: HoistedAbsolutelyPositionedBox)
pub(crate) fn append(&mut self, other: Self)
pub(crate) fn layout_initial_containing_block_children( &mut self, layout_context: &LayoutContext<'_>, initial_containing_block: &DefiniteContainingBlock<'_>, fragments: &mut Vec<Fragment>, )
Sourcepub(crate) fn len(&self) -> PositioningContextLength
pub(crate) fn len(&self) -> PositioningContextLength
Get the length of this PositioningContext.
Sourcepub(crate) fn truncate(&mut self, length: &PositioningContextLength)
pub(crate) fn truncate(&mut self, length: &PositioningContextLength)
Truncate this PositioningContext to the given PositioningContextLength. This
is useful for “unhoisting” boxes in this context and returning it to the state at
the time that PositioningContext::len()
was called.
Trait Implementations§
Source§impl Clone for PositioningContext
impl Clone for PositioningContext
Source§fn clone(&self) -> PositioningContext
fn clone(&self) -> PositioningContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Default for PositioningContext
impl Default for PositioningContext
Source§fn default() -> PositioningContext
fn default() -> PositioningContext
Source§impl MallocSizeOf for PositioningContext
impl MallocSizeOf for PositioningContext
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Auto Trait Implementations§
impl Freeze for PositioningContext
impl !RefUnwindSafe for PositioningContext
impl Send for PositioningContext
impl Sync for PositioningContext
impl Unpin for PositioningContext
impl !UnwindSafe for PositioningContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 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>
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.