Struct layout_2020::table::TableBuilder

source ·
pub struct TableBuilder {
    table: Table,
    pub incoming_rowspans: Vec<isize>,
}

Fields§

§table: Table

The table that we are building.

§incoming_rowspans: Vec<isize>

An incoming rowspan is a value indicating that a cell in a row above the current row, had a rowspan value other than 1. The values in this array indicate how many more rows the cell should span. For example, a value of 0 at an index before current_x() indicates that the cell on that column will not span into the next row, and at an index after current_x() it indicates that the cell will not span into the current row. A negative value means that the cell will span all remaining rows in the row group.

As each column in a row is processed, the values in this vector are updated for the next row.

Implementations§

source§

impl TableBuilder

source

pub(super) fn new( style: Arc<ComputedValues>, grid_style: Arc<ComputedValues>, base_fragment_info: BaseFragmentInfo, ) -> Self

source

pub fn new_for_tests() -> Self

source

pub fn last_row_index_in_row_group_at_row_n(&self, n: usize) -> usize

source

pub fn finish(self) -> Table

source

fn do_missing_cells_fixup(&mut self)

Do https://drafts.csswg.org/css-tables/#missing-cells-fixup which ensures that every row has the same number of cells.

source

fn adjust_table_geometry_for_columns_and_colgroups(&mut self)

It’s possible to define more table columns via <colgroup> and <col> elements than actually exist in the table. In that case, increase the size of the table.

However, if the table has no row nor row group, remove the extra columns instead. This matches WebKit, and some tests require it, but Gecko and Blink don’t do it.

source

fn reorder_first_thead_and_tfoot(&mut self)

Reorder the first <thead> and <tbody> to be the first and last row groups respectively. This requires fixing up all row group indices. See https://drafts.csswg.org/css-tables/#table-header-group and https://drafts.csswg.org/css-tables/#table-footer-group.

source

fn regenerate_track_ranges(&mut self)

source

fn move_row_group_to_front(&mut self, index_to_move: usize)

source

fn move_row_group_to_end(&mut self, index_to_move: usize)

source

fn do_final_rowspan_calculation(&mut self)

Turn all rowspan=0 rows into the real value to avoid having to make the calculation continually during layout. In addition, make sure that there are no rowspans that extend past the end of their row group.

source

fn current_y(&self) -> Option<usize>

source

fn current_x(&self) -> Option<usize>

source

fn current_coords(&self) -> Option<Point2D<usize, UnknownUnit>>

source

pub fn start_row(&mut self)

source

pub fn end_row(&mut self)

source

fn create_slots_for_cells_above_with_rowspan( &mut self, stop_at_cell_opportunity: bool, )

When not in the process of filling a cell, make sure any incoming rowspans are filled so that the next specified cell comes after them. Should have been called before Self::add_cell

if stop_at_cell_opportunity is set, this will stop at the first slot with incoming_rowspans equal to zero. If not, it will insert TableSlot::Empty and continue to look for more incoming rowspans (which should only be done once we’re finished processing the cells in a row, and after calling truncating cells with remaining rowspan from the end of incoming_rowspans.

source

pub fn add_cell(&mut self, cell: TableSlotCell)

https://html.spec.whatwg.org/multipage/#algorithm-for-processing-rows Push a single cell onto the slot map, handling any colspans it may have, and setting up the outgoing rowspans.

Auto Trait Implementations§

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,