1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:27:35 +00:00

Browser+WebContent+WebDriver: Move [Max,Min]imize Window to WebContent

This also lets us more fully implement the "iconify the window" method,
which requires we block until the document reaches the "hidden" state.
This commit is contained in:
Timothy Flynn 2022-11-09 11:00:53 -05:00 committed by Linus Groh
parent 1c398b32ce
commit 03d0c7a5b6
9 changed files with 75 additions and 86 deletions

View file

@ -311,45 +311,6 @@ static JsonValue serialize_rect(Gfx::IntRect const& rect)
return serialized_rect;
}
// 11.8.3 Maximize Window, https://w3c.github.io/webdriver/#dfn-maximize-window
Web::WebDriver::Response Session::maximize_window()
{
// 1. If the remote end does not support the Maximize Window command for the current top-level browsing context for any reason, return error with error code unsupported operation.
// 2. If the current top-level browsing context is no longer open, return error with error code no such window.
TRY(check_for_open_top_level_browsing_context_or_return_error());
// FIXME: 3. Handle any user prompts and return its value if it is an error.
// FIXME: 4. Fully exit fullscreen.
// 5. Restore the window.
m_browser_connection->async_restore_window();
// 6. Maximize the window of the current top-level browsing context.
m_browser_connection->async_maximize_window();
// 7. Return success with data set to the WindowRect object for the current top-level browsing context.
return serialize_rect(m_browser_connection->get_window_rect());
}
// 11.8.4 Minimize Window, https://w3c.github.io/webdriver/#minimize-window
Web::WebDriver::Response Session::minimize_window()
{
// 1. If the remote end does not support the Minimize Window command for the current top-level browsing context for any reason, return error with error code unsupported operation.
// 2. If the current top-level browsing context is no longer open, return error with error code no such window.
TRY(check_for_open_top_level_browsing_context_or_return_error());
// FIXME: 3. Handle any user prompts and return its value if it is an error.
// FIXME: 4. Fully exit fullscreen.
// 5. Iconify the window.
m_browser_connection->async_minimize_window();
// 6. Return success with data set to the WindowRect object for the current top-level browsing context.
return serialize_rect(m_browser_connection->get_window_rect());
}
// https://w3c.github.io/webdriver/#dfn-get-or-create-a-web-element-reference
static String get_or_create_a_web_element_reference(Session::LocalElement const& element)
{