mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
LibWeb: Always include floats when computing height:auto for blocks
I'm not sure why we had two modes for this, but floats should always be included in the auto height AFAICT.
This commit is contained in:
parent
6478b460fb
commit
56df05ae44
3 changed files with 18 additions and 24 deletions
|
@ -310,7 +310,7 @@ float BlockFormattingContext::compute_theoretical_height(FormattingState const&
|
|||
if (!box.computed_values().height().has_value()
|
||||
|| (box.computed_values().height()->is_length() && box.computed_values().height()->length().is_auto())
|
||||
|| (computed_values.height().has_value() && computed_values.height()->is_percentage() && !is_absolute(containing_block.computed_values().height()))) {
|
||||
height = compute_auto_height_for_block_level_element(state, box, ConsiderFloats::No);
|
||||
height = compute_auto_height_for_block_level_element(state, box);
|
||||
} else {
|
||||
height = computed_values.height().has_value() ? computed_values.height()->resolved(box, containing_block_height).to_px(box) : 0;
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ static Gfx::FloatSize solve_replaced_size_constraint(FormattingState const& stat
|
|||
return { w, h };
|
||||
}
|
||||
|
||||
float FormattingContext::compute_auto_height_for_block_level_element(FormattingState const& state, Box const& box, ConsiderFloats consider_floats)
|
||||
float FormattingContext::compute_auto_height_for_block_level_element(FormattingState const& state, Box const& box)
|
||||
{
|
||||
Optional<float> top;
|
||||
Optional<float> bottom;
|
||||
|
@ -250,7 +250,6 @@ float FormattingContext::compute_auto_height_for_block_level_element(FormattingS
|
|||
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
if (consider_floats == ConsiderFloats::Yes) {
|
||||
// In addition, if the element has any floating descendants
|
||||
// whose bottom margin edge is below the element's bottom content edge,
|
||||
// then the height is increased to include those edges.
|
||||
|
@ -268,7 +267,6 @@ float FormattingContext::compute_auto_height_for_block_level_element(FormattingS
|
|||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
}
|
||||
return bottom.value_or(0) - top.value_or(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,11 +58,7 @@ protected:
|
|||
|
||||
static float tentative_width_for_replaced_element(FormattingState const&, ReplacedBox const&, CSS::Length const& width);
|
||||
static float tentative_height_for_replaced_element(FormattingState const&, ReplacedBox const&, CSS::Length const& height);
|
||||
enum ConsiderFloats {
|
||||
Yes,
|
||||
No,
|
||||
};
|
||||
static float compute_auto_height_for_block_level_element(FormattingState const&, Box const&, ConsiderFloats consider_floats = ConsiderFloats::Yes);
|
||||
static float compute_auto_height_for_block_level_element(FormattingState const&, Box const&);
|
||||
|
||||
ShrinkToFitResult calculate_shrink_to_fit_widths(Box const&);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue