1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 16:55:09 +00:00

LibWeb: Put final foreground/background colors in LayoutStyle

This way we don't have to look them up in the CSS::StyleProperties
every time we want to paint with them.
This commit is contained in:
Andreas Kling 2020-12-15 16:13:05 +01:00
parent 78a51933ad
commit c630ae517e
7 changed files with 22 additions and 21 deletions

View file

@ -50,11 +50,7 @@ void Box::paint(PaintContext& context, PaintPhase phase)
padded_rect.set_height(height() + box_model().padding.top + box_model().padding.bottom);
if (phase == PaintPhase::Background && !is_body()) {
// FIXME: We should paint the body here too, but that currently happens at the view layer.
auto bgcolor = specified_style().property(CSS::PropertyID::BackgroundColor);
if (bgcolor.has_value() && bgcolor.value()->is_color()) {
context.painter().fill_rect(enclosing_int_rect(padded_rect), bgcolor.value()->to_color(document()));
}
context.painter().fill_rect(enclosing_int_rect(padded_rect), style().background_color());
auto bgimage = specified_style().property(CSS::PropertyID::BackgroundImage);
if (bgimage.has_value() && bgimage.value()->is_image()) {