Struct layout_2020::flow::float::FloatContext
source · pub struct FloatContext {
pub bands: FloatBandTree,
pub ceiling_from_floats: Au,
pub ceiling_from_non_floats: Au,
pub containing_block_info: ContainingBlockPositionInfo,
pub clear_left_position: Au,
pub clear_right_position: Au,
}
Expand description
Data kept during layout about the floats in a given block formatting context.
This is a persistent data structure. Each float has its own private copy of the float context,
although such copies may share portions of the bands
tree.
Fields§
§bands: FloatBandTree
A persistent AA tree of float bands.
This tree is immutable; modification operations return the new tree, which may share nodes with previous versions of the tree.
ceiling_from_floats: Au
The block-direction “ceiling” defined by the placement of other floated content of this FloatContext. No new floats can be placed at a lower block start than this value.
ceiling_from_non_floats: Au
The block-direction “ceiling” defined by the placement of non-floated content that precedes floated content in the document. Note that this may actually decrease as content is laid out in the case that content overflows its container.
containing_block_info: ContainingBlockPositionInfo
Details about the position of the containing block relative to the
independent block formatting context that contains all of the floats
this FloatContext
positions.
clear_left_position: Au
The (logically) lowest margin edge of the last left float.
clear_right_position: Au
The (logically) lowest margin edge of the last right float.
Implementations§
source§impl FloatContext
impl FloatContext
sourcepub fn new(max_inline_size: Au) -> Self
pub fn new(max_inline_size: Au) -> Self
Returns a new float context representing a containing block with the given content inline-size.
sourcepub fn set_ceiling_from_non_floats(&mut self, new_ceiling: Au)
pub fn set_ceiling_from_non_floats(&mut self, new_ceiling: Au)
(Logically) lowers the ceiling to at least new_ceiling
units.
If the ceiling is already logically lower (i.e. larger) than this, does nothing.
sourcefn ceiling(&mut self) -> Au
fn ceiling(&mut self) -> Au
The “ceiling” used for float placement. This is the minimum block position value that should be used for placing any new float.
sourcepub(crate) fn place_object(
&self,
object: &PlacementInfo,
ceiling: Au,
) -> LogicalVec2<Au>
pub(crate) fn place_object( &self, object: &PlacementInfo, ceiling: Au, ) -> LogicalVec2<Au>
Determines where a float with the given placement would go, but leaves the float context unmodified. Returns the start corner of its margin box.
This should be used for placing inline elements and block formatting contexts so that they don’t collide with floats.
sourcepub fn add_float(&mut self, new_float: &PlacementInfo) -> LogicalVec2<Au>
pub fn add_float(&mut self, new_float: &PlacementInfo) -> LogicalVec2<Au>
Places a new float and adds it to the list. Returns the start corner of its margin box.
Trait Implementations§
source§impl Clone for FloatContext
impl Clone for FloatContext
source§fn clone(&self) -> FloatContext
fn clone(&self) -> FloatContext
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for FloatContext
impl RefUnwindSafe for FloatContext
impl Send for FloatContext
impl Sync for FloatContext
impl Unpin for FloatContext
impl UnwindSafe for FloatContext
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