Struct layout_2013::construct::FlowConstructor

source ·
pub struct FlowConstructor<'a, N> {
    pub layout_context: &'a LayoutContext<'a>,
    phantom2: PhantomData<N>,
}
Expand description

An object that knows how to create flows.

Fields§

§layout_context: &'a LayoutContext<'a>

The layout context.

§phantom2: PhantomData<N>

Satisfy the compiler about the unused parameters, which we use to improve the ergonomics of the ensuing impl {} by removing the need to parameterize all the methods individually.

Implementations§

source§

impl<'a, 'dom, ConcreteThreadSafeLayoutNode> FlowConstructor<'a, ConcreteThreadSafeLayoutNode>
where ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'dom>,

source

pub fn new(layout_context: &'a LayoutContext<'a>) -> Self

Creates a new flow constructor.

source

fn style_context(&self) -> &SharedStyleContext<'_>

source

fn set_flow_construction_result( &self, node: &ConcreteThreadSafeLayoutNode, result: ConstructionResult, )

source

fn build_fragment_for_block( &self, node: &ConcreteThreadSafeLayoutNode, ) -> Fragment

Builds the fragment for the given block or subclass thereof.

source

fn flush_inline_fragments_to_flow( &mut self, fragment_accumulator: InlineFragmentsAccumulator, flow: &mut FlowRef, absolute_descendants: &mut AbsoluteDescendants, legalizer: &mut Legalizer, node: &ConcreteThreadSafeLayoutNode, )

Creates an inline flow from a set of inline fragments, then adds it as a child of the given flow or pushes it onto the given flow list.

#[inline(always)] because this is performance critical and LLVM will not inline it otherwise.

source

fn build_block_flow_using_construction_result_of_child( &mut self, flow: &mut FlowRef, node: &ConcreteThreadSafeLayoutNode, kid: ConcreteThreadSafeLayoutNode, inline_fragment_accumulator: &mut InlineFragmentsAccumulator, abs_descendants: &mut AbsoluteDescendants, legalizer: &mut Legalizer, )

source

fn build_flow_for_block_starting_with_fragments( &mut self, flow: FlowRef, node: &ConcreteThreadSafeLayoutNode, initial_fragments: IntermediateInlineFragments, ) -> ConstructionResult

Constructs a block flow, beginning with the given initial_fragments if present and then appending the construction results of children to the child list of the block flow. {ib} splits and absolutely-positioned descendants are handled correctly.

source

fn build_flow_for_block_like( &mut self, flow: FlowRef, node: &ConcreteThreadSafeLayoutNode, ) -> ConstructionResult

Constructs a flow for the given block node and its children. This method creates an initial fragment as appropriate and then dispatches to build_flow_for_block_starting_with_fragments. Currently the following kinds of flows get initial content:

  • Generated content gets the initial content specified by the content attribute of the CSS.
  • <input> and <textarea> elements get their content.

FIXME(pcwalton): It is not clear to me that there isn’t a cleaner way to handle <textarea>.

source

fn create_fragments_for_node_text_content( &self, fragments: &mut IntermediateInlineFragments, node: &ConcreteThreadSafeLayoutNode, style: &ServoArc<ComputedValues>, )

Pushes fragments appropriate for the content of the given node onto the given list.

source

fn build_flow_for_block( &mut self, node: &ConcreteThreadSafeLayoutNode, float_kind: Option<FloatKind>, ) -> ConstructionResult

Builds a flow for a node with display: block. This yields a BlockFlow with possibly other BlockFlows or InlineFlows underneath it, depending on whether {ib} splits needed to happen.

source

fn accumulate_inline_block_splits( &mut self, splits: LinkedList<InlineBlockSplit>, node: &ConcreteThreadSafeLayoutNode, fragment_accumulator: &mut InlineFragmentsAccumulator, opt_inline_block_splits: &mut LinkedList<InlineBlockSplit>, )

Bubbles up {ib} splits.

source

fn build_fragments_for_nonreplaced_inline_content( &mut self, node: &ConcreteThreadSafeLayoutNode, ) -> ConstructionResult

Concatenates the fragments of kids, adding in our own borders/padding/margins if necessary. Returns the InlineFragmentsConstructionResult, if any. There will be no InlineFragmentsConstructionResult if this node consisted entirely of ignorable whitespace.

source

fn build_fragments_for_replaced_inline_content( &mut self, node: &ConcreteThreadSafeLayoutNode, ) -> ConstructionResult

Creates an InlineFragmentsConstructionResult for replaced content. Replaced content doesn’t render its children, so this just nukes a child’s fragments and creates a Fragment.

source

fn build_fragment_for_inline_block_or_inline_flex( &mut self, node: &ConcreteThreadSafeLayoutNode, display: Display, ) -> ConstructionResult

