mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 07:41:01 +00:00
LibWeb: Improve adjustment of automatic table width with percentages
Use the max-width of percentage cells instead of min-width as the reference to be used to compute the total table width. The specification only suggests that the UA should try to satisfy percentage constraints and this behavior is more consistent with other browsers.
This commit is contained in:
parent
d32bf4cd41
commit
7b0b501418
Notes:
sideshowbarker
2024-07-17 07:43:44 +09:00
Author: https://github.com/axgallo
Commit: 7b0b501418
Pull-request: https://github.com/SerenityOS/serenity/pull/20376
5 changed files with 99 additions and 34 deletions
|
@ -598,7 +598,7 @@ void TableFormattingContext::compute_table_width()
|
|||
for (auto& cell : m_cells) {
|
||||
auto const& cell_width = cell.box->computed_values().width();
|
||||
if (cell_width.is_percentage()) {
|
||||
adjusted_used_width = 100 / cell_width.percentage().value() * cell.outer_min_width;
|
||||
adjusted_used_width = ceil(100 / cell_width.percentage().value() * cell.outer_max_width.to_double());
|
||||
used_width = min(max(used_width, adjusted_used_width), width_of_table_containing_block);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue