constellation: focusing and closing webviews (#30842)

* constellation: focusing, closing, and native window visibility

* rename “browser” to “webview”, “unfocus” to “blur”

* remove native window visibility from constellation

* rename more “browser” to “webview”

* guard clauses

* don’t automatically focus when no webviews are focused

* comment spec steps for window.close()

* use format interpolation

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

* fix formatting

* rename “Webview” to “WebView” in types and type parameters

* remove unused method

* fix libsimpleservo

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Delan Azabani 2024-01-24 19:45:54 +08:00 committed by GitHub
parent 6baaa82826
commit eb95703325
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 533 additions and 285 deletions

View file

@ -55,13 +55,15 @@ pub enum ConstellationMsg {
/// A log entry, with the top-level browsing context id and thread name
LogEntry(Option<TopLevelBrowsingContextId>, Option<String>, LogEntry),
/// Create a new top level browsing context.
NewBrowser(ServoUrl, TopLevelBrowsingContextId),
NewWebView(ServoUrl, TopLevelBrowsingContextId),
/// Close a top level browsing context.
CloseBrowser(TopLevelBrowsingContextId),
CloseWebView(TopLevelBrowsingContextId),
/// Panic a top level browsing context.
SendError(Option<TopLevelBrowsingContextId>, String),
/// Make browser visible.
SelectBrowser(TopLevelBrowsingContextId),
/// Make a top-level browsing context focused.
FocusWebView(TopLevelBrowsingContextId),
/// Make none of the top-level browsing contexts focused.
BlurWebView,
/// Forward an event to the script task of the given pipeline.
ForwardEvent(PipelineId, CompositorEvent),
/// Requesting a change to the onscreen cursor.
@ -74,8 +76,8 @@ pub enum ConstellationMsg {
ExitFullScreen(TopLevelBrowsingContextId),
/// Media session action.
MediaSessionAction(MediaSessionActionType),
/// Toggle browser visibility.
ChangeBrowserVisibility(TopLevelBrowsingContextId, bool),
/// The visibility of the webview has changed.
WebViewVisibilityChanged(TopLevelBrowsingContextId, bool),
/// Virtual keyboard was dismissed
IMEDismissed,
/// Compositing done, but external code needs to present.
@ -100,17 +102,18 @@ impl fmt::Debug for ConstellationMsg {
WebDriverCommand(..) => "WebDriverCommand",
Reload(..) => "Reload",
LogEntry(..) => "LogEntry",
NewBrowser(..) => "NewBrowser",
CloseBrowser(..) => "CloseBrowser",
NewWebView(..) => "NewWebView",
CloseWebView(..) => "CloseWebView",
FocusWebView(..) => "FocusWebView",
BlurWebView => "BlurWebView",
SendError(..) => "SendError",
SelectBrowser(..) => "SelectBrowser",
ForwardEvent(..) => "ForwardEvent",
SetCursor(..) => "SetCursor",
EnableProfiler(..) => "EnableProfiler",
DisableProfiler => "DisableProfiler",
ExitFullScreen(..) => "ExitFullScreen",
MediaSessionAction(..) => "MediaSessionAction",
ChangeBrowserVisibility(..) => "ChangeBrowserVisibility",
WebViewVisibilityChanged(..) => "WebViewVisibilityChanged",
IMEDismissed => "IMEDismissed",
ClearCache => "ClearCache",
ReadyToPresent(..) => "ReadyToPresent",