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

LibWeb+WebContent: Add set_preferred_color_scheme IPC call

This allows the owner of a WebView to override whether to use a dark
theme or not, instead of just using the system theme's IsDark property.
This commit is contained in:
Sam Atkins 2021-10-26 17:00:10 +01:00 committed by Linus Groh
parent c8550da9c5
commit 53edaa3b26
11 changed files with 44 additions and 0 deletions

View file

@ -51,6 +51,13 @@ void PageHost::set_palette_impl(const Gfx::PaletteImpl& impl)
m_palette_impl = impl;
}
void PageHost::set_preferred_color_scheme(Web::CSS::PreferredColorScheme color_scheme)
{
m_preferred_color_scheme = color_scheme;
if (auto* document = page().top_level_browsing_context().active_document())
document->invalidate_style();
}
Web::Layout::InitialContainingBlock* PageHost::layout_root()
{
auto* document = page().top_level_browsing_context().active_document();