mirror of
https://github.com/servo/servo.git
synced 2025-08-15 10:25:32 +01:00
servoshell: Do not focus and raise new auxiliary WebDriver-created WebView
s (#37284)
For Desktop port of `request_open_auxiliary_webview`, stay on the original WebView if the request originates WebDriver. This is to make sure `webdriver_server::handle_new_window` does not focus the new window, according to spec. Seec7eba2dbba/tests/wpt/tests/webdriver/tests/classic/new_window/new_window.py (L31-L37)
**To clarify**: this won't change the behaviour when user interacts, but only affects WebDriver [New Window](https://w3c.github.io/webdriver/#new-window). Testing: `./mach test-wpt -r --log-raw "D:/servo log/all.txt" ./tests/wpt/tests/webdriver/tests/classic --product servodriver` based on96b0973037
--------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
parent
0fa3de3937
commit
a3c792e5aa
27 changed files with 76 additions and 158 deletions
|
@ -12,7 +12,7 @@ use image::{DynamicImage, ImageFormat};
|
|||
use keyboard_types::{Key, KeyboardEvent, Modifiers, ShortcutMatcher};
|
||||
use log::{error, info};
|
||||
use servo::base::id::WebViewId;
|
||||
use servo::config::pref;
|
||||
use servo::config::{opts, pref};
|
||||
use servo::ipc_channel::ipc::IpcSender;
|
||||
use servo::webrender_api::ScrollLocation;
|
||||
use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize};
|
||||
|
@ -477,9 +477,13 @@ impl WebViewDelegate for RunningAppState {
|
|||
.build();
|
||||
|
||||
webview.notify_theme_change(self.inner().window.theme());
|
||||
webview.focus();
|
||||
webview.raise_to_top(true);
|
||||
|
||||
// When WebDriver is enabled, do not focus and raise the WebView to the top,
|
||||
// as that is what the specification expects. Otherwise, we would like `window.open()`
|
||||
// to create a new foreground tab
|
||||
if opts::get().webdriver_port.is_some() {
|
||||
webview.focus();
|
||||
webview.raise_to_top(true);
|
||||
}
|
||||
self.add(webview.clone());
|
||||
Some(webview)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue