Ladybird/WebView: Fix size calculation in update_viewport_rect()

size() may include the dimensions of the scrollbars, so we now use
viewport() instead.
This commit is contained in:
Itamar 2022-09-25 17:54:46 +03:00 committed by Andrew Kaster
parent 22c3b8be7b
commit 02b3a89d96
Notes: sideshowbarker 2024-07-17 02:42:22 +09:00

View file

@ -405,8 +405,8 @@ void SimpleWebView::resizeEvent(QResizeEvent* event)
void SimpleWebView::update_viewport_rect()
{
auto scaled_width = int(size().width() / m_inverse_pixel_scaling_ratio);
auto scaled_height = int(size().height() / m_inverse_pixel_scaling_ratio);
auto scaled_width = int(viewport()->size().width() / m_inverse_pixel_scaling_ratio);
auto scaled_height = int(viewport()->size().height() / m_inverse_pixel_scaling_ratio);
Gfx::IntRect rect(horizontalScrollBar()->value(), verticalScrollBar()->value(), scaled_width, scaled_height);
m_page_client->set_viewport_rect(rect);
}