diff --git a/components/constellation/tracing.rs b/components/constellation/tracing.rs index bccfdf17b90..78ac8ae8fd9 100644 --- a/components/constellation/tracing.rs +++ b/components/constellation/tracing.rs @@ -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)") }, diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index be6ee41e599..497decca433 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -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 diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 6c62e22cb18..1e8f89d9b66 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -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( diff --git a/components/servo/webview_delegate.rs b/components/servo/webview_delegate.rs index 204eaf2f4d7..c84ef699647 100644 --- a/components/servo/webview_delegate.rs +++ b/components/servo/webview_delegate.rs @@ -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 `