From e5c2e53739dd0b94691b30f3af7892e165bb6436 Mon Sep 17 00:00:00 2001 From: FalseHonesty Date: Fri, 22 May 2020 21:28:12 -0400 Subject: [PATCH] LibWeb: Fix HtmlView not scrolling to a url's anchor on page load Previously, when HtmlView loaded a url, the url's fragment was ignored, but now it will be automatically scrolled to. --- Libraries/LibWeb/HtmlView.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Libraries/LibWeb/HtmlView.cpp b/Libraries/LibWeb/HtmlView.cpp index d4bba1e7323..57403b9a61d 100644 --- a/Libraries/LibWeb/HtmlView.cpp +++ b/Libraries/LibWeb/HtmlView.cpp @@ -488,6 +488,10 @@ void HtmlView::load(const URL& url) auto document = create_document_from_mime_type(data, url, mime_type, encoding); ASSERT(document); set_document(document); + + if (!url.fragment().is_empty()) + scroll_to_anchor(url.fragment()); + if (on_title_change) on_title_change(document->title()); },