diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 5bad8a87ce2..dc4096eb871 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -1900,10 +1900,7 @@ void Document::update_readiness(HTML::DocumentReadyState readiness_value) if (readiness_value == HTML::DocumentReadyState::Complete && is_active() && navigable()->is_traversable()) { HTML::HTMLLinkElement::load_fallback_favicon_if_needed(*this).release_value_but_fixme_should_propagate_errors(); - - if (auto* page = navigable()->traversable_navigable()->page()) { - page->client().page_did_finish_loading(url()); - } + navigable()->traversable_navigable()->page().client().page_did_finish_loading(url()); } } diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 29b5f1e78ae..2af6cf8414d 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -1668,8 +1668,8 @@ static ErrorOr scroll_an_element_into_view(DOM::Element& target, Bindings: (void)behavior; // AD-HOC: - auto* page = document.navigable()->traversable_navigable()->page(); - page->client().page_did_request_scroll_to(position.location()); + auto& page = document.navigable()->traversable_navigable()->page(); + page.client().page_did_request_scroll_to(position.location()); } // If scrolling box is associated with an element else { diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.h b/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.h index e7f0f74cce4..fa73acaec55 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.h +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.h @@ -27,8 +27,8 @@ public: ~BrowsingContextGroup(); - Page* page() { return m_page; } - Page const* page() const { return m_page; } + Page& page() { return m_page; } + Page const& page() const { return m_page; } auto& browsing_context_set() { return m_browsing_context_set; } auto const& browsing_context_set() const { return m_browsing_context_set; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp index 24bcf4fd816..de6cdbf857f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp @@ -454,7 +454,7 @@ static bool decode_favicon(ReadonlyBytes favicon_data, AK::URL const& favicon_ur dbgln_if(IMAGE_DECODER_DEBUG, "Decoded favicon, {}", favicon_bitmap->size()); if (navigable && navigable->is_traversable()) - navigable->traversable_navigable()->page()->client().page_did_change_favicon(*favicon_bitmap); + navigable->traversable_navigable()->page().client().page_did_change_favicon(*favicon_bitmap); return favicon_bitmap; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp index fd612e4664d..a5630ce6c58 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp @@ -30,7 +30,7 @@ void HTMLTitleElement::children_changed() { HTMLElement::children_changed(); if (navigable() && navigable()->is_traversable()) { - navigable()->traversable_navigable()->page()->client().page_did_change_title(document().title().to_deprecated_string()); + navigable()->traversable_navigable()->page().client().page_did_change_title(document().title().to_deprecated_string()); } } diff --git a/Userland/Libraries/LibWeb/HTML/Navigable.cpp b/Userland/Libraries/LibWeb/HTML/Navigable.cpp index 4e5939e04c7..4b4c985906a 100644 --- a/Userland/Libraries/LibWeb/HTML/Navigable.cpp +++ b/Userland/Libraries/LibWeb/HTML/Navigable.cpp @@ -362,7 +362,7 @@ Navigable::ChosenNavigable Navigable::choose_a_navigable(StringView name, Tokeni else { // --> If current's active window does not have transient activation and the user agent has been configured to // not show popups (i.e., the user agent has a "popup blocker" enabled) - if (!active_window()->has_transient_activation() && traversable_navigable()->page()->should_block_pop_ups()) { + if (!active_window()->has_transient_activation() && traversable_navigable()->page().should_block_pop_ups()) { // FIXME: The user agent may inform the user that a popup has been blocked. dbgln("Pop-up blocked!"); } @@ -418,7 +418,7 @@ Navigable::ChosenNavigable Navigable::choose_a_navigable(StringView name, Tokeni else { // 1. Set chosen to the result of creating a new top-level traversable given currentNavigable's active browsing context and targetName. // FIXME: Make this method return WebIDL::ExceptionOr - chosen = TraversableNavigable::create_a_new_top_level_traversable(*traversable_navigable()->page(), active_browsing_context(), target_name).release_value_but_fixme_should_propagate_errors(); + chosen = TraversableNavigable::create_a_new_top_level_traversable(traversable_navigable()->page(), active_browsing_context(), target_name).release_value_but_fixme_should_propagate_errors(); // FIXME: 2. If sandboxingFlagSet's sandboxed navigation browsing context flag is set, // then set chosen's active browsing context's one permitted sandboxed navigator to currentNavigable's active browsing context. @@ -1978,7 +1978,7 @@ void Navigable::set_needs_display(CSSPixelRect const& rect) return; if (is(*this)) { - static_cast(this)->page()->client().page_did_invalidate(to_top_level_rect(rect)); + static_cast(this)->page().client().page_did_invalidate(to_top_level_rect(rect)); return; } diff --git a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h index 8c9281d0f22..057088a4923 100644 --- a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h +++ b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h @@ -63,8 +63,8 @@ public: m_session_history_traversal_queue.process(); } - Page* page() { return m_page; } - Page const* page() const { return m_page; } + Page& page() { return m_page; } + Page const& page() const { return m_page; } private: TraversableNavigable(JS::NonnullGCPtr); diff --git a/Userland/Libraries/LibWeb/Page/Page.cpp b/Userland/Libraries/LibWeb/Page/Page.cpp index 866934880ec..51a4824293e 100644 --- a/Userland/Libraries/LibWeb/Page/Page.cpp +++ b/Userland/Libraries/LibWeb/Page/Page.cpp @@ -175,7 +175,7 @@ bool Page::handle_keyup(KeyCode key, unsigned modifiers, u32 code_point) void Page::set_top_level_traversable(JS::NonnullGCPtr navigable) { VERIFY(!m_top_level_traversable); // Replacement is not allowed! - VERIFY(navigable->page() == this); + VERIFY(&navigable->page() == this); m_top_level_traversable = navigable; }