mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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::NewFavicon(..) => target_variant!("NewFavicon"),
|
||||
Self::HistoryChanged(..) => target_variant!("HistoryChanged"),
|
||||
Self::SetFullscreenState(..) => target_variant!("SetFullscreenState"),
|
||||
Self::NotifyFullscreenStateChanged(..) => {
|
||||
target_variant!("NotifyFullscreenStateChanged")
|
||||
},
|
||||
Self::NotifyLoadStatusChanged(_, LoadStatus::Started) => {
|
||||
target_variant!("NotifyLoadStatusChanged(LoadStatus::Started)")
|
||||
},
|
||||
|
|
|
@ -4250,7 +4250,7 @@ impl Document {
|
|||
let window = self.window();
|
||||
// Step 6
|
||||
if !error {
|
||||
let event = EmbedderMsg::SetFullscreenState(self.webview_id(), true);
|
||||
let event = EmbedderMsg::NotifyFullscreenStateChanged(self.webview_id(), true);
|
||||
self.send_to_embedder(event);
|
||||
}
|
||||
|
||||
|
@ -4292,7 +4292,7 @@ impl Document {
|
|||
|
||||
let window = self.window();
|
||||
// Step 8
|
||||
let event = EmbedderMsg::SetFullscreenState(self.webview_id(), false);
|
||||
let event = EmbedderMsg::NotifyFullscreenStateChanged(self.webview_id(), false);
|
||||
self.send_to_embedder(event);
|
||||
|
||||
// Step 9
|
||||
|
|
|
@ -871,11 +871,11 @@ impl Servo {
|
|||
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) {
|
||||
webview
|
||||
.delegate()
|
||||
.request_fullscreen_state_change(webview, fullscreen);
|
||||
.notify_fullscreen_state_changed(webview, fullscreen);
|
||||
}
|
||||
},
|
||||
EmbedderMsg::WebResourceRequested(
|
||||
|
|
|
@ -188,6 +188,12 @@ pub trait WebViewDelegate {
|
|||
/// Notifies the embedder about media session events
|
||||
/// (i.e. when there is metadata for the active media session, playback state changes...).
|
||||
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
|
||||
/// nested `<iframe>`s. [`NavigationRequest`]s are accepted by default.
|
||||
|
@ -239,9 +245,6 @@ pub trait WebViewDelegate {
|
|||
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.
|
||||
/// TODO: This API needs to be reworked to match the new model of how responses are sent.
|
||||
fn show_bluetooth_device_dialog(
|
||||
|
|
|
@ -209,8 +209,8 @@ pub enum EmbedderMsg {
|
|||
NewFavicon(WebViewId, ServoUrl),
|
||||
/// The history state has changed.
|
||||
HistoryChanged(WebViewId, Vec<ServoUrl>, usize),
|
||||
/// Enter or exit fullscreen
|
||||
SetFullscreenState(WebViewId, bool),
|
||||
/// Entered or exited fullscreen.
|
||||
NotifyFullscreenStateChanged(WebViewId, bool),
|
||||
/// The [`LoadStatus`] of the Given `WebView` has changed.
|
||||
NotifyLoadStatusChanged(WebViewId, LoadStatus),
|
||||
WebResourceRequested(
|
||||
|
@ -277,7 +277,9 @@ impl Debug for EmbedderMsg {
|
|||
EmbedderMsg::SetCursor(..) => write!(f, "SetCursor"),
|
||||
EmbedderMsg::NewFavicon(..) => write!(f, "NewFavicon"),
|
||||
EmbedderMsg::HistoryChanged(..) => write!(f, "HistoryChanged"),
|
||||
EmbedderMsg::SetFullscreenState(..) => write!(f, "SetFullscreenState"),
|
||||
EmbedderMsg::NotifyFullscreenStateChanged(..) => {
|
||||
write!(f, "NotifyFullscreenStateChanged")
|
||||
},
|
||||
EmbedderMsg::NotifyLoadStatusChanged(_, status) => {
|
||||
write!(f, "NotifyLoadStatusChanged({status:?})")
|
||||
},
|
||||
|
|
|
@ -473,7 +473,7 @@ impl WebViewDelegate for RunningAppState {
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue