mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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>
This commit is contained in:
parent
18b37e676b
commit
66878fb834
21 changed files with 1142 additions and 434 deletions
|
@ -30,6 +30,7 @@ use bluetooth_traits::BluetoothRequest;
|
|||
use canvas::canvas_paint_thread::{self, CanvasPaintThread};
|
||||
use canvas::WebGLComm;
|
||||
use canvas_traits::webgl::WebGLThreads;
|
||||
use compositing::webview::UnknownWebView;
|
||||
use compositing::windowing::{EmbedderEvent, EmbedderMethods, WindowMethods};
|
||||
use compositing::{CompositeTarget, IOCompositor, InitialCompositorState, ShutdownState};
|
||||
use compositing_traits::{
|
||||
|
@ -598,7 +599,7 @@ where
|
|||
self.compositor.composite();
|
||||
},
|
||||
|
||||
EmbedderEvent::Resize => {
|
||||
EmbedderEvent::WindowResize => {
|
||||
return self.compositor.on_resize_window_event();
|
||||
},
|
||||
EmbedderEvent::InvalidateNativeSurface => {
|
||||
|
@ -761,6 +762,33 @@ where
|
|||
}
|
||||
},
|
||||
|
||||
EmbedderEvent::MoveResizeWebView(webview_id, rect) => {
|
||||
self.compositor.move_resize_webview(webview_id, rect);
|
||||
},
|
||||
EmbedderEvent::ShowWebView(webview_id, hide_others) => {
|
||||
if let Err(UnknownWebView(webview_id)) =
|
||||
self.compositor.show_webview(webview_id, hide_others)
|
||||
{
|
||||
warn!("{webview_id}: ShowWebView on unknown webview id");
|
||||
}
|
||||
},
|
||||
EmbedderEvent::HideWebView(webview_id) => {
|
||||
if let Err(UnknownWebView(webview_id)) = self.compositor.hide_webview(webview_id) {
|
||||
warn!("{webview_id}: HideWebView on unknown webview id");
|
||||
}
|
||||
},
|
||||
EmbedderEvent::RaiseWebViewToTop(webview_id, hide_others) => {
|
||||
if let Err(UnknownWebView(webview_id)) = self
|
||||
.compositor
|
||||
.raise_webview_to_top(webview_id, hide_others)
|
||||
{
|
||||
warn!("{webview_id}: RaiseWebViewToTop on unknown webview id");
|
||||
}
|
||||
},
|
||||
EmbedderEvent::BlurWebView => {
|
||||
self.send_to_constellation(ConstellationMsg::BlurWebView);
|
||||
},
|
||||
|
||||
EmbedderEvent::SendError(top_level_browsing_context_id, e) => {
|
||||
let msg = ConstellationMsg::SendError(top_level_browsing_context_id, e);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
|
@ -801,6 +829,13 @@ where
|
|||
false
|
||||
}
|
||||
|
||||
fn send_to_constellation(&self, msg: ConstellationMsg) {
|
||||
let variant_name = msg.variant_name();
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending {variant_name} to constellation failed: {e:?}");
|
||||
}
|
||||
}
|
||||
|
||||
fn receive_messages(&mut self) {
|
||||
while let Some((top_level_browsing_context, msg)) =
|
||||
self.embedder_receiver.try_recv_embedder_msg()
|
||||
|
@ -882,10 +917,6 @@ where
|
|||
self.compositor.present();
|
||||
}
|
||||
|
||||
pub fn recomposite(&mut self) {
|
||||
self.compositor.composite();
|
||||
}
|
||||
|
||||
/// Return the OpenGL framebuffer name of the most-recently-completed frame when compositing to
|
||||
/// [`CompositeTarget::Fbo`], or None otherwise.
|
||||
pub fn offscreen_framebuffer_id(&self) -> Option<u32> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue