Module layout_2013::flow
source · Expand description
Servo’s experimental layout system builds a tree of Flow
and Fragment
objects and solves
layout constraints to obtain positions and display attributes of tree nodes. Positions are
computed in several tree traversals driven by the fundamental data dependencies required by
inline and block layout.
Flows are interior nodes in the layout tree and correspond closely to flow contexts in the CSS specification. Flows are responsible for positioning their child flow contexts and fragments. Flows have purpose-specific fields, such as auxiliary line structs, out-of-flow child lists, and so on.
Currently, the important types of flows are:
-
BlockFlow
: A flow that establishes a block context. It has several child flows, each of which are positioned according to block formatting context rules (CSS block boxes). Block flows also contain a single box to represent their rendered borders, padding, etc. The BlockFlow at the root of the tree has special behavior: it stretches to the boundaries of the viewport. -
InlineFlow
: A flow that establishes an inline context. It has a flat list of child fragments/flows that are subject to inline layout and line breaking and structs to represent line breaks and mapping to CSS boxes, for the purpose of handlinggetClientRects()
and similar methods.
Structs§
- Information about each absolutely-positioned descendant of the given flow.
- Absolutely-positioned descendants of this flow.
- Data common to all flows.
- A link to a flow’s containing block.
- Information needed to compute absolute (i.e. viewport-relative) flow positions (not to be confused with absolutely-positioned flows) that is computed during block-size assignment.
- Flags used in flows.
- Information needed to compute absolute (i.e. viewport-relative) flow positions (not to be confused with absolutely-positioned flows) that is computed during final position assignment.
- A wrapper for the pointer address of a flow. These pointer addresses may only be compared for equality with other such pointer addresses, never dereferenced.
Enums§
- Whether a base flow should be forced to be nonfloated. This can affect e.g.
TableFlow
, which is never floated because the table wrapper flow is the floated one.
Traits§
- Virtual methods that make up a float context.
- Methods to get the
BaseFlow
from anyHasBaseFlow
type. - This marker trait indicates that a type is a struct with
#[repr(C)]
whose first field is of typeBaseFlow
or some type that also implements this trait.