mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 13:45:07 +00:00
Ladybird: Implement the JavaScript console using a WebContentView
This aligns the Ladybird console implementation with the Browser console a bit more, which uses OutOfProcessWebView for rendering console output. This allows us to style the console output to try and match the system theme. Using a WebContentView is simpler than trying to style the old QTextEdit widget, as the console output is HTML with built-in "-libweb-palette-*" colors. These will override any color we set on the QTextEdit widget.
This commit is contained in:
parent
5af715e394
commit
4aca24481e
5 changed files with 80 additions and 22 deletions
|
@ -567,11 +567,12 @@ void WebContentView::hideEvent(QHideEvent* event)
|
|||
client().async_set_system_visibility_state(false);
|
||||
}
|
||||
|
||||
static Core::AnonymousBuffer make_system_theme_from_qt_palette(QWidget& widget)
|
||||
static Core::AnonymousBuffer make_system_theme_from_qt_palette(QWidget& widget, WebContentView::PaletteMode mode)
|
||||
{
|
||||
auto qt_palette = widget.palette();
|
||||
|
||||
auto theme = Gfx::load_system_theme(DeprecatedString::formatted("{}/res/themes/Default.ini", s_serenity_resource_root)).release_value_but_fixme_should_propagate_errors();
|
||||
auto theme_file = mode == WebContentView::PaletteMode::Default ? "Default"sv : "Dark"sv;
|
||||
auto theme = Gfx::load_system_theme(DeprecatedString::formatted("{}/res/themes/{}.ini", s_serenity_resource_root, theme_file)).release_value_but_fixme_should_propagate_errors();
|
||||
auto palette_impl = Gfx::PaletteImpl::create_with_anonymous_buffer(theme);
|
||||
auto palette = Gfx::Palette(move(palette_impl));
|
||||
|
||||
|
@ -594,9 +595,9 @@ static Core::AnonymousBuffer make_system_theme_from_qt_palette(QWidget& widget)
|
|||
return theme;
|
||||
}
|
||||
|
||||
void WebContentView::update_palette()
|
||||
void WebContentView::update_palette(PaletteMode mode)
|
||||
{
|
||||
client().async_update_system_theme(make_system_theme_from_qt_palette(*this));
|
||||
client().async_update_system_theme(make_system_theme_from_qt_palette(*this, mode));
|
||||
}
|
||||
|
||||
void WebContentView::create_client(WebView::EnableCallgrindProfiling enable_callgrind_profiling)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue