From 65bd4477dbad5dbdb8a30e2e70a4c0e0ec5e9c2b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 6 Feb 2022 19:03:13 +0100 Subject: LibWeb: Plumb OOPWV focus state across the IPC boundary This makes focus outlines show up in OOPWV at last! :^) --- Userland/Services/WebContent/ClientConnection.cpp | 5 +++++ Userland/Services/WebContent/ClientConnection.h | 1 + Userland/Services/WebContent/PageHost.cpp | 6 ++++++ Userland/Services/WebContent/PageHost.h | 2 ++ Userland/Services/WebContent/WebContentServer.ipc | 2 ++ 5 files changed, 16 insertions(+) (limited to 'Userland/Services') diff --git a/Userland/Services/WebContent/ClientConnection.cpp b/Userland/Services/WebContent/ClientConnection.cpp index 33bc6be0de..e6fbef7a06 100644 --- a/Userland/Services/WebContent/ClientConnection.cpp +++ b/Userland/Services/WebContent/ClientConnection.cpp @@ -391,4 +391,9 @@ void ClientConnection::set_preferred_color_scheme(Web::CSS::PreferredColorScheme m_page_host->set_preferred_color_scheme(color_scheme); } +void ClientConnection::set_has_focus(bool has_focus) +{ + m_page_host->set_has_focus(has_focus); +} + } diff --git a/Userland/Services/WebContent/ClientConnection.h b/Userland/Services/WebContent/ClientConnection.h index 419e42d094..af2d79df27 100644 --- a/Userland/Services/WebContent/ClientConnection.h +++ b/Userland/Services/WebContent/ClientConnection.h @@ -60,6 +60,7 @@ private: virtual Messages::WebContentServer::DumpLayoutTreeResponse dump_layout_tree() override; virtual void set_content_filters(Vector const&) override; virtual void set_preferred_color_scheme(Web::CSS::PreferredColorScheme const&) override; + virtual void set_has_focus(bool) override; virtual void js_console_input(String const&) override; virtual void run_javascript(String const&) override; diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp index 8489c19e65..255f767305 100644 --- a/Userland/Services/WebContent/PageHost.cpp +++ b/Userland/Services/WebContent/PageHost.cpp @@ -31,6 +31,11 @@ PageHost::~PageHost() { } +void PageHost::set_has_focus(bool has_focus) +{ + m_has_focus = has_focus; +} + void PageHost::setup_palette() { // FIXME: Get the proper palette from our peer somehow @@ -85,6 +90,7 @@ void PageHost::paint(const Gfx::IntRect& content_rect, Gfx::Bitmap& target) Web::PaintContext context(painter, palette(), content_rect.top_left()); context.set_should_show_line_box_borders(m_should_show_line_box_borders); context.set_viewport_rect(content_rect); + context.set_has_focus(m_has_focus); layout_root->paint_all_phases(context); } diff --git a/Userland/Services/WebContent/PageHost.h b/Userland/Services/WebContent/PageHost.h index d8ac4c1e65..3e8e75f4d8 100644 --- a/Userland/Services/WebContent/PageHost.h +++ b/Userland/Services/WebContent/PageHost.h @@ -32,6 +32,7 @@ public: void set_preferred_color_scheme(Web::CSS::PreferredColorScheme); void set_should_show_line_box_borders(bool b) { m_should_show_line_box_borders = b; } + void set_has_focus(bool); private: // ^PageClient @@ -74,6 +75,7 @@ private: RefPtr m_palette_impl; Gfx::IntRect m_screen_rect; bool m_should_show_line_box_borders { false }; + bool m_has_focus { false }; RefPtr m_invalidation_coalescing_timer; Gfx::IntRect m_invalidation_rect; diff --git a/Userland/Services/WebContent/WebContentServer.ipc b/Userland/Services/WebContent/WebContentServer.ipc index dc03a7a853..dbe200512b 100644 --- a/Userland/Services/WebContent/WebContentServer.ipc +++ b/Userland/Services/WebContent/WebContentServer.ipc @@ -44,4 +44,6 @@ endpoint WebContentServer set_content_filters(Vector filters) =| set_preferred_color_scheme(Web::CSS::PreferredColorScheme color_scheme) =| + set_has_focus(bool has_focus) =| + } -- cgit v1.2.3