diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index 0f1532d9fb..dfac2822d3 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -1183,7 +1183,7 @@ float FormattingContext::calculate_min_content_height(Layout::Box const& box, Av auto& root_state = m_state.m_root; auto& cache = *root_state.intrinsic_sizes.ensure(&box, [] { return adopt_own(*new LayoutState::IntrinsicSizes); }); if (available_width.is_definite()) { - cache_slot = &cache.min_content_height_with_definite_available_width; + cache_slot = &cache.min_content_height_with_definite_available_width.ensure(available_width.to_px()); } else if (available_width.is_min_content()) { cache_slot = &cache.min_content_height_with_min_content_available_width; } else if (available_width.is_max_content()) { @@ -1228,7 +1228,7 @@ float FormattingContext::calculate_max_content_height(Layout::Box const& box, Av auto& root_state = m_state.m_root; auto& cache = *root_state.intrinsic_sizes.ensure(&box, [] { return adopt_own(*new LayoutState::IntrinsicSizes); }); if (available_width.is_definite()) { - cache_slot = &cache.max_content_height_with_definite_available_width; + cache_slot = &cache.max_content_height_with_definite_available_width.ensure(available_width.to_px()); } else if (available_width.is_min_content()) { cache_slot = &cache.max_content_height_with_min_content_available_width; } else if (available_width.is_max_content()) { diff --git a/Userland/Libraries/LibWeb/Layout/LayoutState.h b/Userland/Libraries/LibWeb/Layout/LayoutState.h index a85eae6e5e..ec1071e390 100644 --- a/Userland/Libraries/LibWeb/Layout/LayoutState.h +++ b/Userland/Libraries/LibWeb/Layout/LayoutState.h @@ -162,9 +162,9 @@ struct LayoutState { Optional max_content_width; // NOTE: Since intrinsic heights depend on the amount of available width, we have to cache - // three separate results, depending on the available width at the time of calculation. - Optional min_content_height_with_definite_available_width; - Optional max_content_height_with_definite_available_width; + // three separate kinds of results, depending on the available width at the time of calculation. + HashMap> min_content_height_with_definite_available_width; + HashMap> max_content_height_with_definite_available_width; Optional min_content_height_with_min_content_available_width; Optional max_content_height_with_min_content_available_width; Optional min_content_height_with_max_content_available_width;