From a46c2a08876d29500faaacc7e4d3fb6661c5765d Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Mon, 7 Oct 2024 17:43:21 +0200 Subject: [PATCH] LibWeb: Forbid scrolling of viewport if overflow=hidden Before this change viewport was allowed to be scrolled whenever it has a scrollable overflow, which is not correct when overflow is specified to be hidden. --- Userland/Libraries/LibWeb/Painting/PaintableBox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index ffa86c3ba55..b079844fe5d 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -240,7 +240,7 @@ bool PaintableBox::is_scrollable(ScrollDirection direction) const auto overflow = direction == ScrollDirection::Horizontal ? computed_values().overflow_x() : computed_values().overflow_y(); auto scrollable_overflow_size = direction == ScrollDirection::Horizontal ? scrollable_overflow_rect()->width() : scrollable_overflow_rect()->height(); auto scrollport_size = direction == ScrollDirection::Horizontal ? absolute_padding_box_rect().width() : absolute_padding_box_rect().height(); - if (is_viewport() || overflow == CSS::Overflow::Auto) + if ((is_viewport() && overflow != CSS::Overflow::Hidden) || overflow == CSS::Overflow::Auto) return scrollable_overflow_size > scrollport_size; return overflow == CSS::Overflow::Scroll; }