mirror of
https://github.com/servo/servo
synced 2026-05-14 19:06:31 +02:00
This change makes it is that WebDriver can create whole new windows for each new `WebView` in servoshell. The motivation for this is: 1. This is how the WebDriver specification is written. The command that create a new WebView is actually called "New Window" [^1], so this increases compliance with the specification and now we obey the type hint sent with that command. 2. This change allows testing multi-window support via the WPT. 3. This will allow adding optimizations (#39923) that are otherwise impossible because the WPT expects all open `WebView` to be live and visible. This does not make the change yet for windows opened via `window.open()` (popups), as that requires #41220 to fix. In order to make this possible a few changes to the code had to take place: 1. The new `PlatformWindow` creation function has to be passed down to the WebDriver handler, which normally doesn't know how to make `PlatformWindow`s. 2. This allows moving the UI command code back to the shared part of servoshell, meaning that the embedded ports can use it as well eventually. 3. Headless windows need a real id to differeniate them now intead of just 0. 4. When dropping the headless `PlatformWindow` we need to make it current. I'm not sure why surfman doesn't do this, but this is now necessary as there are multiple contexts. This is also true when resizing the `RenderingContext`. Finally, errors when making the context current are upgraded to `error!`s as they typically break the entire execution of the program. [^1]: https://w3c.github.io/webdriver/#new-window Testing: This is tested by the entire WPT suite. Signed-off-by: Martin Robinson <mrobinson@igalia.com>