summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Applications/Browser/Tab.cpp5
-rw-r--r--Userland/Libraries/LibWebView/OutOfProcessWebView.cpp7
-rw-r--r--Userland/Libraries/LibWebView/OutOfProcessWebView.h2
-rw-r--r--Userland/Libraries/LibWebView/ViewImplementation.h1
-rw-r--r--Userland/Libraries/LibWebView/WebContentClient.cpp5
-rw-r--r--Userland/Libraries/LibWebView/WebContentClient.h1
-rw-r--r--Userland/Services/WebContent/WebContentClient.ipc1
-rw-r--r--Userland/Services/WebContent/WebDriverClient.ipc1
-rw-r--r--Userland/Services/WebContent/WebDriverConnection.cpp22
-rw-r--r--Userland/Services/WebContent/WebDriverConnection.h1
-rw-r--r--Userland/Services/WebDriver/Client.cpp10
-rw-r--r--Userland/Services/WebDriver/Client.h1
12 files changed, 57 insertions, 0 deletions
diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp
index e78e2c3091..ec0c910366 100644
--- a/Userland/Applications/Browser/Tab.cpp
+++ b/Userland/Applications/Browser/Tab.cpp
@@ -287,6 +287,11 @@ Tab::Tab(BrowserWindow& window)
return this->window().rect();
};
+ view().on_fullscreen_window = [this]() {
+ this->window().set_fullscreen(true);
+ return this->window().rect();
+ };
+
m_link_context_menu = GUI::Menu::construct();
auto link_default_action = GUI::Action::create("&Open", g_icon_bag.go_to, [this](auto&) {
view().on_link_click(m_link_context_menu_url, "", 0);
diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp
index 01ce929653..640b4109fc 100644
--- a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp
+++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp
@@ -473,6 +473,13 @@ Gfx::IntRect OutOfProcessWebView::notify_server_did_request_minimize_window()
return {};
}
+Gfx::IntRect OutOfProcessWebView::notify_server_did_request_fullscreen_window()
+{
+ if (on_fullscreen_window)
+ return on_fullscreen_window();
+ return {};
+}
+
void OutOfProcessWebView::notify_server_did_request_file(Badge<WebContentClient>, String const& path, i32 request_id)
{
auto file = FileSystemAccessClient::Client::the().try_request_file_read_only_approved(window(), path);
diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.h b/Userland/Libraries/LibWebView/OutOfProcessWebView.h
index 633514d627..8ee72fcad8 100644
--- a/Userland/Libraries/LibWebView/OutOfProcessWebView.h
+++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.h
@@ -106,6 +106,7 @@ public:
Function<Gfx::IntSize(Gfx::IntSize const&)> on_resize_window;
Function<Gfx::IntRect()> on_maximize_window;
Function<Gfx::IntRect()> on_minimize_window;
+ Function<Gfx::IntRect()> on_fullscreen_window;
private:
OutOfProcessWebView();
@@ -174,6 +175,7 @@ private:
virtual Gfx::IntSize notify_server_did_request_resize_window(Gfx::IntSize const&) override;
virtual Gfx::IntRect notify_server_did_request_maximize_window() override;
virtual Gfx::IntRect notify_server_did_request_minimize_window() override;
+ virtual Gfx::IntRect notify_server_did_request_fullscreen_window() override;
virtual void notify_server_did_request_file(Badge<WebContentClient>, String const& path, i32) override;
void request_repaint();
diff --git a/Userland/Libraries/LibWebView/ViewImplementation.h b/Userland/Libraries/LibWebView/ViewImplementation.h
index b251b49c0d..4d72c53af6 100644
--- a/Userland/Libraries/LibWebView/ViewImplementation.h
+++ b/Userland/Libraries/LibWebView/ViewImplementation.h
@@ -61,6 +61,7 @@ public:
virtual Gfx::IntSize notify_server_did_request_resize_window(Gfx::IntSize const&) = 0;
virtual Gfx::IntRect notify_server_did_request_maximize_window() = 0;
virtual Gfx::IntRect notify_server_did_request_minimize_window() = 0;
+ virtual Gfx::IntRect notify_server_did_request_fullscreen_window() = 0;
virtual void notify_server_did_request_file(Badge<WebContentClient>, String const& path, i32) = 0;
};
diff --git a/Userland/Libraries/LibWebView/WebContentClient.cpp b/Userland/Libraries/LibWebView/WebContentClient.cpp
index b01091e363..bea1d30057 100644
--- a/Userland/Libraries/LibWebView/WebContentClient.cpp
+++ b/Userland/Libraries/LibWebView/WebContentClient.cpp
@@ -255,6 +255,11 @@ Messages::WebContentClient::DidRequestMinimizeWindowResponse WebContentClient::d
return m_view.notify_server_did_request_minimize_window();
}
+Messages::WebContentClient::DidRequestFullscreenWindowResponse WebContentClient::did_request_fullscreen_window()
+{
+ return m_view.notify_server_did_request_fullscreen_window();
+}
+
void WebContentClient::did_request_file(String const& path, i32 request_id)
{
m_view.notify_server_did_request_file({}, path, request_id);
diff --git a/Userland/Libraries/LibWebView/WebContentClient.h b/Userland/Libraries/LibWebView/WebContentClient.h
index 8ce4bd2833..c8c4752259 100644
--- a/Userland/Libraries/LibWebView/WebContentClient.h
+++ b/Userland/Libraries/LibWebView/WebContentClient.h
@@ -72,6 +72,7 @@ private:
virtual Messages::WebContentClient::DidRequestResizeWindowResponse did_request_resize_window(Gfx::IntSize const&) override;
virtual Messages::WebContentClient::DidRequestMaximizeWindowResponse did_request_maximize_window() override;
virtual Messages::WebContentClient::DidRequestMinimizeWindowResponse did_request_minimize_window() override;
+ virtual Messages::WebContentClient::DidRequestFullscreenWindowResponse did_request_fullscreen_window() override;
virtual void did_request_file(String const& path, i32) override;
ViewImplementation& m_view;
diff --git a/Userland/Services/WebContent/WebContentClient.ipc b/Userland/Services/WebContent/WebContentClient.ipc
index b215a2008f..ea18488e0a 100644
--- a/Userland/Services/WebContent/WebContentClient.ipc
+++ b/Userland/Services/WebContent/WebContentClient.ipc
@@ -50,6 +50,7 @@ endpoint WebContentClient
did_request_resize_window(Gfx::IntSize size) => (Gfx::IntSize window_size)
did_request_maximize_window() => (Gfx::IntRect window_rect)
did_request_minimize_window() => (Gfx::IntRect window_rect)
+ did_request_fullscreen_window() => (Gfx::IntRect window_rect)
did_request_file(String path, i32 request_id) =|
did_output_js_console_message(i32 message_index) =|
diff --git a/Userland/Services/WebContent/WebDriverClient.ipc b/Userland/Services/WebContent/WebDriverClient.ipc
index fea31a636a..d330dc902d 100644
--- a/Userland/Services/WebContent/WebDriverClient.ipc
+++ b/Userland/Services/WebContent/WebDriverClient.ipc
@@ -15,6 +15,7 @@ endpoint WebDriverClient {
set_window_rect(JsonValue payload) => (Web::WebDriver::Response response)
maximize_window() => (Web::WebDriver::Response response)
minimize_window() => (Web::WebDriver::Response response)
+ fullscreen_window() => (Web::WebDriver::Response response)
find_element(JsonValue payload) => (Web::WebDriver::Response response)
find_elements(JsonValue payload) => (Web::WebDriver::Response response)
find_element_from_element(JsonValue payload, String element_id) => (Web::WebDriver::Response response)
diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp
index e42a30206b..6ec4699585 100644
--- a/Userland/Services/WebContent/WebDriverConnection.cpp
+++ b/Userland/Services/WebContent/WebDriverConnection.cpp
@@ -515,6 +515,28 @@ Messages::WebDriverClient::MinimizeWindowResponse WebDriverConnection::minimize_
return serialize_rect(window_rect);
}
+// 11.8.5 Fullscreen Window, https://w3c.github.io/webdriver/#dfn-fullscreen-window
+Messages::WebDriverClient::FullscreenWindowResponse WebDriverConnection::fullscreen_window()
+{
+ // 1. If the remote end does not support fullscreen 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(ensure_open_top_level_browsing_context());
+
+ // FIXME: 3. Handle any user prompts and return its value if it is an error.
+
+ // 4. Restore the window.
+ restore_the_window();
+
+ // 5. FIXME: Call fullscreen an element with the current top-level browsing context’s active document’s document element.
+ // As described in https://fullscreen.spec.whatwg.org/#fullscreen-an-element
+ // NOTE: What we do here is basically `requestFullscreen(options)` with options["navigationUI"]="show"
+ auto rect = m_web_content_client.did_request_fullscreen_window();
+
+ // 6. Return success with data set to the WindowRect object for the current top-level browsing context.
+ return serialize_rect(rect);
+}
+
// 12.3.2 Find Element, https://w3c.github.io/webdriver/#dfn-find-element
Messages::WebDriverClient::FindElementResponse WebDriverConnection::find_element(JsonValue const& payload)
{
diff --git a/Userland/Services/WebContent/WebDriverConnection.h b/Userland/Services/WebContent/WebDriverConnection.h
index 64c8c54fdf..91893bf24c 100644
--- a/Userland/Services/WebContent/WebDriverConnection.h
+++ b/Userland/Services/WebContent/WebDriverConnection.h
@@ -48,6 +48,7 @@ private:
virtual Messages::WebDriverClient::SetWindowRectResponse set_window_rect(JsonValue const& payload) override;
virtual Messages::WebDriverClient::MaximizeWindowResponse maximize_window() override;
virtual Messages::WebDriverClient::MinimizeWindowResponse minimize_window() override;
+ virtual Messages::WebDriverClient::FullscreenWindowResponse fullscreen_window() override;
virtual Messages::WebDriverClient::FindElementResponse find_element(JsonValue const& payload) override;
virtual Messages::WebDriverClient::FindElementsResponse find_elements(JsonValue const& payload) override;
virtual Messages::WebDriverClient::FindElementFromElementResponse find_element_from_element(JsonValue const& payload, String const& element_id) override;
diff --git a/Userland/Services/WebDriver/Client.cpp b/Userland/Services/WebDriver/Client.cpp
index 40adf432d8..48a8940d12 100644
--- a/Userland/Services/WebDriver/Client.cpp
+++ b/Userland/Services/WebDriver/Client.cpp
@@ -43,6 +43,7 @@ Vector<Client::Route> Client::s_routes = {
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "window", "rect" }, &Client::handle_set_window_rect },
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "window", "maximize" }, &Client::handle_maximize_window },
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "window", "minimize" }, &Client::handle_minimize_window },
+ { HTTP::HttpRequest::Method::POST, { "session", ":session_id", "window", "fullscreen" }, &Client::handle_fullscreen_window },
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "element" }, &Client::handle_find_element },
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "elements" }, &Client::handle_find_elements },
{ HTTP::HttpRequest::Method::POST, { "session", ":session_id", "element", ":element_id", "element" }, &Client::handle_find_element_from_element },
@@ -608,6 +609,15 @@ Web::WebDriver::Response Client::handle_minimize_window(Vector<StringView> const
return session->web_content_connection().minimize_window();
}
+// 11.8.5 Fullscreen Window, https://w3c.github.io/webdriver/#dfn-fullscreen-window
+// POST /session/{session id}/window/fullscreen
+Web::WebDriver::Response Client::handle_fullscreen_window(Vector<StringView> const& parameters, JsonValue const&)
+{
+ dbgln_if(WEBDRIVER_DEBUG, "Handling POST /session/<session_id>/window/fullscreen");
+ auto* session = TRY(find_session_with_id(parameters[0]));
+ return session->web_content_connection().fullscreen_window();
+}
+
// 12.3.2 Find Element, https://w3c.github.io/webdriver/#dfn-find-element
// POST /session/{session id}/element
Web::WebDriver::Response Client::handle_find_element(Vector<StringView> const& parameters, JsonValue const& payload)
diff --git a/Userland/Services/WebDriver/Client.h b/Userland/Services/WebDriver/Client.h
index f9a02fbc50..766ddc0ca2 100644
--- a/Userland/Services/WebDriver/Client.h
+++ b/Userland/Services/WebDriver/Client.h
@@ -67,6 +67,7 @@ private:
Web::WebDriver::Response handle_set_window_rect(Vector<StringView> const&, JsonValue const& payload);
Web::WebDriver::Response handle_maximize_window(Vector<StringView> const&, JsonValue const& payload);
Web::WebDriver::Response handle_minimize_window(Vector<StringView> const&, JsonValue const& payload);
+ Web::WebDriver::Response handle_fullscreen_window(Vector<StringView> const&, JsonValue const& payload);
Web::WebDriver::Response handle_find_element(Vector<StringView> const&, JsonValue const& payload);
Web::WebDriver::Response handle_find_elements(Vector<StringView> const&, JsonValue const& payload);
Web::WebDriver::Response handle_find_element_from_element(Vector<StringView> const&, JsonValue const& payload);