Truly independent web browser
LibWeb: Give percentage-width fixed tables a large max-content size
Andreas Klingccadf944d59d
diff --git a/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rsindex a19b1f25335..685644eb8d3 100644--- a/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs@@ -2533,6 +2533,17 @@ impl<'pass> TableFormattingContext<'pass> {capmin,} = measures;let table_style = self.style(self.run.box_);+ // INTEROP: A table laid out in fixed mode with a percentage width fills whatever inline size its container+ // offers, so it has an infinite max-content inline size, capped at a large value.+ const TABLE_MAX_INLINE_SIZE: i64 = 1_000_000;+ let max_content_inline_size = if self.use_fixed_mode_layout()+ && table_style.width().is_length_percentage()+ && table_style.width().contains_percentage()+ {+ CssPixels::from_integer(TABLE_MAX_INLINE_SIZE)+ } else {+ grid_max+ };// Percentages on 'width' and 'height' on the table are relative to the table wrapper box's containing block,// not the table wrapper box itself.let basis = self.table_constraints.inline_basis();@@ -2552,13 +2563,13 @@ impl<'pass> TableFormattingContext<'pass> {// wrapper consistent without reading the wrapper's state from here.let mut value = match available_inline {AvailableSize::MinContent => grid_min,- AvailableSize::MaxContent => grid_max,+ AvailableSize::MaxContent => max_content_inline_size,AvailableSize::Definite(available)if self.auto_table_inline_size == AutoTableInlineSize::FillsAvailableInlineSize =>{available.max(used_min)}- AvailableSize::Definite(available) => grid_max.min(available).max(used_min),+ AvailableSize::Definite(available) => max_content_inline_size.min(available).max(used_min),AvailableSize::Indefinite => grid_max.max(used_min),};if !matches!(available_inline, AvailableSize::MinContent | AvailableSize::MaxContent) {diff --git a/Tests/LibWeb/Layout/expected/table/fixed-layout-percentage-width-in-flex-item.txt b/Tests/LibWeb/Layout/expected/table/fixed-layout-percentage-width-in-flex-item.txtindex 6d4b50378ce..a5ca3e4a6f9 100644--- a/Tests/LibWeb/Layout/expected/table/fixed-layout-percentage-width-in-flex-item.txt+++ b/Tests/LibWeb/Layout/expected/table/fixed-layout-percentage-width-in-flex-item.txt@@ -1,60 +1,36 @@Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 240 0+0+0] [BFC] children: not-inline- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 224 0+0+8] children: not-inline- Box <div.flex> at [8,8] flex-container(row) [0+0+0 400 0+0+384] [0+0+0 112 0+0+0] [FFC] children: not-inline- BlockContainer <div> at [8,8] flex-item [0+0+0 0 0+0+0] [0+0+0 112 0+0+0] [BFC] children: not-inline- TableWrapper <(anonymous)> at [8,8] [0+0+0 0 0+0+0] [0+0+0 112 0+0+0] [BFC] children: not-inline- Box <div.table> at [8,8] table-box [0+0+0 0 0+0+0] [0+0+0 112 0+0+0] [TFC] children: not-inline- Box <(anonymous)> at [8,8] table-row [0+0+0 0 0+0+0] [0+0+0 112 0+0+0] children: not-inline- BlockContainer <(anonymous)> at [8,8] table-cell [0+0+0 0 0+0+0] [0+0+0 112 0+0+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 1, rect: [8,8 10.3125x16] baseline: 12.796875- "C"- frag 1 from TextNode start: 1, length: 1, rect: [8,24 8.71875x16] baseline: 12.796875- "e"- frag 2 from TextNode start: 2, length: 1, rect: [8,40 8.828125x16] baseline: 12.796875- "r"- frag 3 from TextNode start: 3, length: 1, rect: [8,56 9.34375x16] baseline: 12.796875- "a"- frag 4 from TextNode start: 4, length: 1, rect: [8,72 12.203125x16] baseline: 12.796875- "m"- frag 5 from TextNode start: 5, length: 1, rect: [8,88 4.5625x16] baseline: 12.796875- "i"- frag 6 from TextNode start: 6, length: 1, rect: [8,104 8.890625x16] baseline: 12.796875- "c"+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 48 0+0+0] [BFC] children: not-inline+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 32 0+0+8] children: not-inline+ Box <div.flex> at [8,8] flex-container(row) [0+0+0 400 0+0+384] [0+0+0 16 0+0+0] [FFC] children: not-inline+ BlockContainer <div> at [8,8] flex-item [0+0+0 358.03125 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline+ TableWrapper <(anonymous)> at [8,8] [0+0+0 358.03125 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline+ Box <div.table> at [8,8] table-box [0+0+0 358.03125 0+0+0] [0+0+0 16 0+0+0] [TFC] children: not-inline+ Box <(anonymous)> at [8,8] table-row [0+0+0 358.03125 0+0+0] [0+0+0 16 0+0+0] children: not-inline+ BlockContainer <(anonymous)> at [8,8] table-cell [0+0+0 358.03125 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline+ frag 0 from TextNode start: 0, length: 7, rect: [8,8 62.859375x16] baseline: 12.796875+ "Ceramic"TextNode <#text> (not painted)- BlockContainer <div> at [8,8] flex-item [0+0+0 41.96875 0+0+0] [0+0+0 112 0+0+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 5, rect: [8,8 41.96875x16] baseline: 12.796875+ BlockContainer <div> at [366.03125,8] flex-item [0+0+0 41.96875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline+ frag 0 from TextNode start: 0, length: 5, rect: [366.03125,8 41.96875x16] baseline: 12.796875"Right"TextNode <#text> (not painted)- BlockContainer <(anonymous)> at [8,120] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline+ BlockContainer <(anonymous)> at [8,24] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inlineTextNode <#text> (not painted)- Box <div.flex> at [8,120] flex-container(row) [0+0+0 400 0+0+384] [0+0+0 112 0+0+0] [FFC] children: not-inline- BlockContainer <div> at [8,120] flex-item [0+0+0 0 0+0+0] [0+0+0 112 0+0+0] [BFC] children: not-inline- TableWrapper <(anonymous)> at [8,120] [0+0+0 0 0+0+0] [0+0+0 112 0+0+0] [BFC] children: not-inline- Box <div.table> at [8,120] table-box [0+0+0 0 0+0+0] [0+0+0 112 0+0+0] [TFC] children: not-inline- Box <(anonymous)> at [8,120] table-row [0+0+0 0 0+0+0] [0+0+0 112 0+0+0] children: not-inline- BlockContainer <(anonymous)> at [8,120] table-cell [0+0+0 0 0+0+0] [0+0+0 112 0+0+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 1, rect: [8,120 10.3125x16] baseline: 12.796875- "C"- frag 1 from TextNode start: 1, length: 1, rect: [8,136 8.71875x16] baseline: 12.796875- "e"- frag 2 from TextNode start: 2, length: 1, rect: [8,152 8.828125x16] baseline: 12.796875- "r"- frag 3 from TextNode start: 3, length: 1, rect: [8,168 9.34375x16] baseline: 12.796875- "a"- frag 4 from TextNode start: 4, length: 1, rect: [8,184 12.203125x16] baseline: 12.796875- "m"- frag 5 from TextNode start: 5, length: 1, rect: [8,200 4.5625x16] baseline: 12.796875- "i"- frag 6 from TextNode start: 6, length: 1, rect: [8,216 8.890625x16] baseline: 12.796875- "c"+ Box <div.flex> at [8,24] flex-container(row) [0+0+0 400 0+0+384] [0+0+0 16 0+0+0] [FFC] children: not-inline+ BlockContainer <div> at [8,24] flex-item [0+0+0 200 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline+ TableWrapper <(anonymous)> at [8,24] [0+0+0 200 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline+ Box <div.table> at [8,24] table-box [0+0+0 200 0+0+0] [0+0+0 16 0+0+0] [TFC] children: not-inline+ Box <(anonymous)> at [8,24] table-row [0+0+0 200 0+0+0] [0+0+0 16 0+0+0] children: not-inline+ BlockContainer <(anonymous)> at [8,24] table-cell [0+0+0 200 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline+ frag 0 from TextNode start: 0, length: 7, rect: [8,24 62.859375x16] baseline: 12.796875+ "Ceramic"TextNode <#text> (not painted)- BlockContainer <div> at [8,120] flex-item [0+0+0 41.96875 0+0+0] [0+0+0 112 0+0+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 5, rect: [8,120 41.96875x16] baseline: 12.796875+ BlockContainer <div> at [208,24] flex-item [0+0+0 41.96875 0+0+0] [0+0+0 16 0+0+0] [BFC] children: inline+ frag 0 from TextNode start: 0, length: 5, rect: [208,24 41.96875x16] baseline: 12.796875"Right"TextNode <#text> (not painted)- BlockContainer <(anonymous)> at [8,232] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline+ BlockContainer <(anonymous)> at [8,40] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inlineTextNode <#text> (not painted)SC for Viewport<#document> [0,0 800x600] (z-index: auto)- SC for BlockContainer<HTML> [0,0 800x240] (z-index: auto)+ SC for BlockContainer<HTML> [0,0 800x48] (z-index: auto)diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/intrinsic-size/row-compat-001.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/intrinsic-size/row-compat-001.txtindex 716d82a3527..a7904e2ea6f 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/intrinsic-size/row-compat-001.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/intrinsic-size/row-compat-001.txt@@ -2,8 +2,7 @@ Harness status: OKFound 3 tests-2 Pass-1 Fail+3 PassPass #wrapping-broke .flex 1Pass #bug1454306 2-Fail #gmail-tables .flex 3\ No newline at end of file+Pass #gmail-tables .flex 3\ No newline at end of file