1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:47:44 +00:00

LibWeb: Plumb OOPWV focus state across the IPC boundary

This makes focus outlines show up in OOPWV at last! :^)
This commit is contained in:
Andreas Kling 2022-02-06 19:03:13 +01:00
parent a062e803c5
commit 65bd4477db
7 changed files with 28 additions and 0 deletions

View file

@ -495,4 +495,14 @@ void OutOfProcessWebView::set_preferred_color_scheme(Web::CSS::PreferredColorSch
client().async_set_preferred_color_scheme(color_scheme);
}
void OutOfProcessWebView::focusin_event(GUI::FocusEvent&)
{
client().async_set_has_focus(true);
}
void OutOfProcessWebView::focusout_event(GUI::FocusEvent&)
{
client().async_set_has_focus(false);
}
}

View file

@ -102,6 +102,8 @@ private:
virtual void keyup_event(GUI::KeyEvent&) override;
virtual void theme_change_event(GUI::ThemeChangeEvent&) override;
virtual void screen_rects_change_event(GUI::ScreenRectsChangeEvent&) override;
virtual void focusin_event(GUI::FocusEvent&) override;
virtual void focusout_event(GUI::FocusEvent&) override;
// ^AbstractScrollableWidget
virtual void did_scroll() override;

View file

@ -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);
}
}

View file

@ -60,6 +60,7 @@ private:
virtual Messages::WebContentServer::DumpLayoutTreeResponse dump_layout_tree() override;
virtual void set_content_filters(Vector<String> 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;

View file

@ -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);
}

View file

@ -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<Gfx::PaletteImpl> m_palette_impl;
Gfx::IntRect m_screen_rect;
bool m_should_show_line_box_borders { false };
bool m_has_focus { false };
RefPtr<Core::Timer> m_invalidation_coalescing_timer;
Gfx::IntRect m_invalidation_rect;

View file

@ -44,4 +44,6 @@ endpoint WebContentServer
set_content_filters(Vector<String> filters) =|
set_preferred_color_scheme(Web::CSS::PreferredColorScheme color_scheme) =|
set_has_focus(bool has_focus) =|
}