mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibWeb: Use max-width property in table formatting
This commit is contained in:
parent
1440845aad
commit
c839c51b0b
Notes:
sideshowbarker
2024-07-17 03:30:41 +09:00
Author: https://github.com/martinfalisse Commit: https://github.com/SerenityOS/serenity/commit/c839c51b0b Pull-request: https://github.com/SerenityOS/serenity/pull/18195
3 changed files with 35 additions and 0 deletions
16
Tests/LibWeb/Layout/expected/table/size.txt
Normal file
16
Tests/LibWeb/Layout/expected/table/size.txt
Normal file
|
@ -0,0 +1,16 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x33.46875 children: not-inline
|
||||
BlockContainer <body> at (8,8) content-size 784x17.46875 children: not-inline
|
||||
TableWrapper <(anonymous)> at (350,8) content-size 100x17.46875 children: not-inline
|
||||
TableBox <div> at (350,8) content-size 100x17.46875 children: not-inline
|
||||
TableRowBox <(anonymous)> at (350,8) content-size 100x17.46875 children: not-inline
|
||||
TableCellBox <(anonymous)> at (350,8) content-size 100x17.46875 children: not-inline
|
||||
BlockContainer <(anonymous)> at (350,8) content-size 100x0 children: inline
|
||||
TextNode <#text>
|
||||
BlockContainer <div> at (350,8) content-size 2000x17.46875 children: inline
|
||||
line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||
frag 0 from TextNode start: 0, length: 1, rect: [350,8 6.34375x17.46875]
|
||||
"1"
|
||||
TextNode <#text>
|
||||
BlockContainer <(anonymous)> at (350,25.46875) content-size 100x0 children: inline
|
||||
TextNode <#text>
|
17
Tests/LibWeb/Layout/input/table/size.html
Normal file
17
Tests/LibWeb/Layout/input/table/size.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<style>
|
||||
* {
|
||||
font-family: 'SerenitySans';
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Should be container-like, with margins on either side and middle aligned -->
|
||||
<div style="
|
||||
display: table;
|
||||
max-width: 100px;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
table-layout: fixed;
|
||||
background-color: lightblue;
|
||||
">
|
||||
<div style="width: 2000px">1</div>
|
||||
</div>
|
|
@ -246,6 +246,8 @@ void TableFormattingContext::compute_table_width()
|
|||
// of resolved-table-width, and the used min-width of the table.
|
||||
CSSPixels resolved_table_width = computed_values.width().resolved(table_box(), CSS::Length::make_px(width_of_table_containing_block)).to_px(table_box());
|
||||
used_width = max(resolved_table_width, used_min_width);
|
||||
if (!computed_values.max_width().is_none())
|
||||
used_width = min(used_width, computed_values.max_width().resolved(table_box(), CSS::Length::make_px(width_of_table_containing_block)).to_px(table_box()));
|
||||
table_box_state.set_content_width(used_width);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue