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
parent 77610db58c
commit bdb67d2bcb
3 changed files with 15 additions and 22 deletions

View File

@@ -456,7 +456,7 @@ void BlockFormattingContext::compute_height(Box const& box, AvailableSpace const
auto margins = box_state.margin_top + box_state.margin_bottom;
// 2. Let size be the size of the initial containing block in the block flow direction minus margins.
auto size = m_state.get(*box.containing_block()).content_height() - margins;
auto size = box_state.containing_block_used_values()->content_height() - margins;
// 3. Return the bigger value of size and the normal border box size the element would have
// according to the CSS specification.