1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:38:11 +00:00

LibWeb: Implement and use "scroll to the fragment" algorithm

This will eventually be used by Navigable but for now, it's just when
traversing the history.
This commit is contained in:
Sam Atkins 2023-08-11 20:26:02 +01:00 committed by Andreas Kling
parent be9c975b2e
commit 8bd3b74e3a
3 changed files with 64 additions and 5 deletions

View file

@ -1407,11 +1407,8 @@ WebIDL::ExceptionOr<void> BrowsingContext::traverse_the_history(size_t entry_ind
}
// 10. If entry's persisted user state is null, and its URL's fragment is non-null, then scroll to the fragment.
if (!entry->url.fragment().is_null()) {
// FIXME: Implement the full "scroll to the fragment" algorithm:
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#scroll-to-the-fragment-identifier
scroll_to_anchor(entry->url.fragment());
}
if (!entry->url.fragment().is_null())
active_document()->scroll_to_the_fragment();
// 11. Set the current entry to entry.
m_session_history_index = entry_index;