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

LibWeb: Handle PageClient::page_did_change_title() in Frame::set_document()

This commit is contained in:
Linus Groh 2020-10-08 21:04:32 +01:00 committed by Andreas Kling
parent a2a603d38a
commit 216ccaf805
2 changed files with 3 additions and 4 deletions

View file

@ -207,7 +207,6 @@ void FrameLoader::load_html(const StringView& html, const URL& url)
HTML::HTMLDocumentParser parser(html, "utf-8"); HTML::HTMLDocumentParser parser(html, "utf-8");
parser.run(url); parser.run(url);
frame().set_document(&parser.document()); frame().set_document(&parser.document());
frame().page().client().page_did_change_title(document->title());
} }
void FrameLoader::load_error_page(const URL& failed_url, const String& error) void FrameLoader::load_error_page(const URL& failed_url, const String& error)
@ -224,7 +223,6 @@ void FrameLoader::load_error_page(const URL& failed_url, const String& error)
auto document = HTML::parse_html_document(html, failed_url, "utf-8"); auto document = HTML::parse_html_document(html, failed_url, "utf-8");
ASSERT(document); ASSERT(document);
frame().set_document(document); frame().set_document(document);
frame().page().client().page_did_change_title(document->title());
}, },
[](auto error) { [](auto error) {
dbg() << "Failed to load error page: " << error; dbg() << "Failed to load error page: " << error;
@ -257,7 +255,6 @@ void FrameLoader::resource_did_load()
} }
frame().set_document(document); frame().set_document(document);
frame().page().client().page_did_change_title(document->title());
if (!url.fragment().is_empty()) if (!url.fragment().is_empty())
frame().scroll_to_anchor(url.fragment()); frame().scroll_to_anchor(url.fragment());

View file

@ -85,8 +85,10 @@ void Frame::set_document(DOM::Document* document)
m_document = document; m_document = document;
if (m_document) if (m_document) {
m_document->attach_to_frame({}, *this); m_document->attach_to_frame({}, *this);
page().client().page_did_change_title(m_document->title());
}
page().client().page_did_set_document_in_main_frame(m_document); page().client().page_did_set_document_in_main_frame(m_document);
} }