at (10,17.734375) content-size 43.21875x7.734375 table-row children: not-inline
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
+ BlockContainer at (11,23.601562) content-size 0x0 table-cell [BFC] children: not-inline
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
diff --git a/Tests/LibWeb/Layout/input/table/row-outer-size-with-computed-size.html b/Tests/LibWeb/Layout/input/table/row-outer-size-with-computed-size.html
new file mode 100644
index 0000000000..d819e4c366
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/table/row-outer-size-with-computed-size.html
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
index faeac19786..992fb1c9bc 100644
--- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
@@ -223,17 +223,45 @@ void TableFormattingContext::compute_cell_measures(AvailableSpace const& availab
}
}
+template<>
+void TableFormattingContext::initialize_table_measures()
+{
+ auto const& containing_block = m_state.get(*table_wrapper().containing_block());
+
+ for (auto& cell : m_cells) {
+ auto const& computed_values = cell.box->computed_values();
+ if (cell.row_span == 1) {
+ // FIXME: Implement intrinsic percentage width of a column based on cells of span up to 1.
+ auto specified_height = m_rows[cell.row_index].type == SizeType::Pixel
+ ? computed_values.height().to_px(cell.box, containing_block.content_height())
+ : 0;
+ // https://www.w3.org/TR/css-tables-3/#row-layout makes specified cell height part of the initialization formula for row table measures:
+ // This is done by running the same algorithm as the column measurement, with the span=1 value being initialized (for min-content) with
+ // the largest of the resulting height of the previous row layout, the height specified on the corresponding table-row (if any), and
+ // the largest height specified on cells that span this row only (the algorithm starts by considering cells of span 2 on top of that assignment).
+ m_rows[cell.row_index].min_size = max(m_rows[cell.row_index].min_size, max(cell.min_height, specified_height));
+ m_rows[cell.row_index].max_size = max(m_rows[cell.row_index].max_size, cell.max_height);
+ }
+ }
+}
+
+template<>
+void TableFormattingContext::initialize_table_measures()
+{
+ for (auto& cell : m_cells) {
+ if (cell.column_span == 1) {
+ m_columns[cell.column_index].min_size = max(m_columns[cell.column_index].min_size, cell.min_width);
+ m_columns[cell.column_index].max_size = max(m_columns[cell.column_index].max_size, cell.max_width);
+ }
+ }
+}
+
template
void TableFormattingContext::compute_table_measures()
{
+ initialize_table_measures();
+
auto& rows_or_columns = table_rows_or_columns();
- for (auto& cell : m_cells) {
- if (cell_span(cell) == 1) {
- auto rc_index = cell_index(cell);
- rows_or_columns[rc_index].min_size = max(rows_or_columns[rc_index].min_size, cell_min_size(cell));
- rows_or_columns[rc_index].max_size = max(rows_or_columns[rc_index].max_size, cell_max_size(cell));
- }
- }
size_t max_cell_span = 1;
for (auto& cell : m_cells) {
diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
index 6d998e874c..58ffbff19f 100644
--- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
+++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
@@ -38,6 +38,8 @@ private:
void calculate_row_column_grid(Box const&);
void compute_cell_measures(AvailableSpace const& available_space);
template
+ void initialize_table_measures();
+ template
void compute_table_measures();
void compute_table_width();
void distribute_width_to_columns();
|