mirror of
https://github.com/RGBCube/serenity
synced 2025-05-24 21:55:07 +00:00
LibWeb: Constrain block height by the max-height if specified
This commit is contained in:
parent
116cf92156
commit
a38a5d50ab
1 changed files with 11 additions and 3 deletions
|
@ -426,9 +426,17 @@ void LayoutBlock::compute_position()
|
||||||
void LayoutBlock::compute_height()
|
void LayoutBlock::compute_height()
|
||||||
{
|
{
|
||||||
auto& style = this->style();
|
auto& style = this->style();
|
||||||
auto height = style.length_or_fallback(CSS::PropertyID::Height, Length(), containing_block()->height());
|
|
||||||
if (height.is_absolute())
|
auto specified_height = style.length_or_fallback(CSS::PropertyID::Height, Length(), containing_block()->height());
|
||||||
set_height(height.to_px(*this));
|
auto specified_max_height = style.length_or_fallback(CSS::PropertyID::MaxHeight, Length(), containing_block()->height());
|
||||||
|
|
||||||
|
|
||||||
|
if (!specified_height.is_auto()) {
|
||||||
|
float used_height = specified_height.to_px(*this);
|
||||||
|
if (!specified_max_height.is_auto())
|
||||||
|
used_height = min(used_height, specified_max_height.to_px(*this));
|
||||||
|
set_height(used_height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayoutBlock::render(RenderingContext& context)
|
void LayoutBlock::render(RenderingContext& context)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue