From 54066ec5a454f33d8c5e4ea1f8695942b95b1b82 Mon Sep 17 00:00:00 2001 From: simonkrauter Date: Tue, 23 Jul 2024 12:08:21 -0300 Subject: [PATCH] LibWeb: Use absolute padding box to calculate max scroll offset In `PaintableBox::set_scroll_offset()` the scrollport size was measured by `content_size()` instead of `absolute_padding_box_rect()`. Fixes #788 --- Userland/Libraries/LibWeb/Painting/PaintableBox.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 72026fa11da..1b547dc10d7 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -84,8 +84,9 @@ void PaintableBox::set_scroll_offset(CSSPixelPoint offset) document().set_needs_to_refresh_clip_state(true); document().set_needs_to_refresh_scroll_state(true); - auto max_x_offset = max(scrollable_overflow_rect->width() - content_size().width(), 0); - auto max_y_offset = max(scrollable_overflow_rect->height() - content_size().height(), 0); + auto padding_rect = absolute_padding_box_rect(); + auto max_x_offset = max(scrollable_overflow_rect->width() - padding_rect.width(), 0); + auto max_y_offset = max(scrollable_overflow_rect->height() - padding_rect.height(), 0); offset.set_x(clamp(offset.x(), 0, max_x_offset)); offset.set_y(clamp(offset.y(), 0, max_y_offset));