mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
libservo: Add WebView
immediately to the Compositor (#35662)
When creating a `WebView`, let the Compositor know synchronously that it exists. This allows the embedder to immediately call methods like `WebView::focus()`. In addition remove messages associated with the `WebViewDelegate::notify_ready_to_show()` method (and the method itself), as now `WebView`s can be shown immediately. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
de66f72197
commit
9d5171f3c5
12 changed files with 46 additions and 89 deletions
|
@ -109,6 +109,10 @@ impl RunningAppState {
|
|||
pub(crate) fn new_toplevel_webview(self: &Rc<Self>, url: Url) {
|
||||
let webview = self.servo().new_webview(url);
|
||||
webview.set_delegate(self.clone());
|
||||
|
||||
webview.focus();
|
||||
webview.raise_to_top(true);
|
||||
|
||||
self.add(webview);
|
||||
}
|
||||
|
||||
|
@ -464,13 +468,12 @@ impl WebViewDelegate for RunningAppState {
|
|||
) -> Option<servo::WebView> {
|
||||
let webview = self.servo.new_auxiliary_webview();
|
||||
webview.set_delegate(parent_webview.delegate());
|
||||
self.add(webview.clone());
|
||||
Some(webview)
|
||||
}
|
||||
|
||||
fn notify_ready_to_show(&self, webview: servo::WebView) {
|
||||
webview.focus();
|
||||
webview.raise_to_top(true);
|
||||
|
||||
self.add(webview.clone());
|
||||
Some(webview)
|
||||
}
|
||||
|
||||
fn notify_closed(&self, webview: servo::WebView) {
|
||||
|
|
|
@ -127,10 +127,6 @@ impl WebViewDelegate for RunningAppState {
|
|||
.notify_load_status_changed(load_status);
|
||||
}
|
||||
|
||||
fn notify_ready_to_show(&self, webview: WebView) {
|
||||
webview.focus();
|
||||
}
|
||||
|
||||
fn notify_closed(&self, webview: WebView) {
|
||||
{
|
||||
let mut inner_mut = self.inner_mut();
|
||||
|
@ -308,6 +304,7 @@ impl RunningAppState {
|
|||
pub(crate) fn new_toplevel_webview(self: &Rc<Self>, url: Url) {
|
||||
let webview = self.servo.new_webview(url);
|
||||
webview.set_delegate(self.clone());
|
||||
webview.focus();
|
||||
self.add(webview.clone());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue