LibHTML: Respect the system theme

LibHTML will now use the palette colors for the default document background and
the text. As always, a page can override this default styling with CSS if it
really wants a specific color or style.

Fixes https://github.com/SerenityOS/serenity/issues/963
This commit is contained in:
Sergey Bugaev 2020-01-05 00:09:35 +03:00 committed by Andreas Kling
parent 7557251fac
commit 0f42908073
Notes: sideshowbarker 2024-07-19 10:21:02 +09:00
5 changed files with 14 additions and 10 deletions

View file

@ -38,7 +38,7 @@ HtmlView::HtmlView(GWidget* parent)
set_frame_shadow(FrameShadow::Sunken);
set_frame_thickness(2);
set_should_hide_unnecessary_scrollbars(true);
set_background_color(Color::White);
set_background_role(ColorRole::Base);
}
HtmlView::~HtmlView()
@ -122,7 +122,7 @@ void HtmlView::paint_event(GPaintEvent& event)
return;
}
painter.fill_rect(event.rect(), document()->background_color());
painter.fill_rect(event.rect(), document()->background_color(palette()));
if (auto background_bitmap = document()->background_image()) {
painter.draw_tiled_bitmap(event.rect(), *background_bitmap);