diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp b/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp index fa74a76dda..b545670f97 100644 --- a/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/InitialContainingBlockBox.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <LibGfx/Painter.h> #include <LibWeb/Dump.h> #include <LibWeb/Layout/InitialContainingBlockBox.h> #include <LibWeb/Page/Frame.h> @@ -61,8 +62,26 @@ void InitialContainingBlockBox::build_stacking_context_tree() }); } +void InitialContainingBlockBox::paint_document_background(PaintContext& context) +{ + context.painter().fill_rect(Gfx::IntRect { {}, context.viewport_rect().size() }, document().background_color(context.palette())); + context.painter().translate(-context.viewport_rect().location()); + + if (auto background_bitmap = document().background_image()) { + Gfx::IntRect background_rect { + 0, + 0, + context.viewport_rect().x() + context.viewport_rect().width(), + context.viewport_rect().y() + context.viewport_rect().height() + }; + context.painter().blit_tiled(background_rect, *background_bitmap, background_bitmap->rect()); + } +} + void InitialContainingBlockBox::paint_all_phases(PaintContext& context) { + paint_document_background(context); + paint(context, PaintPhase::Background); paint(context, PaintPhase::Border); paint(context, PaintPhase::Foreground); |