Struct layout_2020::table::layout::TableLayout

source ·
pub(crate) struct TableLayout<'a> {
Show 15 fields table: &'a Table, pbm: PaddingBorderMargin, rows: Vec<RowLayout>, columns: Vec<ColumnLayout>, cell_measures: Vec<Vec<LogicalVec2<CellOrTrackMeasure>>>, table_width: Au, assignable_width: Au, final_table_height: Au, column_measures: Vec<CellOrTrackMeasure>, distributed_column_widths: Vec<Au>, row_sizes: Vec<Au>, row_baselines: Vec<Au>, cells_laid_out: Vec<Vec<Option<CellLayout>>>, basis_for_cell_padding_percentage: Au, collapsed_borders: Option<CollapsedBorders>,
}
Expand description

A helper struct that performs the layout of the box tree version of a table into the fragment tree version. This implements https://drafts.csswg.org/css-tables/#table-layout-algorithm

Fields§

§table: &'a Table§pbm: PaddingBorderMargin§rows: Vec<RowLayout>§columns: Vec<ColumnLayout>§cell_measures: Vec<Vec<LogicalVec2<CellOrTrackMeasure>>>§table_width: Au

The calculated width of the table, including space for the grid and also for any captions.

§assignable_width: Au

The table width minus the total horizontal border spacing (if any). This is the width that we will be able to allocate to the columns.

§final_table_height: Au§column_measures: Vec<CellOrTrackMeasure>§distributed_column_widths: Vec<Au>§row_sizes: Vec<Au>§row_baselines: Vec<Au>

The accumulated baseline of each row, relative to the top of the row.

§cells_laid_out: Vec<Vec<Option<CellLayout>>>§basis_for_cell_padding_percentage: Au§collapsed_borders: Option<CollapsedBorders>

Information about collapsed borders.

Implementations§

source§

impl<'a> TableLayout<'a>

source

