diff --git a/Tests/LibWeb/Layout/expected/table/inline-table-width.txt b/Tests/LibWeb/Layout/expected/table/inline-table-width.txt new file mode 100644 index 00000000000..bb647a77b93 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/table/inline-table-width.txt @@ -0,0 +1,31 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline + BlockContainer at (8,8) content-size 784x40.9375 children: inline + line 0 width: 131.984375, height: 40.9375, bottom: 40.9375, baseline: 35 + frag 0 from BlockContainer start: 0, length: 0, rect: [9,9 129.984375x38.9375] + BlockContainer at (9,9) content-size 129.984375x38.9375 inline-block [BFC] children: not-inline + TableWrapper <(anonymous)> at (9,9) content-size 129.984375x38.9375 inline-block [BFC] children: not-inline + TableBox <(anonymous)> at (9,9) content-size 129.984375x38.9375 inline-table [TFC] children: not-inline + TableRowGroupBox at (9,9) content-size 129.984375x38.9375 children: not-inline + TableRowBox at (9,9) content-size 129.984375x19.46875 children: not-inline + TableCellBox at (9,28.46875) content-size 129.984375x19.46875 children: not-inline + TableCellBox
at (10,10) content-size 87.90625x17.46875 [BFC] children: inline + line 0 width: 15.734375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 2, rect: [10,10 15.734375x17.46875] + "ID" + TextNode <#text> + TableCellBox at (99.90625,10) content-size 38.078125x17.46875 [BFC] children: inline + line 0 width: 27.84375, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 4, rect: [99.90625,10 27.84375x17.46875] + "null" + TextNode <#text> + TableRowBox
at (10,29.46875) content-size 87.90625x17.46875 [BFC] children: inline + line 0 width: 87.90625, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 11, rect: [10,29.46875 87.90625x17.46875] + "Is Selected" + TextNode <#text> + TableCellBox at (99.90625,29.46875) content-size 38.078125x17.46875 [BFC] children: inline + line 0 width: 38.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125 + frag 0 from TextNode start: 0, length: 5, rect: [99.90625,29.46875 38.078125x17.46875] + "false" + TextNode <#text> diff --git a/Tests/LibWeb/Layout/input/table/inline-table-width.html b/Tests/LibWeb/Layout/input/table/inline-table-width.html new file mode 100644 index 00000000000..b7d823af960 --- /dev/null +++ b/Tests/LibWeb/Layout/input/table/inline-table-width.html @@ -0,0 +1,10 @@ +
IDnull
Is Selectedfalse
\ No newline at end of file diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index a2af813cde0..edc9d6b37c0 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -375,6 +375,7 @@ CSSPixels BlockFormattingContext::compute_width_for_table_wrapper(Box const& box auto available_width = width_of_containing_block - margin_left.to_px(box) - margin_right.to_px(box); LayoutState throwaway_state(&m_state); + throwaway_state.get_mutable(box).set_content_width(available_width); auto context = create_independent_formatting_context_if_needed(throwaway_state, box); VERIFY(context); context->run(box, LayoutMode::IntrinsicSizing, m_state.get(box).available_inner_space_or_constraints_from(available_space));