mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Skip cells layout in table box width calculation
There is no need to run full table layout if we are only interested in calculating its width. This change reduces compute_table_box_width_inside_table_wrapper() from ~30% to ~15% in profiles of "File changed" pages on github.
This commit is contained in:
parent
541161d5e0
commit
6fc59039c4
Notes:
sideshowbarker
2024-07-17 03:10:07 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 6fc59039c4
Pull-request: https://github.com/SerenityOS/serenity/pull/23627
3 changed files with 23 additions and 9 deletions
|
@ -1577,12 +1577,10 @@ void TableFormattingContext::finish_grid_initialization(TableGrid const& table_g
|
|||
}
|
||||
}
|
||||
|
||||
void TableFormattingContext::run(Box const& box, LayoutMode layout_mode, AvailableSpace const& available_space)
|
||||
void TableFormattingContext::run_until_width_calculation(Box const& box, AvailableSpace const& available_space)
|
||||
{
|
||||
m_available_space = available_space;
|
||||
|
||||
auto total_captions_height = run_caption_layout(layout_mode, CSS::CaptionSide::Top);
|
||||
|
||||
// Determine the number of rows/columns the table requires.
|
||||
finish_grid_initialization(TableGrid::calculate_row_column_grid(box, m_cells, m_rows));
|
||||
|
||||
|
@ -1603,6 +1601,15 @@ void TableFormattingContext::run(Box const& box, LayoutMode layout_mode, Availab
|
|||
|
||||
// Compute the width of the table.
|
||||
compute_table_width();
|
||||
}
|
||||
|
||||
void TableFormattingContext::run(Box const& box, LayoutMode layout_mode, AvailableSpace const& available_space)
|
||||
{
|
||||
m_available_space = available_space;
|
||||
|
||||
auto total_captions_height = run_caption_layout(layout_mode, CSS::CaptionSide::Top);
|
||||
|
||||
run_until_width_calculation(box, available_space);
|
||||
|
||||
if (available_space.width.is_intrinsic_sizing_constraint() && !available_space.height.is_intrinsic_sizing_constraint()) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue