From b97c74331cb00c56cd8bf7ffba17efedbbe5d009 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 8 Jul 2022 13:12:23 +0200 Subject: Ladybird: Don't include scrollbars in viewport rect size --- Ladybird/WebView.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Ladybird/WebView.cpp b/Ladybird/WebView.cpp index f54821252e..3769a15abe 100644 --- a/Ladybird/WebView.cpp +++ b/Ladybird/WebView.cpp @@ -407,6 +407,10 @@ void WebView::resizeEvent(QResizeEvent* event) auto scaled_width = int(event->size().width() / m_inverse_pixel_scaling_ratio); auto scaled_height = int(event->size().height() / m_inverse_pixel_scaling_ratio); Gfx::IntRect rect(horizontalScrollBar()->value(), verticalScrollBar()->value(), scaled_width, scaled_height); + if (verticalScrollBar()->isVisible()) + rect.set_width(rect.width() - verticalScrollBar()->width()); + if (horizontalScrollBar()->isVisible()) + rect.set_height(rect.height() - horizontalScrollBar()->height()); m_page_client->set_viewport_rect(rect); } -- cgit v1.2.3