mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
LibWeb: Set width in compute_width_for_table_wrapper()
Width of table wrapper need to be set to to calculate width of table box inside. Otherwise TFC will set wrong width assuming width of containing block is 0.
This commit is contained in:
parent
88e060907b
commit
3a605d8c19
Notes:
sideshowbarker
2024-07-16 21:42:29 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/3a605d8c19 Pull-request: https://github.com/SerenityOS/serenity/pull/18692
31
Tests/LibWeb/Layout/expected/table/inline-table-width.txt
Normal file
31
Tests/LibWeb/Layout/expected/table/inline-table-width.txt
Normal file
@ -0,0 +1,31 @@
|
||||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
|
||||
BlockContainer <body> 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 <table> 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 <tbody> at (9,9) content-size 129.984375x38.9375 children: not-inline
|
||||
TableRowBox <tr> at (9,9) content-size 129.984375x19.46875 children: not-inline
|
||||
TableCellBox <td> 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 <td> 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 <tr> at (9,28.46875) content-size 129.984375x19.46875 children: not-inline
|
||||
TableCellBox <td> 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 <td> 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>
|
10
Tests/LibWeb/Layout/input/table/inline-table-width.html
Normal file
10
Tests/LibWeb/Layout/input/table/inline-table-width.html
Normal file
@ -0,0 +1,10 @@
|
||||
<style type="text/css">
|
||||
* {
|
||||
font-family: 'SerenitySans';
|
||||
}
|
||||
|
||||
table {
|
||||
border: 1px solid #333;
|
||||
display: inline-block;
|
||||
}
|
||||
</style><table><tr><td>ID</td><td>null</td></tr><tr><td>Is Selected</td><td>false</td></tr></table>
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user