diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp index 3c64233791..0a1f899c51 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp @@ -412,4 +412,9 @@ void OutOfProcessWebView::js_console_input(const String& js_source) client().async_js_console_input(js_source); } +String OutOfProcessWebView::selected_text() +{ + return client().get_selected_text(); +} + } diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.h b/Userland/Libraries/LibWeb/OutOfProcessWebView.h index ff7cac6151..f90091210d 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.h +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.h @@ -35,6 +35,8 @@ public: void js_console_initialize(); void js_console_input(const String& js_source); + String selected_text(); + void notify_server_did_layout(Badge, const Gfx::IntSize& content_size); void notify_server_did_paint(Badge, i32 bitmap_id); void notify_server_did_invalidate_content_rect(Badge, const Gfx::IntRect&); diff --git a/Userland/Services/WebContent/ClientConnection.cpp b/Userland/Services/WebContent/ClientConnection.cpp index b2ed2a32eb..3efcf3a6d0 100644 --- a/Userland/Services/WebContent/ClientConnection.cpp +++ b/Userland/Services/WebContent/ClientConnection.cpp @@ -243,4 +243,9 @@ void ClientConnection::js_console_input(const String& js_source) m_console_client->handle_input(js_source); } +Messages::WebContentServer::GetSelectedTextResponse ClientConnection::get_selected_text() +{ + return page().focused_context().selected_text(); +} + } diff --git a/Userland/Services/WebContent/ClientConnection.h b/Userland/Services/WebContent/ClientConnection.h index 6ceb158597..2d87326497 100644 --- a/Userland/Services/WebContent/ClientConnection.h +++ b/Userland/Services/WebContent/ClientConnection.h @@ -51,6 +51,7 @@ private: virtual void inspect_dom_tree() override; virtual void js_console_initialize() override; virtual void js_console_input(String const&) override; + virtual Messages::WebContentServer::GetSelectedTextResponse get_selected_text() override; void flush_pending_paint_requests(); diff --git a/Userland/Services/WebContent/WebContentServer.ipc b/Userland/Services/WebContent/WebContentServer.ipc index 92e80b676c..cc966cddea 100644 --- a/Userland/Services/WebContent/WebContentServer.ipc +++ b/Userland/Services/WebContent/WebContentServer.ipc @@ -29,4 +29,6 @@ endpoint WebContentServer inspect_dom_tree() =| js_console_initialize() =| js_console_input(String js_source) =| + + get_selected_text() => (String selection) }