From 52ed43d139379abed525783bd116b44f8c1edd66 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 8 Sep 2021 11:56:50 +0200 Subject: [PATCH] LibWeb: Scroll viewport to (0, 0) after loading a new document This fixes a long-standing bug where the view wouldn't update when navigating to a new page after looking at the ACID2 test. This happened because ACID2 actually scrolls the viewport far down. We didn't reset the scroll position upon navigation, and so the new page thought that we were still scrolled very far down, and this broke the invalidation rect calculations. --- Userland/Libraries/LibWeb/Loader/FrameLoader.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp index 91ddc557ad..4038b56ee9 100644 --- a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp @@ -299,6 +299,8 @@ void FrameLoader::resource_did_load() if (!url.fragment().is_empty()) browsing_context().scroll_to_anchor(url.fragment()); + else + browsing_context().set_viewport_scroll_offset({ 0, 0 }); if (auto* host_element = browsing_context().host_element()) { // FIXME: Perhaps in the future we'll have a better common base class for and