mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:27:35 +00:00
LibWeb: Update Page to use navigables
This commit is contained in:
parent
f91b34ef2e
commit
ee50d9b2b5
9 changed files with 41 additions and 25 deletions
|
@ -531,7 +531,7 @@ void BrowsingContext::set_active_document(JS::NonnullGCPtr<DOM::Document> docume
|
|||
// AD-HOC:
|
||||
document->set_browsing_context(this);
|
||||
|
||||
if (m_page && m_page->top_level_browsing_context_is_initialized() && this == &m_page->top_level_browsing_context())
|
||||
if (m_page && m_page->top_level_traversable_is_initialized() && this == &m_page->top_level_browsing_context())
|
||||
m_page->client().page_did_change_title(document->title());
|
||||
|
||||
if (previously_active_document && previously_active_document != document.ptr())
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/HTML/HTMLLinkElement.h>
|
||||
#include <LibWeb/HTML/PotentialCORSRequest.h>
|
||||
#include <LibWeb/HTML/TraversableNavigable.h>
|
||||
#include <LibWeb/Infra/CharacterTypes.h>
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
|
@ -458,11 +459,9 @@ bool HTMLLinkElement::load_favicon_and_use_if_window_is_active()
|
|||
if (!page)
|
||||
return favicon_bitmap;
|
||||
|
||||
if (document().browsing_context() == &page->top_level_browsing_context())
|
||||
if (favicon_bitmap) {
|
||||
page->client().page_did_change_favicon(*favicon_bitmap);
|
||||
return true;
|
||||
}
|
||||
if (navigable() && navigable()->is_traversable()) {
|
||||
navigable()->traversable_navigable()->page()->client().page_did_change_favicon(*favicon_bitmap);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/HTMLTitleElement.h>
|
||||
#include <LibWeb/HTML/TraversableNavigable.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
@ -26,9 +27,8 @@ void HTMLTitleElement::initialize(JS::Realm& realm)
|
|||
void HTMLTitleElement::children_changed()
|
||||
{
|
||||
HTMLElement::children_changed();
|
||||
if (auto* page = document().page()) {
|
||||
if (document().browsing_context() == &page->top_level_browsing_context())
|
||||
page->client().page_did_change_title(document().title());
|
||||
if (navigable() && navigable()->is_traversable()) {
|
||||
navigable()->traversable_navigable()->page()->client().page_did_change_title(document().title());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,11 @@ Vector<JS::Handle<Navigable>> Navigable::child_navigables() const
|
|||
return results;
|
||||
}
|
||||
|
||||
bool Navigable::is_traversable() const
|
||||
{
|
||||
return is<TraversableNavigable>(*this);
|
||||
}
|
||||
|
||||
Navigable::Navigable()
|
||||
{
|
||||
all_navigables().set(this);
|
||||
|
|
|
@ -51,6 +51,8 @@ public:
|
|||
|
||||
Vector<JS::Handle<Navigable>> child_navigables() const;
|
||||
|
||||
bool is_traversable() const;
|
||||
|
||||
String const& id() const { return m_id; }
|
||||
JS::GCPtr<Navigable> parent() const { return m_parent; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue