Struct layout_2020::flow::float::PlacementAmongFloats

source ·
pub(crate) struct PlacementAmongFloats<'a> {
    float_context: &'a FloatContext,
    current_bands: VecDeque<FloatBand>,
    next_band: FloatBand,
    object_size: LogicalVec2<Au>,
    ceiling: Au,
    min_inline_start: Au,
    max_inline_end: Au,
}
Expand description

This data strucure is used to try to place non-floating content among float content. This is used primarily to place replaced content and independent formatting contexts next to floats, as the specifcation dictates.

Fields§

§float_context: &'a FloatContext

The FloatContext to use for this placement.

§current_bands: VecDeque<FloatBand>

The current bands we are considering for this placement.

§next_band: FloatBand

The next band, needed to know the height of the last band in current_bands.

§object_size: LogicalVec2<Au>

The size of the object to place.

§ceiling: Au

The minimum position in the block direction for the placement. Objects should not be placed before this point.

§min_inline_start: Au

The inline position where the object would be if there were no floats. The object can be placed after it due to floats, but not before it.

§max_inline_end: Au

The maximum inline position that the object can attain when avoiding floats.

Implementations§

source§

impl<'a> PlacementAmongFloats<'a>

source

pub(crate) fn new( float_context: &'a FloatContext, ceiling: Au, object_size: LogicalVec2<Au>, pbm: &PaddingBorderMargin, ) -> Self

source

fn top_of_bands(&self) -> Option<Au>

The top of the bands under consideration. This is initially the ceiling provided during creation of this PlacementAmongFloats, but may be larger if the top band is discarded.

source

fn current_bands_height(&self) -> Au

The height of the bands under consideration.

source

fn add_one_band(&mut self)

Add a single band to the bands under consideration and calculate the new PlacementAmongFloats::next_band.

source

fn accumulate_enough_bands_for_block_size(&mut self)

Adds bands to the set of bands under consideration until their block size is at least large enough to contain the block size of the object being placed.

source

fn calculate_inline_start_and_end(&self) -> (Au, Au)

Find the start and end of the inline space provided by the current set of bands under consideration.

source

fn calculate_viable_inline_size(&self) -> Au

Find the total inline size provided by the current set of bands under consideration.

source

fn try_place_once(&mut self) -> Option<LogicalRect<Au>>

source

fn has_bands_or_at_end(&self) -> bool

Checks if we either have bands or we have gone past all of them. This is an invariant that should hold, otherwise we are in a broken state.

source

fn pop_front_band_ensuring_has_bands_or_at_end(&mut self)

source

pub(crate) fn place(&mut self) -> LogicalRect<Au>

Run the placement algorithm for this PlacementAmongFloats.

source

pub(crate) fn set_inline_size( &mut self, inline_size: Au, pbm: &PaddingBorderMargin, )

After placing a table and then laying it out, it may turn out wider than what we initially expected. This method takes care of updating the data so that the next place() can find the right area for the new size. Note that if the new size is smaller, placement won’t backtrack to consider areas that weren’t big enough for the old size.

source

pub(crate) fn try_to_expand_for_auto_block_size( &mut self, block_size_after_layout: Au, size_from_placement: &LogicalVec2<Au>, ) -> bool

After placing an object with height: auto (and using the minimum inline and block size as the object size) and then laying it out, try to fit the object into the current set of bands, given block size after layout and the available inline space from the original placement. This will return true if the object fits at the original placement location or false if the placement and layout must be run again (with this PlacementAmongFloats).

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.
§

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

§

type Output = T

Should always be Self
source§

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

§

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

§

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,