mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:07:34 +00:00
LibWeb: Use automatic_content_height() when computing intrinsic heights
This commit is contained in:
parent
62974160da
commit
5656173e00
2 changed files with 2 additions and 20 deletions
|
@ -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<ReplacedBox>(box)) {
|
||||
return compute_height_for_replaced_element(state, verify_cast<ReplacedBox>(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<FormattingContext*>(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<FormattingContext*>(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.
|
||||
|
|
|
@ -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&);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue