LibWebView: Store the tab title on the ViewImplementation

This will be needed for DevTools, to avoid the need to go into the UI
layer for this information.
This commit is contained in:
Timothy Flynn
2025-02-17 06:43:06 -05:00
committed by Tim Flynn
parent 3904765c4f
commit 49c93d01db
2 changed files with 8 additions and 6 deletions

View File

@@ -142,13 +142,11 @@ void WebContentClient::did_change_title(u64 page_id, ByteString const& title)
process->set_title(MUST(String::from_byte_string(title)));
if (auto view = view_for_page_id(page_id); view.has_value()) {
if (!view->on_title_change)
return;
auto title_or_url = title.is_empty() ? view->url().to_byte_string() : title;
view->set_title({}, title_or_url);
if (title.is_empty())
view->on_title_change(view->url().to_byte_string());
else
view->on_title_change(title);
if (view->on_title_change)
view->on_title_change(title_or_url);
}
}