Truly independent web browser
LibWeb: Size absolutely positioned table wrappers around their table
Andreas Kling3ce98abfaa1a
diff --git a/Libraries/LibWeb/Rust/src/layout/abspos_engine.rs b/Libraries/LibWeb/Rust/src/layout/abspos_engine.rsindex 27de2680842..5c3cd3698a7 100644--- a/Libraries/LibWeb/Rust/src/layout/abspos_engine.rs+++ b/Libraries/LibWeb/Rust/src/layout/abspos_engine.rs@@ -2042,7 +2042,7 @@ impl AbsposEngine<'_> {available_space,constraints,None,- formatting_context::TableWrapperInlineSizeMode::ClampToAvailableInlineSize,+ formatting_context::TableWrapperInlineSizeMode::UseTableUsedInlineSize,).0} else if !style.width().is_auto() {@@ -2275,7 +2275,12 @@ impl AbsposEngine<'_> {)};let block_size = if self.facts(sized.node).is_table_wrapper() {- Some(sizing.compute_table_box_block_size_inside_wrapper(sized.sized_box(), available_space, constraints))+ // NB: The wrapper holds the captions as well as the table box.+ Some(+ sizing+ .measure_table_box_block_size_inside_wrapper(sized.sized_box(), available_space, constraints)+ .wrapper_content_block_size,+ )} else if !sizing.should_treat_block_size_as_auto(sized.sized_box(), available_space, constraints) {Some(inner_size(style.height()))} else if !self.sizes_to_fit_content(sized, equation, false) {diff --git a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/formatting_context.rsindex 68224ad0dcc..d78adefcdb1 100644--- a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs@@ -100,6 +100,9 @@ pub(super) enum SizeDimension {pub(crate) enum TableWrapperInlineSizeMode {ClampToAvailableInlineSize,UseTableUsedInlineSizeIfNotAuto,+ /// The wrapper is as wide as the table box, even when that's wider than the available inline size, as for an+ /// absolutely positioned table.+ UseTableUsedInlineSize,}/// What a layout run lays out for.diff --git a/Libraries/LibWeb/Rust/src/layout/sizing_context.rs b/Libraries/LibWeb/Rust/src/layout/sizing_context.rsindex 41bf1a0b5e1..8c9841680b4 100644--- a/Libraries/LibWeb/Rust/src/layout/sizing_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/sizing_context.rs@@ -3992,8 +3992,10 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {let table_used_inline_size =table_used.border_box_inline_size(table_used.uses_collapsing_borders_model());let inline_size = if table_wrapper_inline_size_mode- == formatting_context::TableWrapperInlineSizeMode::UseTableUsedInlineSizeIfNotAuto- && !self.style(table_run.box_).width().is_auto()+ == formatting_context::TableWrapperInlineSizeMode::UseTableUsedInlineSize+ || (table_wrapper_inline_size_mode+ == formatting_context::TableWrapperInlineSizeMode::UseTableUsedInlineSizeIfNotAuto+ && !self.style(table_run.box_).width().is_auto()){table_used_inline_size} else if matches!(available_space.inline_size, AvailableSize::Definite(_)) {@@ -4052,16 +4054,6 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {// 17.5.3 Table height algorithms// https://www.w3.org/TR/CSS22/tables.html#height-layout- pub(crate) fn compute_table_box_block_size_inside_wrapper(- &self,- sized: SizedBox<'_>,- available_space: AvailableSpace,- table_wrapper_constraints: ContainingBlockConstraints,- ) -> CssPixels {- self.measure_table_box_block_size_inside_wrapper(sized, available_space, table_wrapper_constraints)- .table_box_border_box_block_size- }-pub(crate) fn measure_table_box_block_size_inside_wrapper(&self,sized: SizedBox<'_>,diff --git a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/out-of-flow/absolutely-positioned-002.txt b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/out-of-flow/absolutely-positioned-002.txtindex da643bec5dd..df40ecb5443 100644--- a/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/out-of-flow/absolutely-positioned-002.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/mathml/relations/css-styling/out-of-flow/absolutely-positioned-002.txt@@ -2,8 +2,7 @@ Harness status: OKFound 26 tests-25 Pass-1 Fail+26 PassPass position: absolute on <a> element itselfPass position: absolute on <maction> element itselfPass position: absolute on <menclose> element itself@@ -25,7 +24,7 @@ Pass position: absolute on <mstyle> element itselfPass position: absolute on <msub> element itselfPass position: absolute on <msubsup> element itselfPass position: absolute on <msup> element itself-Fail position: absolute on <mtable> element itself+Pass position: absolute on <mtable> element itselfPass position: absolute on <mtext> element itselfPass position: absolute on <munder> element itselfPass position: absolute on <munderover> element itself