@@ -71,6 +71,7 @@ struct View : public Ui::View<View> {
7171 }
7272
7373 void paint (Gfx::Canvas& g, Math::Recti rect) override {
74+ // Painting browser's viewport.
7475 auto viewport = bound ().size ();
7576 if (not _renderResult) {
7677 auto media = _constructMedia (viewport);
@@ -82,10 +83,11 @@ struct View : public Ui::View<View> {
8283 g.origin (bound ().xy .cast <f64 >());
8384 g.clip (viewport);
8485
85- auto [_, layout, paint, frag] = *_renderResult;
86- g.clear (rect, Gfx::WHITE );
86+ auto [_, layout, paint, frag, canvasColor] = *_renderResult;
87+ auto paintRect = rect.offset (-bound ().xy );
88+ g.clear (paintRect, canvasColor);
8789
88- paint->paint (g, rect. offset (- bound (). xy ) .cast <f64 >());
90+ paint->paint (g, paintRect .cast <f64 >());
8991 if (_props.wireframe )
9092 Layout::wireframe (*frag, g);
9193
@@ -100,7 +102,7 @@ struct View : public Ui::View<View> {
100102 Math::Vec2i size (Math::Vec2i size, Ui::Hint) override {
101103 // FIXME: This is wasteful, we should cache the result
102104 auto media = _constructMedia (size);
103- auto [_, layout, _, frag] = Driver::render (*_dom, media, {.small = size.cast <Au>()});
105+ auto [_, layout, _, frag, _ ] = Driver::render (*_dom, media, {.small = size.cast <Au>()});
104106
105107 return {
106108 frag->metrics .borderBox ().width .cast <isize>(),
0 commit comments