mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
Browser: Set preferred color scheme when constructing a tab
Previously we would only tell OutOfProcessWebView about the preferred color scheme when changing it in the browser's settings. This patch implements reading in the current config value to set the scheme immediately :^) See SerenityOS update (July 2022) https://youtu.be/aO0b2X7tzuk?t=2171
This commit is contained in:
parent
ea9ef33a7f
commit
f722612e17
1 changed files with 5 additions and 0 deletions
|
@ -19,6 +19,7 @@
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/URL.h>
|
#include <AK/URL.h>
|
||||||
#include <Applications/Browser/TabGML.h>
|
#include <Applications/Browser/TabGML.h>
|
||||||
|
#include <LibConfig/Client.h>
|
||||||
#include <LibGUI/Action.h>
|
#include <LibGUI/Action.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/BoxLayout.h>
|
#include <LibGUI/BoxLayout.h>
|
||||||
|
@ -114,6 +115,10 @@ Tab::Tab(BrowserWindow& window)
|
||||||
auto& webview_container = *find_descendant_of_type_named<GUI::Widget>("webview_container");
|
auto& webview_container = *find_descendant_of_type_named<GUI::Widget>("webview_container");
|
||||||
|
|
||||||
m_web_content_view = webview_container.add<WebView::OutOfProcessWebView>();
|
m_web_content_view = webview_container.add<WebView::OutOfProcessWebView>();
|
||||||
|
|
||||||
|
auto preferred_color_scheme = Web::CSS::preferred_color_scheme_from_string(Config::read_string("Browser"sv, "Preferences"sv, "ColorScheme"sv, "auto"sv));
|
||||||
|
m_web_content_view->set_preferred_color_scheme(preferred_color_scheme);
|
||||||
|
|
||||||
if (g_content_filters_enabled)
|
if (g_content_filters_enabled)
|
||||||
m_web_content_view->set_content_filters(g_content_filters);
|
m_web_content_view->set_content_filters(g_content_filters);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue