diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index c71ab6e83f..094755fbdb 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -906,15 +906,6 @@ float FormattingContext::calculate_fit_content_height(Layout::Box const& box, Si return calculate_fit_content_size(calculate_min_content_height(box), calculate_max_content_height(box), constraint, available_space); } -float FormattingContext::calculate_auto_height(LayoutState const& state, Box const& box) -{ - if (is(box)) { - return compute_height_for_replaced_element(state, verify_cast(box)); - } - - return compute_auto_height_for_block_level_element(state, box); -} - float FormattingContext::calculate_min_content_width(Layout::Box const& box) const { if (box.has_intrinsic_width()) @@ -1026,11 +1017,7 @@ float FormattingContext::calculate_min_content_height(Layout::Box const& box) co auto context = const_cast(this)->create_independent_formatting_context_if_needed(throwaway_state, box); VERIFY(context); context->run_intrinsic_sizing(box); - if (context->type() == FormattingContext::Type::Flex) { - cache.min_content_height = box_state.content_height(); - } else { - cache.min_content_height = calculate_auto_height(throwaway_state, box); - } + cache.min_content_height = context->automatic_content_height(); if (!isfinite(*cache.min_content_height)) { // HACK: If layout calculates a non-finite result, something went wrong. Force it to zero and log a little whine. @@ -1068,11 +1055,7 @@ float FormattingContext::calculate_max_content_height(Layout::Box const& box) co auto context = const_cast(this)->create_independent_formatting_context_if_needed(throwaway_state, box); VERIFY(context); context->run_intrinsic_sizing(box); - if (context->type() == FormattingContext::Type::Flex) { - cache.max_content_height = box_state.content_height(); - } else { - cache.max_content_height = calculate_auto_height(throwaway_state, box); - } + cache.max_content_height = context->automatic_content_height(); if (!isfinite(*cache.max_content_height)) { // HACK: If layout calculates a non-finite result, something went wrong. Force it to zero and log a little whine. diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.h b/Userland/Libraries/LibWeb/Layout/FormattingContext.h index 3597bf4a38..7f2feb902c 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.h +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.h @@ -90,7 +90,6 @@ protected: static float tentative_height_for_replaced_element(LayoutState const&, ReplacedBox const&, CSS::LengthPercentage const& computed_height); static float compute_auto_height_for_block_formatting_context_root(LayoutState const&, BlockContainer const&); static float compute_auto_height_for_block_level_element(LayoutState const&, Box const&); - static float calculate_auto_height(LayoutState const& state, Box const& box); ShrinkToFitResult calculate_shrink_to_fit_widths(Box const&);