mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Update WebView variants of ConstellationMsg (#32163)
* Add ConstellationMsg::WebViewOpened * Remove unused variants * Send the message on first webview as well
This commit is contained in:
parent
1d6be62454
commit
74897c3851
4 changed files with 21 additions and 63 deletions
|
@ -369,6 +369,10 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
|||
},
|
||||
)
|
||||
.expect("Infallible with a new WebViewManager");
|
||||
let msg = ConstellationMsg::WebViewOpened(top_level_browsing_context_id);
|
||||
if let Err(e) = state.constellation_chan.send(msg) {
|
||||
warn!("Sending event to constellation failed ({:?}).", e);
|
||||
}
|
||||
webviews
|
||||
.show(top_level_browsing_context_id)
|
||||
.expect("Infallible due to add");
|
||||
|
@ -1183,6 +1187,10 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
|||
error!("{webview_id}: Creating webview that already exists");
|
||||
return;
|
||||
}
|
||||
let msg = ConstellationMsg::WebViewOpened(top_level_browsing_context_id);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending event to constellation failed ({:?}).", e);
|
||||
}
|
||||
}
|
||||
|
||||
self.send_root_pipeline_display_list();
|
||||
|
|
|
@ -1459,6 +1459,15 @@ where
|
|||
FromCompositorMsg::NewWebView(url, top_level_browsing_context_id) => {
|
||||
self.handle_new_top_level_browsing_context(url, top_level_browsing_context_id);
|
||||
},
|
||||
// A top level browsing context is created and opened in both constellation and
|
||||
// compositor.
|
||||
FromCompositorMsg::WebViewOpened(top_level_browsing_context_id) => {
|
||||
let msg = (
|
||||
Some(top_level_browsing_context_id),
|
||||
EmbedderMsg::WebViewOpened(top_level_browsing_context_id),
|
||||
);
|
||||
self.embedder_proxy.send(msg);
|
||||
},
|
||||
// Close a top level browsing context.
|
||||
FromCompositorMsg::CloseWebView(top_level_browsing_context_id) => {
|
||||
self.handle_close_top_level_browsing_context(top_level_browsing_context_id);
|
||||
|
@ -1471,48 +1480,6 @@ where
|
|||
}
|
||||
self.handle_panic(top_level_browsing_context_id, error, None);
|
||||
},
|
||||
FromCompositorMsg::MoveResizeWebView(top_level_browsing_context_id, rect) => {
|
||||
if self.webviews.get(top_level_browsing_context_id).is_none() {
|
||||
return warn!(
|
||||
"{}: MoveResizeWebView on unknown top-level browsing context",
|
||||
top_level_browsing_context_id
|
||||
);
|
||||
}
|
||||
self.compositor_proxy.send(CompositorMsg::MoveResizeWebView(
|
||||
top_level_browsing_context_id,
|
||||
rect,
|
||||
));
|
||||
},
|
||||
FromCompositorMsg::ShowWebView(webview_id, hide_others) => {
|
||||
if self.webviews.get(webview_id).is_none() {
|
||||
return warn!(
|
||||
"{}: ShowWebView on unknown top-level browsing context",
|
||||
webview_id
|
||||
);
|
||||
}
|
||||
self.compositor_proxy
|
||||
.send(CompositorMsg::ShowWebView(webview_id, hide_others));
|
||||
},
|
||||
FromCompositorMsg::HideWebView(webview_id) => {
|
||||
if self.webviews.get(webview_id).is_none() {
|
||||
return warn!(
|
||||
"{}: HideWebView on unknown top-level browsing context",
|
||||
webview_id
|
||||
);
|
||||
}
|
||||
self.compositor_proxy
|
||||
.send(CompositorMsg::HideWebView(webview_id));
|
||||
},
|
||||
FromCompositorMsg::RaiseWebViewToTop(webview_id, hide_others) => {
|
||||
if self.webviews.get(webview_id).is_none() {
|
||||
return warn!(
|
||||
"{}: RaiseWebViewToTop on unknown top-level browsing context",
|
||||
webview_id
|
||||
);
|
||||
}
|
||||
self.compositor_proxy
|
||||
.send(CompositorMsg::RaiseWebViewToTop(webview_id, hide_others));
|
||||
},
|
||||
FromCompositorMsg::FocusWebView(top_level_browsing_context_id) => {
|
||||
if self.webviews.get(top_level_browsing_context_id).is_none() {
|
||||
return warn!("{top_level_browsing_context_id}: FocusWebView on unknown top-level browsing context");
|
||||
|
@ -2975,11 +2942,6 @@ where
|
|||
) {
|
||||
let window_size = self.window_size.initial_viewport;
|
||||
let pipeline_id = PipelineId::new();
|
||||
let msg = (
|
||||
Some(top_level_browsing_context_id),
|
||||
EmbedderMsg::WebViewOpened(top_level_browsing_context_id),
|
||||
);
|
||||
self.embedder_proxy.send(msg);
|
||||
let browsing_context_id = BrowsingContextId::from(top_level_browsing_context_id);
|
||||
let load_data = LoadData::new(
|
||||
LoadOrigin::Constellation,
|
||||
|
|
|
@ -76,12 +76,9 @@ mod from_compositor {
|
|||
Self::Reload(..) => target!("Reload"),
|
||||
Self::LogEntry(..) => target!("LogEntry"),
|
||||
Self::NewWebView(..) => target!("NewWebView"),
|
||||
Self::WebViewOpened(..) => target!("WebViewOpened"),
|
||||
Self::CloseWebView(..) => target!("CloseWebView"),
|
||||
Self::SendError(..) => target!("SendError"),
|
||||
Self::MoveResizeWebView(..) => target!("MoveResizeWebView"),
|
||||
Self::ShowWebView(..) => target!("ShowWebView"),
|
||||
Self::HideWebView(..) => target!("HideWebView"),
|
||||
Self::RaiseWebViewToTop(..) => target!("RaiseWebViewToTop"),
|
||||
Self::FocusWebView(..) => target!("FocusWebView"),
|
||||
Self::BlurWebView => target!("BlurWebView"),
|
||||
Self::ForwardEvent(_, event) => event.log_target(),
|
||||
|
|
|
@ -57,18 +57,12 @@ pub enum ConstellationMsg {
|
|||
LogEntry(Option<TopLevelBrowsingContextId>, Option<String>, LogEntry),
|
||||
/// Create a new top level browsing context.
|
||||
NewWebView(ServoUrl, TopLevelBrowsingContextId),
|
||||
/// A top level browsing context is created in both constellation and compositor.
|
||||
WebViewOpened(TopLevelBrowsingContextId),
|
||||
/// Close a top level browsing context.
|
||||
CloseWebView(TopLevelBrowsingContextId),
|
||||
/// Panic a top level browsing context.
|
||||
SendError(Option<TopLevelBrowsingContextId>, String),
|
||||
/// Move and/or resize a webview to the given rect.
|
||||
MoveResizeWebView(TopLevelBrowsingContextId, DeviceRect),
|
||||
/// Start painting a webview, and optionally stop painting all others.
|
||||
ShowWebView(TopLevelBrowsingContextId, bool),
|
||||
/// Stop painting a webview.
|
||||
HideWebView(TopLevelBrowsingContextId),
|
||||
/// Start painting a webview on top of all others, and optionally stop painting all others.
|
||||
RaiseWebViewToTop(TopLevelBrowsingContextId, bool),
|
||||
/// Make a webview focused.
|
||||
FocusWebView(TopLevelBrowsingContextId),
|
||||
/// Make none of the webviews focused.
|
||||
|
@ -121,11 +115,8 @@ impl ConstellationMsg {
|
|||
Reload(..) => "Reload",
|
||||
LogEntry(..) => "LogEntry",
|
||||
NewWebView(..) => "NewWebView",
|
||||
WebViewOpened(..) => "WebViewOpened",
|
||||
CloseWebView(..) => "CloseWebView",
|
||||
MoveResizeWebView(..) => "MoveResizeWebView",
|
||||
ShowWebView(..) => "ShowWebView",
|
||||
HideWebView(..) => "HideWebView",
|
||||
RaiseWebViewToTop(..) => "RaiseWebViewToTop",
|
||||
FocusWebView(..) => "FocusWebView",
|
||||
BlurWebView => "BlurWebView",
|
||||
SendError(..) => "SendError",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue