-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
servoshell: Share WebView management between desktop and EGL platforms #40766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Desktop and EGL implementations were maintaining identical WebView collection logic (HashMap, creation order tracking, focus management). Extracted this into a shared WebViewCollection struct in RunningAppStateBase. Both platforms now use the common implementation through trait methods Signed-off-by: atbrakhi <atbrakhi@igalia.com>
|
🔨 Triggering try run (#19544110178) for Linux (WPT), Android, OpenHarmony |
|
Test results for linux-wpt from try job (#19544110178): Flaky unexpected result (47)
Stable unexpected results that are known to be intermittent (21)
|
|
✨ Try run (#19544110178) succeeded. |
1 similar comment
|
✨ Try run (#19544110178) succeeded. |
mrobinson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Just a few nits that can be fixed before landing.
| let last_created_webview_id = self.inner().creation_order.last().cloned(); | ||
| let last_created_webview_id = self | ||
| .webview_collection() | ||
| .newest() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
| impl Default for WebViewCollection { | ||
| fn default() -> Self { | ||
| Self::new() | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this entirely as well as WebViewCollection::new() and simply implement #[derive(Default)] on the WebViewCollection.
| self.base().webview_collection.borrow_mut() | ||
| } | ||
|
|
||
| /// Returns all webviews in creation order. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// Returns all webviews in creation order. | |
| /// Returns all [`WebView`]s in creation order. |
| /// Gets the "active" webview: the focused webview if there is one, | ||
| /// otherwise the most recently created webview. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// Gets the "active" webview: the focused webview if there is one, | |
| /// otherwise the most recently created webview. | |
| /// Gets the "active" [`WebView`]: the focused [`WebView`] if there is one, | |
| /// otherwise the most recently created [`WebView`]. |
| /// Gets the "active" webview, panicking if there is none. | ||
| /// This is a convenience method for platforms that assume there's always an active webview. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// Gets the "active" webview, panicking if there is none. | |
| /// This is a convenience method for platforms that assume there's always an active webview. | |
| /// Gets the "active" [`WebView`], panicking if there is none. | |
| /// This is a convenience method for platforms that assume there's always an active [`WebView`]. |
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Desktop and EGL implementations were maintaining identical WebView collection logic (HashMap, creation order tracking, focus management).
Extracted this into a shared WebViewCollection struct in RunningAppStateBase. Both platforms now use the common implementation through trait methods
Testing: Existing tests should cover this change.
Fixes: part of #40530