fn new(table: &'a Table) -> TableLayout<'_>

source

pub(crate) fn compute_cell_measures( &mut self, layout_context: &LayoutContext<'_>, writing_mode: WritingMode, )

This is an implementation of Computing Cell Measures from https://drafts.csswg.org/css-tables/#computing-cell-measures.

source

fn compute_track_constrainedness_and_has_originating_cells( &mut self, writing_mode: WritingMode, )

Compute the constrainedness of every column in the table.

A column is constrained if its corresponding table-column-group (if any), its corresponding table-column (if any), or any of the cells spanning only that column has a computed width that is not “auto”, and is not a percentage.

source

fn compute_column_measures(&mut self, writing_mode: WritingMode)

This is an implementation of Computing Column Measures from https://drafts.csswg.org/css-tables/#computing-column-measures.

source

fn compute_content_sizes_for_columns_with_span_up_to_n( &self, n: usize, old_column_measures: &[CellOrTrackMeasure], ) -> (usize, Vec<CellOrTrackMeasure>)

source

fn compute_grid_min_max( &mut self, layout_context: &LayoutContext<'_>, writing_mode: WritingMode, ) -> ContentSizes

Compute the GRIDMIN and GRIDMAX.

source

fn compute_caption_minimum_inline_size( &self, layout_context: &LayoutContext<'_>, ) -> Au

source

fn compute_table_width( &mut self, containing_block_for_children: &ContainingBlock<'_>, containing_block_for_table: &ContainingBlock<'_>, grid_min_max: ContentSizes, caption_minimum_inline_size: Au, )

source

fn distribute_width_to_columns(&self) -> Vec<Au>

Distribute width to columns, performing step 2.4 of table layout from https://drafts.csswg.org/css-tables/#table-layout-algorithm.

source

fn distribute_extra_width_to_columns( &self, column_sizes: &mut [Au], column_sizes_sum: Au, )

This is an implementation of Distributing excess width to columns from https://drafts.csswg.org/css-tables/#distributing-width-to-columns.

source

fn layout_cells_in_row( &mut self, layout_context: &LayoutContext<'_>, containing_block_for_table: &ContainingBlock<'_>, parent_positioning_context: &mut PositioningContext, )

This is an implementation of Row layout (first pass) from https://drafts.csswg.org/css-tables/#row-layout.

source

fn do_first_row_layout(&mut self, writing_mode: WritingMode) -> Vec<Au>

Do the first layout of a table row, after laying out the cells themselves. This is more or less and implementation of https://drafts.csswg.org/css-tables/#row-layout.

source

fn calculate_row_sizes_after_first_layout( &mut self, row_sizes: &mut Vec<Au>, writing_mode: WritingMode, )

After doing layout of table rows, calculate final row size and distribute space across rowspanned cells. This follows the implementation of LayoutNG and the priority agorithm described at https://github.com/w3c/csswg-drafts/issues/4418.

source

fn distribute_extra_size_to_rows( &self, excess_size: Au, track_range: Range<usize>, track_sizes: &mut [Au], percentage_resolution_size: Option<Au>, rowspan_distribution: bool, )

An implementation of the same extra block size distribution algorithm used in LayoutNG and described at https://github.com/w3c/csswg-drafts/issues/4418.

source

fn compute_table_height_and_final_row_heights( &mut self, row_sizes: Vec<Au>, containing_block_for_children: &ContainingBlock<'_>, containing_block_for_table: &ContainingBlock<'_>, )

Given computed row sizes, compute the final block size of the table and distribute extra block size to table rows.

source

fn layout_caption( &self, caption: &TableCaption, table_pbm: &PaddingBorderMargin, layout_context: &LayoutContext<'_>, parent_positioning_context: &mut PositioningContext, ) -> BoxFragment

source

fn layout( self, layout_context: &LayoutContext<'_>, positioning_context: &mut PositioningContext, containing_block_for_children: &ContainingBlock<'_>, containing_block_for_table: &ContainingBlock<'_>, ) -> IndependentLayout

Lay out the table (grid and captions) of this TableLayout into fragments. This should only be be called after calling [TableLayout.compute_measures].

source

fn layout_grid( &mut self, layout_context: &LayoutContext<'_>, table_pbm: &PaddingBorderMargin, positioning_context: &mut PositioningContext, containing_block_for_logical_conversion: &ContainingBlock<'_>, containing_block_for_children: &ContainingBlock<'_>, containing_block_for_table: &ContainingBlock<'_>, ) -> BoxFragment

Lay out the grid portion of this TableLayout into fragments. This should only be be called after calling [TableLayout.compute_measures].

source

fn is_row_collapsed(&self, row_index: usize) -> bool

source

fn is_column_collapsed(&self, column_index: usize) -> bool

source

fn do_final_cell_layout( &mut self, row_index: usize, column_index: usize, dimensions: &TableAndTrackDimensions, baselines: &mut Baselines, row_fragment_layout: &mut RowFragmentLayout<'_>, row_group_fragment_layout: Option<&mut RowGroupFragmentLayout>, positioning_context_for_table: &mut PositioningContext, )

source

fn make_fragments_for_columns_and_column_groups( &self, dimensions: &TableAndTrackDimensions, fragments: &mut Vec<Fragment>, )

source

fn compute_border_collapse(&mut self, writing_mode: WritingMode)

source

fn get_collapsed_borders_for_cell( &self, cell: &TableSlotCell, coordinates: Point2D<usize, UnknownUnit>, ) -> Option<LogicalSides<Au>>

Auto Trait Implementations§

§

impl<'a> Freeze for TableLayout<'a>

§

impl<'a> !RefUnwindSafe for TableLayout<'a>

§

impl<'a> Send for TableLayout<'a>

§

impl<'a> Sync for TableLayout<'a>

§

impl<'a> Unpin for TableLayout<'a>

§

impl<'a> !UnwindSafe for TableLayout<'a>

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.
source§

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

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

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>,

source§

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,