mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:07:34 +00:00
LibWeb: Resolve block max-width percentage against containing block
This commit is contained in:
parent
8df3e6b203
commit
2285dfb80e
5 changed files with 37 additions and 24 deletions
|
@ -519,7 +519,10 @@ void BlockFormattingContext::layout_inline_children(BlockContainer const& block_
|
|||
// NOTE: min-width or max-width for boxes with inline children can only be applied after inside layout
|
||||
// is done and width of box content is known
|
||||
auto used_width_px = context.automatic_content_width();
|
||||
auto available_width = AvailableSize::make_definite(used_width_px);
|
||||
// https://www.w3.org/TR/css-sizing-3/#sizing-values
|
||||
// Percentages are resolved against the width/height, as appropriate, of the box’s containing block.
|
||||
auto containing_block_width = m_state.get(*block_container.containing_block()).content_width();
|
||||
auto available_width = AvailableSize::make_definite(containing_block_width);
|
||||
if (!should_treat_max_width_as_none(block_container, available_space.width)) {
|
||||
auto max_width_px = calculate_inner_width(block_container, available_width, block_container.computed_values().max_width()).to_px(block_container);
|
||||
if (used_width_px > max_width_px)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue