mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
webdriver: Move NewWebView
, FocusWebView
, GetWindowSize
, and SetWindowSize
to servoshell (#37555)
Follow up to: https://github.com/servo/servo/pull/36714 Moving webdriver [context commands](https://www.w3.org/TR/webdriver2/#contexts) to be handled in embedder: - [x] New Window command - `WebdriverCommandMsg::NewWebView` - [x] Switch To Window command - `WebdriverCommandMsg::FocusWebView` - [x] Resizing commands cc: @xiaochengh --------- Signed-off-by: batu_hoang <longvatrong111@gmail.com>
This commit is contained in:
parent
5ea003752a
commit
d970584332
8 changed files with 148 additions and 97 deletions
|
@ -20,7 +20,7 @@ use servo_url::ServoUrl;
|
|||
use style_traits::CSSPixel;
|
||||
use webdriver::common::{WebElement, WebFrame, WebWindow};
|
||||
use webdriver::error::ErrorStatus;
|
||||
use webrender_api::units::DeviceIntSize;
|
||||
use webrender_api::units::{DeviceIntSize, DevicePixel};
|
||||
|
||||
use crate::{MouseButton, MouseButtonAction};
|
||||
|
||||
|
@ -31,7 +31,9 @@ pub struct WebDriverMessageId(pub usize);
|
|||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum WebDriverCommandMsg {
|
||||
/// Get the window size.
|
||||
GetWindowSize(WebViewId, IpcSender<Size2D<f32, CSSPixel>>),
|
||||
GetWindowSize(WebViewId, IpcSender<Size2D<i32, DevicePixel>>),
|
||||
/// Get the viewport size.
|
||||
GetViewportSize(WebViewId, IpcSender<Size2D<f32, CSSPixel>>),
|
||||
/// Load a URL in the top-level browsing context with the given ID.
|
||||
LoadUrl(WebViewId, ServoUrl, IpcSender<WebDriverLoadStatus>),
|
||||
/// Refresh the top-level browsing context with the given ID.
|
||||
|
@ -83,7 +85,11 @@ pub enum WebDriverCommandMsg {
|
|||
IpcSender<WebDriverCommandResponse>,
|
||||
),
|
||||
/// Set the window size.
|
||||
SetWindowSize(WebViewId, DeviceIntSize, IpcSender<Size2D<f32, CSSPixel>>),
|
||||
SetWindowSize(
|
||||
WebViewId,
|
||||
DeviceIntSize,
|
||||
IpcSender<Size2D<i32, DevicePixel>>,
|
||||
),
|
||||
/// Take a screenshot of the window.
|
||||
TakeScreenshot(
|
||||
WebViewId,
|
||||
|
@ -94,15 +100,13 @@ pub enum WebDriverCommandMsg {
|
|||
/// the provided channels to return the top level browsing context id
|
||||
/// associated with the new webview, and a notification when the initial
|
||||
/// load is complete.
|
||||
NewWebView(
|
||||
WebViewId,
|
||||
IpcSender<WebViewId>,
|
||||
IpcSender<WebDriverLoadStatus>,
|
||||
),
|
||||
NewWebView(IpcSender<WebViewId>, IpcSender<WebDriverLoadStatus>),
|
||||
/// Close the webview associated with the provided id.
|
||||
CloseWebView(WebViewId),
|
||||
/// Focus the webview associated with the provided id.
|
||||
FocusWebView(WebViewId),
|
||||
/// Get focused webview.
|
||||
GetFocusedWebView(IpcSender<Option<WebViewId>>),
|
||||
/// Check whether top-level browsing context is open.
|
||||
IsWebViewOpen(WebViewId, IpcSender<bool>),
|
||||
/// Check whether browsing context is open.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue