1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibWeb: Use the cached background-image value in Layout::Box::paint()

This commit is contained in:
Andreas Kling 2021-01-06 12:09:18 +01:00
parent ba8990fb6c
commit 63046d82f4

View file

@ -52,13 +52,8 @@ void Box::paint(PaintContext& context, PaintPhase phase)
if (phase == PaintPhase::Background && !is_body()) {
context.painter().fill_rect(enclosing_int_rect(padded_rect), computed_values().background_color());
auto bgimage = specified_style().property(CSS::PropertyID::BackgroundImage);
if (bgimage.has_value() && bgimage.value()->is_image()) {
auto& image_value = static_cast<const CSS::ImageStyleValue&>(*bgimage.value());
if (image_value.bitmap()) {
context.painter().draw_tiled_bitmap(enclosing_int_rect(padded_rect), *image_value.bitmap());
}
}
if (background_image() && background_image()->bitmap())
context.painter().draw_tiled_bitmap(enclosing_int_rect(padded_rect), *background_image()->bitmap());
}
if (phase == PaintPhase::Border) {