Allow OHOS servoshell to have a simple multiple tab implementation. (#36891)

Currently we just pause the compositor and replace the window in it
while having separate bookkeeping to remember which window belongs to
which tab.
Currently there are no tests for OHOS, so we cannot test the changes.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
This commit is contained in:
Narfinger 2025-06-16 10:17:31 +02:00 committed by GitHub
parent 71bf9fb92d
commit 3b73b83a9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 245 additions and 87 deletions

View file

@ -356,6 +356,15 @@ impl RunningAppState {
self.inner_mut().webviews.insert(webview.id(), webview);
}
/// The focused webview will not be immediately valid via `active_webview()`
pub(crate) fn focus_webview(&self, id: WebViewId) {
if let Some(webview) = self.inner().webviews.get(&id) {
webview.focus();
} else {
error!("We could not find the webview with this id {id}");
}
}
fn inner(&self) -> Ref<RunningAppStateInner> {
self.inner.borrow()
}
@ -372,14 +381,14 @@ impl RunningAppState {
Ok(webview_id)
}
fn newest_webview(&self) -> Option<WebView> {
pub(crate) fn newest_webview(&self) -> Option<WebView> {
self.inner()
.creation_order
.last()
.and_then(|id| self.inner().webviews.get(id).cloned())
}
fn active_webview(&self) -> WebView {
pub(crate) fn active_webview(&self) -> WebView {
self.inner()
.focused_webview_id
.and_then(|id| self.inner().webviews.get(&id).cloned())