layout: Add *very* basic support for table layout (#31121)

* layout: Add *very* basic support for table layout

This is the first step to proper table layout. It implements a naive
layout algorithm, notably only taking into account the preferred widths
of the first table row. Still, it causes some float tests to start
passing, so turn on the `layout.tables.enabled` preference for those
directories.

Co-authored-by: Oriol Brufau <obrufau@igalia.com>

* Address review comments

* Fix a crash with rowspan=0

* Turn on pref and update results for `/css/css-tables` and `/css/CSS2/tables`

---------

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Martin Robinson 2024-01-19 14:20:20 +01:00 committed by GitHub
parent 3d520f2668
commit fc31e69f79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
115 changed files with 842 additions and 315 deletions

View file

@ -155,7 +155,7 @@ impl IndependentFormattingContext {
}
}
pub fn inline_content_sizes(&self, layout_context: &LayoutContext) -> ContentSizes {
pub fn inline_content_sizes(&mut self, layout_context: &LayoutContext) -> ContentSizes {
match self {
Self::NonReplaced(inner) => inner
.contents
@ -173,7 +173,7 @@ impl IndependentFormattingContext {
Self::NonReplaced(non_replaced) => {
let style = &non_replaced.style;
let content_sizes = &mut non_replaced.content_sizes;
let contents = &non_replaced.contents;
let contents = &mut non_replaced.contents;
sizing::outer_inline(&style, containing_block_writing_mode, || {
content_sizes
.get_or_insert_with(|| {
@ -213,7 +213,7 @@ impl NonReplacedFormattingContext {
pub fn inline_content_sizes(&mut self, layout_context: &LayoutContext) -> ContentSizes {
let writing_mode = self.style.writing_mode;
let contents = &self.contents;
let contents = &mut self.contents;
self.content_sizes
.get_or_insert_with(|| contents.inline_content_sizes(layout_context, writing_mode))
.clone()
@ -222,7 +222,7 @@ impl NonReplacedFormattingContext {
impl NonReplacedFormattingContextContents {
pub fn inline_content_sizes(
&self,
&mut self,
layout_context: &LayoutContext,
writing_mode: WritingMode,
) -> ContentSizes {
@ -231,7 +231,7 @@ impl NonReplacedFormattingContextContents {
.contents
.inline_content_sizes(layout_context, writing_mode),
Self::Flex(inner) => inner.inline_content_sizes(),
Self::Table(table) => table.inline_content_sizes(),
Self::Table(table) => table.inline_content_sizes(layout_context, writing_mode),
}
}
}