Struct layout_2020::table::Table
source · pub struct Table {
style: Arc<ComputedValues>,
grid_style: Arc<ComputedValues>,
grid_base_fragment_info: BaseFragmentInfo,
pub captions: Vec<TableCaption>,
pub column_groups: Vec<TableTrackGroup>,
pub columns: Vec<TableTrack>,
pub row_groups: Vec<TableTrackGroup>,
pub rows: Vec<TableTrack>,
pub slots: Vec<Vec<TableSlot>>,
pub size: TableSize,
anonymous: bool,
}
Fields§
§style: Arc<ComputedValues>
The style of this table. These are the properties that apply to the “wrapper” ie the element that contains both the grid and the captions. Not all properties are actually used on the wrapper though, such as background and borders, which apply to the grid.
grid_style: Arc<ComputedValues>
The style of this table’s grid. This is an anonymous style based on the table’s style, but eliminating all the properties handled by the “wrapper.”
grid_base_fragment_info: BaseFragmentInfo
The BaseFragmentInfo
for this table’s grid. This is necessary so that when the
grid has a background image, it can be associated with the table’s node.
The captions for this table.
column_groups: Vec<TableTrackGroup>
The column groups for this table.
columns: Vec<TableTrack>
The columns of this table defined by <colgroup> | display: table-column-group
and <col> | display: table-column
elements as well as display: table-column
.
row_groups: Vec<TableTrackGroup>
The rows groups for this table defined by <tbody>
, <thead>
, and <tfoot>
.
rows: Vec<TableTrack>
The rows of this table defined by <tr>
or display: table-row
elements.
slots: Vec<Vec<TableSlot>>
The content of the slots of this table.
size: TableSize
The size of this table.
anonymous: bool
Whether or not this Table is anonymous.
Implementations§
source§impl Table
impl Table
pub(crate) fn construct<'dom>( context: &LayoutContext<'_>, info: &NodeAndStyleInfo<impl NodeExt<'dom>>, grid_style: Arc<ComputedValues>, contents: NonReplacedContents, propagated_text_decoration_line: TextDecorationLine, ) -> Self
pub(crate) fn construct_anonymous<'dom, Node>(
context: &LayoutContext<'_>,
parent_info: &NodeAndStyleInfo<Node>,
contents: Vec<AnonymousTableContent<'dom, Node>>,
propagated_text_decoration_line: TextDecorationLine,
) -> IndependentFormattingContextwhere
Node: NodeExt<'dom>,
sourcefn push_new_slot_to_last_row(&mut self, slot: TableSlot)
fn push_new_slot_to_last_row(&mut self, slot: TableSlot)
Push a new slot into the last row of this table.
sourcepub(super) fn resolve_slot_at(
&self,
coords: Point2D<usize, UnknownUnit>,
) -> Vec<ResolvedSlotAndLocation<'_>>
pub(super) fn resolve_slot_at( &self, coords: Point2D<usize, UnknownUnit>, ) -> Vec<ResolvedSlotAndLocation<'_>>
Find ResolvedSlotAndLocation
of all the slots that cover the slot at the given
coordinates. This recursively resolves all of the TableSlotCell
s that cover
the target and returns a ResolvedSlotAndLocation
for each of them. If there is
no slot at the given coordinates or that slot is an empty space, an empty vector
is returned.
sourcefn create_spanned_slot_based_on_cell_above(
&self,
target_coords: Point2D<usize, UnknownUnit>,
) -> Option<TableSlot>
fn create_spanned_slot_based_on_cell_above( &self, target_coords: Point2D<usize, UnknownUnit>, ) -> Option<TableSlot>
Create a TableSlot::Spanned
for the target cell at the given coordinates. If
no slots cover the target, then this returns None
. Note: This does not handle
slots that cover the target using colspan
, but instead only considers slots that
cover this slot via rowspan
. colspan
should be handled by appending to the
return value of this function.
source§impl Table
impl Table
fn border_spacing(&self) -> LogicalVec2<Au>
fn total_border_spacing(&self) -> LogicalVec2<Au>
fn get_column_measure_for_column_at_index( &self, writing_mode: WritingMode, column_index: usize, ) -> CellOrTrackMeasure
fn get_row_measure_for_row_at_index( &self, writing_mode: WritingMode, row_index: usize, ) -> CellOrTrackMeasure
pub(crate) fn layout( &self, layout_context: &LayoutContext<'_>, positioning_context: &mut PositioningContext, containing_block_for_children: &ContainingBlock<'_>, containing_block_for_table: &ContainingBlock<'_>, ) -> IndependentLayout
source§impl Table
impl Table
pub(crate) fn new( style: Arc<ComputedValues>, grid_style: Arc<ComputedValues>, base_fragment_info: BaseFragmentInfo, ) -> Self
sourcefn get_slot(&self, coords: Point2D<usize, UnknownUnit>) -> Option<&TableSlot>
fn get_slot(&self, coords: Point2D<usize, UnknownUnit>) -> Option<&TableSlot>
Return the slot at the given coordinates, if it exists in the table, otherwise return None.
fn resolve_first_cell_coords( &self, coords: Point2D<usize, UnknownUnit>, ) -> Option<Point2D<usize, UnknownUnit>>
fn resolve_first_cell( &self, coords: Point2D<usize, UnknownUnit>, ) -> Option<&TableSlotCell>
Trait Implementations§
source§impl ComputeInlineContentSizes for Table
impl ComputeInlineContentSizes for Table
fn compute_inline_content_sizes( &self, layout_context: &LayoutContext<'_>, constraint_space: &ConstraintSpace, ) -> InlineContentSizesResult
Auto Trait Implementations§
impl Freeze for Table
impl !RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl !UnwindSafe for Table
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