LibWeb: Use LayoutState::UsedValues::containing_block_used_values() more

Use this cached pointer to the containing block's used values when
obviously possible. This avoids a hash lookup each time, and these
hash lookups do show up in profiles.
This commit is contained in:
Andreas Kling 2024-09-13 14:47:39 +02:00 committed by Andreas Kling
commit bdb67d2bcb
Notes: github-actions[bot] 2024-09-13 14:00:05 +00:00
3 changed files with 15 additions and 22 deletions

View file

@ -849,8 +849,8 @@ void TableFormattingContext::compute_table_height()
for (size_t i = 0; i < cell.column_span; ++i)
span_width += m_columns[cell.column_index + i].used_width;
auto width_of_containing_block = m_state.get(*cell.box->containing_block()).content_width();
auto height_of_containing_block = m_state.get(*cell.box->containing_block()).content_height();
auto width_of_containing_block = cell_state.containing_block_used_values()->content_width();
auto height_of_containing_block = cell_state.containing_block_used_values()->content_height();
cell_state.padding_top = cell.box->computed_values().padding().top().to_px(cell.box, width_of_containing_block);
cell_state.padding_bottom = cell.box->computed_values().padding().bottom().to_px(cell.box, width_of_containing_block);