mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
LibWeb: Improve auto height calculation for tables
Change `compute_auto_height_for_block_level_element` to use max height (`m_automatic_content_height` produced from TFC) for tables with auto height which is more correct behaviour than treating them like block containers.
This commit is contained in:
parent
addfa4ed58
commit
87f0e835eb
3 changed files with 8 additions and 3 deletions
|
@ -404,6 +404,9 @@ CSSPixels BlockFormattingContext::compute_auto_height_for_block_level_element(Bo
|
|||
// max-content size.
|
||||
return calculate_max_content_height(box, available_space.width);
|
||||
}
|
||||
if (display.is_table_inside()) {
|
||||
return calculate_max_content_height(box, available_space.height);
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/CSS22/visudet.html#normal-block
|
||||
// 10.6.3 Block-level non-replaced elements in normal flow when 'overflow' computes to 'visible'
|
||||
|
|
|
@ -414,7 +414,7 @@ void TableFormattingContext::calculate_row_heights(LayoutMode layout_mode)
|
|||
}
|
||||
}
|
||||
|
||||
void TableFormattingContext::position_row_boxes()
|
||||
void TableFormattingContext::position_row_boxes(CSSPixels& total_content_height)
|
||||
{
|
||||
auto const& table_state = m_state.get(table_box());
|
||||
|
||||
|
@ -456,6 +456,8 @@ void TableFormattingContext::position_row_boxes()
|
|||
|
||||
row_group_top_offset += row_group_height;
|
||||
});
|
||||
|
||||
total_content_height = max(row_top_offset, row_group_top_offset) - table_state.border_top - table_state.padding_top;
|
||||
}
|
||||
|
||||
void TableFormattingContext::position_cell_boxes()
|
||||
|
@ -520,7 +522,7 @@ void TableFormattingContext::run(Box const& box, LayoutMode layout_mode, Availab
|
|||
distribute_width_to_columns();
|
||||
|
||||
calculate_row_heights(layout_mode);
|
||||
position_row_boxes();
|
||||
position_row_boxes(total_content_height);
|
||||
position_cell_boxes();
|
||||
|
||||
m_state.get_mutable(table_box()).set_content_height(total_content_height);
|
||||
|
|
|
@ -33,7 +33,7 @@ private:
|
|||
void distribute_width_to_columns();
|
||||
void determine_intrisic_size_of_table_container(AvailableSpace const& available_space);
|
||||
void calculate_row_heights(LayoutMode layout_mode);
|
||||
void position_row_boxes();
|
||||
void position_row_boxes(CSSPixels&);
|
||||
void position_cell_boxes();
|
||||
|
||||
CSSPixels m_automatic_content_height { 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue