From 4ff52cebc4570662cf5a2b01d5b9cfc3369bd8f0 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 29 May 2023 08:52:34 +0200 Subject: [PATCH] LibWeb: Let's say that layout viewports are always scroll containers This will allow us to have a shared code path for overflow calculation. --- Userland/Libraries/LibWeb/Layout/Box.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibWeb/Layout/Box.cpp b/Userland/Libraries/LibWeb/Layout/Box.cpp index 1bcd4ef3dd..1842224c85 100644 --- a/Userland/Libraries/LibWeb/Layout/Box.cpp +++ b/Userland/Libraries/LibWeb/Layout/Box.cpp @@ -47,6 +47,10 @@ static bool overflow_value_makes_box_a_scroll_container(CSS::Overflow overflow) // https://www.w3.org/TR/css-overflow-3/#scroll-container bool Box::is_scroll_container() const { + // NOTE: This isn't in the spec, but we want the viewport to behave like a scroll container. + if (is_viewport()) + return true; + return overflow_value_makes_box_a_scroll_container(computed_values().overflow_x()) || overflow_value_makes_box_a_scroll_container(computed_values().overflow_y()); }