1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:07:45 +00:00

LibWeb: Fill PageHost root with document background color

This makes Acid3 have a background color again.

Regressed with f2f14ad9bd.
This commit is contained in:
Andreas Kling 2023-05-06 07:26:19 +02:00
parent f4d8a24fe4
commit 1b8788157c
2 changed files with 15 additions and 1 deletions

View file

@ -108,6 +108,14 @@ Web::Layout::Viewport* PageHost::layout_root()
return document->layout_node(); return document->layout_node();
} }
Gfx::Color PageHost::background_color() const
{
auto document = page().top_level_browsing_context().active_document();
if (!document)
return Gfx::Color::Transparent;
return document->background_color();
}
void PageHost::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& target) void PageHost::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& target)
{ {
Gfx::Painter painter(target); Gfx::Painter painter(target);
@ -116,7 +124,11 @@ void PageHost::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& targ
if (auto* document = page().top_level_browsing_context().active_document()) if (auto* document = page().top_level_browsing_context().active_document())
document->update_layout(); document->update_layout();
painter.fill_rect(bitmap_rect, palette().base()); auto background_color = this->background_color();
if (background_color.alpha() < 255)
painter.clear_rect(bitmap_rect, palette().base());
painter.fill_rect(bitmap_rect, background_color);
auto* layout_root = this->layout_root(); auto* layout_root = this->layout_root();
if (!layout_root) { if (!layout_root) {

View file

@ -49,6 +49,8 @@ public:
void confirm_closed(bool accepted); void confirm_closed(bool accepted);
void prompt_closed(Optional<String> response); void prompt_closed(Optional<String> response);
[[nodiscard]] Gfx::Color background_color() const;
private: private:
// ^PageClient // ^PageClient
virtual bool is_connection_open() const override; virtual bool is_connection_open() const override;