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
impl TableBuilder
pub(super) fn new( style: Arc<ComputedValues>, grid_style: Arc<ComputedValues>, base_fragment_info: BaseFragmentInfo, ) -> Self
pub fn new_for_tests() -> Self
pub fn last_row_index_in_row_group_at_row_n(&self, n: usize) -> usize
pub fn finish(self) -> Table
sourcefn do_missing_cells_fixup(&mut self)
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.
sourcefn adjust_table_geometry_for_columns_and_colgroups(&mut self)
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.
sourcefn reorder_first_thead_and_tfoot(&mut self)
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.
fn regenerate_track_ranges(&mut self)
fn move_row_group_to_front(&mut self, index_to_move: usize)
fn move_row_group_to_end(&mut self, index_to_move: usize)
sourcefn do_final_rowspan_calculation(&mut self)
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.
fn current_y(&self) -> usize
fn current_x(&self) -> usize
fn current_coords(&self) -> Point2D<usize, UnknownUnit>
pub fn start_row(&mut self)
pub fn end_row(&mut self)
sourcefn create_slots_for_cells_above_with_rowspan(
&mut self,
stop_at_cell_opportunity: bool,
)
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
.
sourcepub fn add_cell(&mut self, cell: TableSlotCell)
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§
impl Freeze for TableBuilder
impl !RefUnwindSafe for TableBuilder
impl Send for TableBuilder
impl Sync for TableBuilder
impl Unpin for TableBuilder
impl !UnwindSafe for TableBuilder
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