mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
libservo: change 'request_fullscreen_state_change' API to a notification (#35445)
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
parent
3a63622d6b
commit
c95bd9d052
6 changed files with 19 additions and 12 deletions
|
@ -220,7 +220,9 @@ mod from_script {
|
||||||
Self::SetCursor(..) => target_variant!("SetCursor"),
|
Self::SetCursor(..) => target_variant!("SetCursor"),
|
||||||
Self::NewFavicon(..) => target_variant!("NewFavicon"),
|
Self::NewFavicon(..) => target_variant!("NewFavicon"),
|
||||||
Self::HistoryChanged(..) => target_variant!("HistoryChanged"),
|
Self::HistoryChanged(..) => target_variant!("HistoryChanged"),
|
||||||
Self::SetFullscreenState(..) => target_variant!("SetFullscreenState"),
|
Self::NotifyFullscreenStateChanged(..) => {
|
||||||
|
target_variant!("NotifyFullscreenStateChanged")
|
||||||
|
},
|
||||||
Self::NotifyLoadStatusChanged(_, LoadStatus::Started) => {
|
Self::NotifyLoadStatusChanged(_, LoadStatus::Started) => {
|
||||||
target_variant!("NotifyLoadStatusChanged(LoadStatus::Started)")
|
target_variant!("NotifyLoadStatusChanged(LoadStatus::Started)")
|
||||||
},
|
},
|
||||||
|
|
|
@ -4250,7 +4250,7 @@ impl Document {
|
||||||
let window = self.window();
|
let window = self.window();
|
||||||
// Step 6
|
// Step 6
|
||||||
if !error {
|
if !error {
|
||||||
let event = EmbedderMsg::SetFullscreenState(self.webview_id(), true);
|
let event = EmbedderMsg::NotifyFullscreenStateChanged(self.webview_id(), true);
|
||||||
self.send_to_embedder(event);
|
self.send_to_embedder(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4292,7 +4292,7 @@ impl Document {
|
||||||
|
|
||||||
let window = self.window();
|
let window = self.window();
|
||||||
// Step 8
|
// Step 8
|
||||||
let event = EmbedderMsg::SetFullscreenState(self.webview_id(), false);
|
let event = EmbedderMsg::NotifyFullscreenStateChanged(self.webview_id(), false);
|
||||||
self.send_to_embedder(event);
|
self.send_to_embedder(event);
|
||||||
|
|
||||||
// Step 9
|
// Step 9
|
||||||
|
|
|
@ -871,11 +871,11 @@ impl Servo {
|
||||||
webview.set_url(current_url);
|
webview.set_url(current_url);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
EmbedderMsg::SetFullscreenState(webview_id, fullscreen) => {
|
EmbedderMsg::NotifyFullscreenStateChanged(webview_id, fullscreen) => {
|
||||||
if let Some(webview) = self.get_webview_handle(webview_id) {
|
if let Some(webview) = self.get_webview_handle(webview_id) {
|
||||||
webview
|
webview
|
||||||
.delegate()
|
.delegate()
|
||||||
.request_fullscreen_state_change(webview, fullscreen);
|
.notify_fullscreen_state_changed(webview, fullscreen);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
EmbedderMsg::WebResourceRequested(
|
EmbedderMsg::WebResourceRequested(
|
||||||
|
|
|
@ -188,6 +188,12 @@ pub trait WebViewDelegate {
|
||||||
/// Notifies the embedder about media session events
|
/// Notifies the embedder about media session events
|
||||||
/// (i.e. when there is metadata for the active media session, playback state changes...).
|
/// (i.e. when there is metadata for the active media session, playback state changes...).
|
||||||
fn notify_media_session_event(&self, _webview: WebView, _event: MediaSessionEvent) {}
|
fn notify_media_session_event(&self, _webview: WebView, _event: MediaSessionEvent) {}
|
||||||
|
/// A notification that the [`WebView`] has entered or exited fullscreen mode. This is an
|
||||||
|
/// opportunity for the embedder to transition the containing window into or out of fullscreen
|
||||||
|
/// mode and to show or hide extra UI elements. Regardless of how the notification is handled,
|
||||||
|
/// the page will enter or leave fullscreen state internally according to the [Fullscreen
|
||||||
|
/// API](https://fullscreen.spec.whatwg.org/).
|
||||||
|
fn notify_fullscreen_state_changed(&self, _webview: WebView, _: bool) {}
|
||||||
|
|
||||||
/// Whether or not to allow a [`WebView`] to load a URL in its main frame or one of its
|
/// Whether or not to allow a [`WebView`] to load a URL in its main frame or one of its
|
||||||
/// nested `<iframe>`s. [`NavigationRequest`]s are accepted by default.
|
/// nested `<iframe>`s. [`NavigationRequest`]s are accepted by default.
|
||||||
|
@ -239,9 +245,6 @@ pub trait WebViewDelegate {
|
||||||
let _ = result_sender.send(ContextMenuResult::Ignored);
|
let _ = result_sender.send(ContextMenuResult::Ignored);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Enter or exit fullscreen
|
|
||||||
fn request_fullscreen_state_change(&self, _webview: WebView, _: bool) {}
|
|
||||||
|
|
||||||
/// Open dialog to select bluetooth device.
|
/// Open dialog to select bluetooth device.
|
||||||
/// TODO: This API needs to be reworked to match the new model of how responses are sent.
|
/// TODO: This API needs to be reworked to match the new model of how responses are sent.
|
||||||
fn show_bluetooth_device_dialog(
|
fn show_bluetooth_device_dialog(
|
||||||
|
|
|
@ -209,8 +209,8 @@ pub enum EmbedderMsg {
|
||||||
NewFavicon(WebViewId, ServoUrl),
|
NewFavicon(WebViewId, ServoUrl),
|
||||||
/// The history state has changed.
|
/// The history state has changed.
|
||||||
HistoryChanged(WebViewId, Vec<ServoUrl>, usize),
|
HistoryChanged(WebViewId, Vec<ServoUrl>, usize),
|
||||||
/// Enter or exit fullscreen
|
/// Entered or exited fullscreen.
|
||||||
SetFullscreenState(WebViewId, bool),
|
NotifyFullscreenStateChanged(WebViewId, bool),
|
||||||
/// The [`LoadStatus`] of the Given `WebView` has changed.
|
/// The [`LoadStatus`] of the Given `WebView` has changed.
|
||||||
NotifyLoadStatusChanged(WebViewId, LoadStatus),
|
NotifyLoadStatusChanged(WebViewId, LoadStatus),
|
||||||
WebResourceRequested(
|
WebResourceRequested(
|
||||||
|
@ -277,7 +277,9 @@ impl Debug for EmbedderMsg {
|
||||||
EmbedderMsg::SetCursor(..) => write!(f, "SetCursor"),
|
EmbedderMsg::SetCursor(..) => write!(f, "SetCursor"),
|
||||||
EmbedderMsg::NewFavicon(..) => write!(f, "NewFavicon"),
|
EmbedderMsg::NewFavicon(..) => write!(f, "NewFavicon"),
|
||||||
EmbedderMsg::HistoryChanged(..) => write!(f, "HistoryChanged"),
|
EmbedderMsg::HistoryChanged(..) => write!(f, "HistoryChanged"),
|
||||||
EmbedderMsg::SetFullscreenState(..) => write!(f, "SetFullscreenState"),
|
EmbedderMsg::NotifyFullscreenStateChanged(..) => {
|
||||||
|
write!(f, "NotifyFullscreenStateChanged")
|
||||||
|
},
|
||||||
EmbedderMsg::NotifyLoadStatusChanged(_, status) => {
|
EmbedderMsg::NotifyLoadStatusChanged(_, status) => {
|
||||||
write!(f, "NotifyLoadStatusChanged({status:?})")
|
write!(f, "NotifyLoadStatusChanged({status:?})")
|
||||||
},
|
},
|
||||||
|
|
|
@ -473,7 +473,7 @@ impl WebViewDelegate for RunningAppState {
|
||||||
self.inner_mut().need_update = true;
|
self.inner_mut().need_update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn request_fullscreen_state_change(&self, _webview: servo::WebView, fullscreen_state: bool) {
|
fn notify_fullscreen_state_changed(&self, _webview: servo::WebView, fullscreen_state: bool) {
|
||||||
self.inner().window.set_fullscreen(fullscreen_state);
|
self.inner().window.set_fullscreen(fullscreen_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue