1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 13:05:07 +00:00

LibWeb: Respect specified width when computing shrink-to-fit candidates

Previously we would always just use the combined content width as the
shrunken width in shrink-to-fit width calculations, but if the element
has a non-auto specified width, we should just let that take over.

This is far from perfect and doesn't take stuff like min/max-width
into account. Will need more work, this just covers the basic case.
This commit is contained in:
Andreas Kling 2020-06-23 18:55:25 +02:00
parent 675e7c0e6f
commit aeeaf33638

View file

@ -155,8 +155,11 @@ void LayoutBlock::layout_contained_boxes(LayoutMode layout_mode)
return IterationDecision::Continue; return IterationDecision::Continue;
}); });
if (layout_mode != LayoutMode::Default) if (layout_mode != LayoutMode::Default) {
set_width(content_width); auto specified_width = style().length_or_fallback(CSS::PropertyID::Width, Length(), containing_block()->width());
if (specified_width.is_auto())
set_width(content_width);
}
set_height(content_height); set_height(content_height);
} }