Propagate page title and favicon into the active tab

Servo already publishes the live page title in every `LiveFrameReport`
but the renderer was dropping it on the floor — tabs that navigated
away from `ely://new-tab` kept showing "New Tab" forever, and there
was no favicon visible anywhere in the sidebar.

Add `BrowserCore::set_tab_title` and switch `set_tab_favicon_key` to
return `Ok(true)` only when the value actually changed; both methods
mirror the new value into the matching history entry so the History
page stays in lockstep. Derive the canonical `/favicon.ico` URL from
the loaded URL on `UrlText` and store it as the tab's `favicon_key`.

In the surface layer, every Ready frame now emits a
`WebSurfacePageMetadata` change alongside any `WebSurfaceUrlChange`,
and the controller applies title + favicon URL together. Render the
sidebar tab row's favicon via GPUI's HTTP image loader (falling
through to the URL-derived glyph for `ely://` pages, file URLs, and
hosts without a /favicon.ico endpoint).
This commit is contained in:
2026-05-15 16:53:32 -04:00
parent 00a8ff1fef
commit 3d2c3ed1bf
10 changed files with 164 additions and 6 deletions
+14
View File
@@ -71,6 +71,20 @@ impl UrlText {
url.host_str().map(str::to_string).unwrap_or_else(|| self.value.clone())
}
/// Resolve the canonical `/favicon.ico` URL for an HTTP(S) page.
/// Returns `None` for non-web schemes (`ely://`, `file://`, etc.)
/// or URLs missing an authority — those tabs render the URL-derived
/// glyph instead of a fetched icon.
#[must_use]
pub fn favicon_url(&self) -> Option<String> {
let url = Url::parse(&self.value).ok()?;
if !matches!(url.scheme(), "http" | "https") {
return None;
}
url.host_str()?;
url.join("/favicon.ico").ok().map(|favicon| favicon.to_string())
}
}
impl fmt::Display for UrlText {