aboutsummaryrefslogtreecommitdiffstats
path: root/components/shared/embedder
diff options
context:
space:
mode:
authorNgo Iok Ui (Wu Yu Wei) <yuweiwu@pm.me>2024-04-03 20:06:28 +0900
committerGitHub <noreply@github.com>2024-04-03 11:06:28 +0000
commit66878fb834fe7de6d76ebd01b1c9a8d92b04e546 (patch)
tree48b4888516f88483acbaa11b36cd841f5877ade4 /components/shared/embedder
parent18b37e676bcd50f754cd189444080fc547c9d48a (diff)
downloadservo-66878fb834fe7de6d76ebd01b1c9a8d92b04e546.tar.gz
servo-66878fb834fe7de6d76ebd01b1c9a8d92b04e546.zip
Initial internal support for multiple webviews (#31417)
* Add multiple concurrent top-level browsing contexts Co-authored-by: Delan Azabani <dazabani@igalia.com> * Rename variables and comments There are some variable and comments still use browser as names. This commit renames them to webview. * Update log message from web view to webview * Revert offscreen_framebuffer_id rename * Rename all web view to webview * Cargo fmt * Fix viewport/event/clear coordinates when multiview is disabled * Only deprecate things when multiview is enabled * Update WebViewManger with shown and invisible sets Replace visible_webviews and native_window_is_visible with shown_webviews and invisible_webviews. Add 4 more methods to set them accordingly. The behavior of is_effectively_visible will return true if the wbview is in shown_webviews set but not in invisible_webviews. * Update variant behaviors * Rename WebViewVisibilityChanged to MarkWebViewInvisible * Fix unit test by marking id 3 visible again * Update MarkWebViewInvisible and add UnmarkWebViewInvisible * Update format and doc comments * Clean up doc comments * Address style and naming changes * Rename UpdateWebView to UpdateFrameTreeForWebView * constellation: send frame tree unconditionally over focus and feature * Clarify shown and invisible sets in constellation WebViewManager * Eliminate forward_to_constellation!() * Actually remove the unused macro * Don’t gate compositor changes on multiview feature flag * Update todo in mouse event dispatch * Pass all visible webview ids in a single ReadyToPresent message * Fix compile and lint errors * servoshell: fix gap between minibrowser toolbar and webview * Fix failure in /_mozilla/mozilla/window_resizeTo.html * Fix compile warnings * Remove stray dbg!() * Remove confusing “effectively visible” logic (see #31815, #31816) * Allow embedder to show/hide/raise webviews without ipc * Update root pipeline only when painting order actually changes * Stop gating old focus and SetFrameTree behaviour behind Cargo feature * Use webview_id and WebViewId in webview-related code * Improve logging of webview-related embedder events * Allow webview Show and Raise events to optionally hide all others * Don’t do anything in response to WebViewPaintingOrder * Remove WebViewPaintingOrder, since its payload is unreliable * On MoveResizeWebView, only update root pipeline if rect changed * Rename IOCompositor methods for clarity * compositor: add event tracing; log webview ops even without ipc * Add temporary debug logging * Add more temporary debug logging * Remove temporary logging in compositor * Remove temporary debug logging * Add temporary debug logging, but defer I/O until panic * Capture a backtrace with each crash log entry * Proper error handling without panicking in WebViewManager * Clean up imports in constellation --------- Co-authored-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/shared/embedder')
-rw-r--r--components/shared/embedder/lib.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/components/shared/embedder/lib.rs b/components/shared/embedder/lib.rs
index da6eca45291..0acf7d01ce5 100644
--- a/components/shared/embedder/lib.rs
+++ b/components/shared/embedder/lib.rs
@@ -10,7 +10,7 @@ use crossbeam_channel::{Receiver, Sender};
use ipc_channel::ipc::IpcSender;
use keyboard_types::KeyboardEvent;
use log::warn;
-use msg::constellation_msg::{InputMethodType, PipelineId, TopLevelBrowsingContextId};
+use msg::constellation_msg::{InputMethodType, PipelineId, TopLevelBrowsingContextId, WebViewId};
use num_derive::FromPrimitive;
use serde::{Deserialize, Serialize};
use servo_url::ServoUrl;
@@ -156,13 +156,13 @@ pub enum EmbedderMsg {
AllowNavigationRequest(PipelineId, ServoUrl),
/// Whether or not to allow script to open a new tab/browser
AllowOpeningWebView(IpcSender<bool>),
- /// A browser was created
+ /// A webview was created.
WebViewOpened(TopLevelBrowsingContextId),
- /// A browser was destroyed
+ /// A webview was destroyed.
WebViewClosed(TopLevelBrowsingContextId),
- /// A browser gained focus for keyboard events
+ /// A webview gained focus for keyboard events.
WebViewFocused(TopLevelBrowsingContextId),
- /// All browsers lost focus for keyboard events
+ /// All webviews lost focus for keyboard events.
WebViewBlurred,
/// Wether or not to unload a document
AllowUnload(IpcSender<bool>),
@@ -210,8 +210,8 @@ pub enum EmbedderMsg {
MediaSessionEvent(MediaSessionEvent),
/// Report the status of Devtools Server with a token that can be used to bypass the permission prompt.
OnDevtoolsStarted(Result<u16, ()>, String),
- /// Compositing done, but external code needs to present.
- ReadyToPresent,
+ /// Notify the embedder that it needs to present a new frame.
+ ReadyToPresent(Vec<WebViewId>),
/// The given event was delivered to a pipeline in the given browser.
EventDelivered(CompositorEventVariant),
}
@@ -261,12 +261,12 @@ impl Debug for EmbedderMsg {
EmbedderMsg::WebViewOpened(..) => write!(f, "WebViewOpened"),
EmbedderMsg::WebViewClosed(..) => write!(f, "WebViewClosed"),
EmbedderMsg::WebViewFocused(..) => write!(f, "WebViewFocused"),
- EmbedderMsg::WebViewBlurred => write!(f, "WebViewUnfocused"),
+ EmbedderMsg::WebViewBlurred => write!(f, "WebViewBlurred"),
EmbedderMsg::ReportProfile(..) => write!(f, "ReportProfile"),
EmbedderMsg::MediaSessionEvent(..) => write!(f, "MediaSessionEvent"),
EmbedderMsg::OnDevtoolsStarted(..) => write!(f, "OnDevtoolsStarted"),
EmbedderMsg::ShowContextMenu(..) => write!(f, "ShowContextMenu"),
- EmbedderMsg::ReadyToPresent => write!(f, "ReadyToPresent"),
+ EmbedderMsg::ReadyToPresent(..) => write!(f, "ReadyToPresent"),
EmbedderMsg::EventDelivered(..) => write!(f, "HitTestedEvent"),
}
}