1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:27:34 +00:00

LibWeb: Introduce simple scrollable overflow, size ICB to viewport

Per spec, the initial containing block (ICB) should have the size of the
viewport. We have only done this for the width until now, since we had
no way to express scrollable overflow.

This patch adds Layout::Box::m_overflow_data, an optional struct that
can hold on to information about a box's overflow. Then we have BFC
set the ICB up with some scrollable overflow instead of sizing it to fit
its content vertically.

This fixes a number of broken layouts where correctness depends on
having the appropriate ICB height.
This commit is contained in:
Andreas Kling 2021-10-14 22:23:20 +02:00
parent c94873806c
commit 27d4ac316f
3 changed files with 40 additions and 7 deletions

View file

@ -102,7 +102,11 @@ void PageHost::page_did_layout()
{
auto* layout_root = this->layout_root();
VERIFY(layout_root);
auto content_size = enclosing_int_rect(layout_root->absolute_rect()).size();
Gfx::IntSize content_size;
if (layout_root->has_overflow())
content_size = enclosing_int_rect(layout_root->scrollable_overflow_rect().value()).size();
else
content_size = enclosing_int_rect(layout_root->absolute_rect()).size();
m_client.async_did_layout(content_size);
}