Build the fragment for an inline-block or inline-flex, based on the display flag

source

fn build_fragment_for_absolutely_positioned_inline( &mut self, node: &ConcreteThreadSafeLayoutNode, ) -> ConstructionResult

This is an annoying case, because the computed display value is block, but the hypothetical box is inline.

source

fn build_fragments_for_inline( &mut self, node: &ConcreteThreadSafeLayoutNode, ) -> ConstructionResult

Builds one or more fragments for a node with display: inline. This yields an InlineFragmentsConstructionResult.

source

fn place_table_caption_under_table_wrapper_on_side( &mut self, table_wrapper_flow: &mut FlowRef, node: &ConcreteThreadSafeLayoutNode, side: CaptionSide, )

Places any table captions found under the given table wrapper, if the value of their caption-side property is equal to the given side.

source

fn build_flow_for_multicol( &mut self, node: &ConcreteThreadSafeLayoutNode, float_kind: Option<FloatKind>, ) -> ConstructionResult

Builds a flow for a node with column-count or column-width non-auto. This yields a MulticolFlow with a single MulticolColumnFlow underneath it.

source

fn build_flow_for_table( &mut self, node: &ConcreteThreadSafeLayoutNode, float_value: Float, ) -> ConstructionResult

Builds a flow for a node with display: table. This yields a TableWrapperFlow with possibly other TableCaptionFlows or TableFlows underneath it.

source

fn build_flow_for_table_caption( &mut self, node: &ConcreteThreadSafeLayoutNode, ) -> ConstructionResult

Builds a flow for a node with display: table-caption. This yields a TableCaptionFlow with possibly other BlockFlows or InlineFlows underneath it.

source

fn build_flow_for_table_rowgroup( &mut self, node: &ConcreteThreadSafeLayoutNode, ) -> ConstructionResult

Builds a flow for a node with display: table-row-group. This yields a TableRowGroupFlow with possibly other TableRowFlows underneath it.

source

fn build_flow_for_table_row( &mut self, node: &ConcreteThreadSafeLayoutNode, ) -> ConstructionResult

Builds a flow for a node with display: table-row. This yields a TableRowFlow with possibly other TableCellFlows underneath it.

source

fn build_flow_for_table_cell( &mut self, node: &ConcreteThreadSafeLayoutNode, ) -> ConstructionResult

Builds a flow for a node with display: table-cell. This yields a TableCellFlow with possibly other BlockFlows or InlineFlows underneath it.

source

fn build_flow_for_list_item( &mut self, node: &ConcreteThreadSafeLayoutNode, flotation: Float, ) -> ConstructionResult

Builds a flow for a node with display: list-item. This yields a ListItemFlow with possibly other BlockFlows or InlineFlows underneath it.

source

fn build_fragments_for_table_column( &mut self, node: &ConcreteThreadSafeLayoutNode, ) -> ConstructionResult

Creates a fragment for a node with display: table-column.

source

fn build_flow_for_table_colgroup( &mut self, node: &ConcreteThreadSafeLayoutNode, ) -> ConstructionResult

Builds a flow for a node with display: table-column-group. This yields a TableColGroupFlow.

source

fn build_flow_for_flex( &mut self, node: &ConcreteThreadSafeLayoutNode, float_kind: Option<FloatKind>, ) -> ConstructionResult

Builds a flow for a node with ‘display: flex’.

source

pub fn repair_if_possible( &mut self, node: &ConcreteThreadSafeLayoutNode, ) -> bool

Attempts to perform incremental repair to account for recent changes to this node. This can fail and return false, indicating that flows will need to be reconstructed.

TODO(pcwalton): Add some more fast paths, like toggling display: none, adding block kids to block parents with no {ib} splits, adding out-of-flow kids, etc.

Trait Implementations§

source§

impl<'a, 'dom, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<'dom, ConcreteThreadSafeLayoutNode> for FlowConstructor<'a, ConcreteThreadSafeLayoutNode>
where ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'dom>,

source§

fn process(&mut self, node: &ConcreteThreadSafeLayoutNode)

The operation to perform. Return true to continue or false to stop.

Auto Trait Implementations§

§

impl<'a, N> Freeze for FlowConstructor<'a, N>

§

impl<'a, N> !RefUnwindSafe for FlowConstructor<'a, N>

§

impl<'a, N> Send for FlowConstructor<'a, N>
where N: Send,

§

impl<'a, N> Sync for FlowConstructor<'a, N>
where N: Sync,

§

impl<'a, N> Unpin for FlowConstructor<'a, N>
where N: Unpin,

§

impl<'a, N> !UnwindSafe for FlowConstructor<'a, N>

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,