Struct BlockContext
pub struct BlockContext<'bfc> { /* private fields */ }Expand description
Context for each individual Block within a Block Formatting Context
Contains a mutable reference to the BlockFormattingContext + block-specific data
Implementations§
§impl BlockContext<'_>
impl BlockContext<'_>
pub fn sub_context(
&mut self,
additional_y_offset: f32,
insets: [f32; 2],
) -> BlockContext<'_>
pub fn sub_context( &mut self, additional_y_offset: f32, insets: [f32; 2], ) -> BlockContext<'_>
Create a sub-BlockContext for a child block node
pub fn is_bfc_root(&self) -> bool
pub fn is_bfc_root(&self) -> bool
Returns whether this block is the root block of it’s Block Formatting Context
§impl BlockContext<'_>
impl BlockContext<'_>
pub fn set_width(&mut self, available_width: f32)
pub fn set_width(&mut self, available_width: f32)
Set the width of the overall Block Formatting Context. This is used to resolve positions that are relative to the right of the context such as right-floated boxes.
Sub-blocks within a Block Formatting Context should use the Self::sub_context method to create
a sub-BlockContext with insets instead.
pub fn apply_content_box_inset(&mut self, content_box_x_insets: [f32; 2])
pub fn apply_content_box_inset(&mut self, content_box_x_insets: [f32; 2])
Set the x-axis content-box insets of the BlockContext. These are the difference between the border-box
and the content-box of the box (padding + border + scrollbar_gutter).
pub fn has_floats(&self) -> bool
pub fn has_floats(&self) -> bool
Whether the float context contains any floats
pub fn has_active_floats(&self, min_y: f32) -> bool
pub fn has_active_floats(&self, min_y: f32) -> bool
Whether the float context contains any floats that extend to or below min_y
pub fn place_floated_box(
&mut self,
floated_box: Size<f32>,
min_y: f32,
direction: FloatDirection,
clear: Clear,
) -> Point<f32>
pub fn place_floated_box( &mut self, floated_box: Size<f32>, min_y: f32, direction: FloatDirection, clear: Clear, ) -> Point<f32>
Position a floated box with the context
pub fn find_content_slot(
&self,
min_y: f32,
clear: Clear,
after: Option<usize>,
) -> ContentSlot
pub fn find_content_slot( &self, min_y: f32, clear: Clear, after: Option<usize>, ) -> ContentSlot
Search a space suitable for laying out non-floated content into
pub fn cleared_threshold(&self, clear: Clear) -> Option<f32>
pub fn cleared_threshold(&self, clear: Clear) -> Option<f32>
Get the bottom of lowest relevant float for the specific clear property
pub fn floated_content_height_contribution(&self) -> f32
pub fn floated_content_height_contribution(&self) -> f32
Returns the height that descendent floats consume
Auto Trait Implementations§
impl<'bfc> Freeze for BlockContext<'bfc>
impl<'bfc> RefUnwindSafe for BlockContext<'bfc>
impl<'bfc> Send for BlockContext<'bfc>
impl<'bfc> Sync for BlockContext<'bfc>
impl<'bfc> Unpin for BlockContext<'bfc>
impl<'bfc> UnsafeUnpin for BlockContext<'bfc>
impl<'bfc> !UnwindSafe for BlockContext<'bfc>
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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