Struct layout_2013::floats::Floats
source · pub struct Floats {
list: FloatList,
offset: LogicalSize<Au>,
pub writing_mode: WritingMode,
}
Expand description
Encapsulates information about floats. This is optimized to avoid allocation if there are no floats, and to avoid copying when translating the list of floats downward.
Fields§
§list: FloatList
The list of floats.
offset: LogicalSize<Au>
The offset of the flow relative to the first float.
writing_mode: WritingMode
The writing mode of these floats.
Implementations§
source§impl Floats
impl Floats
sourcepub fn new(writing_mode: WritingMode) -> Floats
pub fn new(writing_mode: WritingMode) -> Floats
Creates a new Floats
object.
sourcepub fn translate(&mut self, delta: LogicalSize<Au>)
pub fn translate(&mut self, delta: LogicalSize<Au>)
Adjusts the recorded offset of the flow relative to the first float.
sourcepub fn last_float_pos(&self) -> Option<LogicalRect<Au>>
pub fn last_float_pos(&self) -> Option<LogicalRect<Au>>
Returns the position of the last float in flow coordinates.
sourcepub fn available_rect(
&self,
block_start: Au,
block_size: Au,
max_x: Au,
) -> Option<LogicalRect<Au>>
pub fn available_rect( &self, block_start: Au, block_size: Au, max_x: Au, ) -> Option<LogicalRect<Au>>
Returns a rectangle that encloses the region from block-start to block-start + block-size, with inline-size small enough that it doesn’t collide with any floats. max_x is the inline-size beyond which floats have no effect. (Generally this is the containing block inline-size.)
sourcepub fn add_float(&mut self, info: &PlacementInfo)
pub fn add_float(&mut self, info: &PlacementInfo)
Adds a new float to the list.
sourcefn max_block_size_for_bounds(
&self,
inline_start: Au,
block_start: Au,
inline_size: Au,
) -> Option<Au>
fn max_block_size_for_bounds( &self, inline_start: Au, block_start: Au, inline_size: Au, ) -> Option<Au>
Given the three sides of the bounding rectangle in the block-start direction, finds the
largest block-size that will result in the rectangle not colliding with any floats. Returns
None
if that block-size is infinite.
sourcepub fn place_between_floats(&self, info: &PlacementInfo) -> LogicalRect<Au>
pub fn place_between_floats(&self, info: &PlacementInfo) -> LogicalRect<Au>
Given placement information, finds the closest place a fragment can be positioned without colliding with any floats.
pub fn clearance(&self, clear: ClearType) -> Au
pub fn is_present(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Floats
impl RefUnwindSafe for Floats
impl Send for Floats
impl Sync for Floats
impl Unpin for Floats
impl UnwindSafe for Floats
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