Struct layout_2020::flow::BoxTree
source · pub struct BoxTree {
root: BlockFormattingContext,
canvas_background: CanvasBackground,
sensitive_to_scroll_input: bool,
}
Fields§
§root: BlockFormattingContext
Contains typically exactly one block-level box, which was generated by the root element.
There may be zero if that element has display: none
.
canvas_background: CanvasBackground
§sensitive_to_scroll_input: bool
Whether or not the root element should be sensitive to scrolling input events.
Implementations§
source§impl BoxTree
impl BoxTree
pub fn construct<'dom, Node>( context: &LayoutContext<'_>, root_element: Node, ) -> Self
sourcepub fn update<'dom, Node>(context: &LayoutContext<'_>, dirty_node: Node) -> bool
pub fn update<'dom, Node>(context: &LayoutContext<'_>, dirty_node: Node) -> bool
This method attempts to incrementally update the box tree from an arbitrary node that is not necessarily the document’s root element.
If the node is not a valid candidate for incremental update, the method
loops over its parent. The only valid candidates for now are absolutely
positioned boxes which don’t change their outside display mode (i.e. it
will not attempt to update from an absolutely positioned inline element
which became an absolutely positioned block element). The value true
is returned if an incremental update could be done, and false
otherwise.
There are various pain points that need to be taken care of to extend the set of valid candidates:
- it is not obvious how to incrementally check whether a block formatting context still contains floats or not;
- the propagation of text decorations towards node descendants is hard to do incrementally with our current representation of boxes
- how intrinsic content sizes are computed eagerly makes it hard to update those sizes for ancestors of the node from which we made an incremental update.
source§impl BoxTree
impl BoxTree
pub fn layout( &self, layout_context: &LayoutContext<'_>, viewport: Size2D<f32, CSSPixel>, ) -> FragmentTree
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BoxTree
impl !RefUnwindSafe for BoxTree
impl Send for BoxTree
impl Sync for BoxTree
impl Unpin for BoxTree
impl !UnwindSafe for BoxTree
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