1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:07:34 +00:00

LibWeb: Move painting logic from Layout::Viewport to ViewportPaintable

This commit is contained in:
Andreas Kling 2023-08-19 08:38:51 +02:00
parent c01c4b41e2
commit 8bb275f2ea
9 changed files with 54 additions and 48 deletions

View file

@ -10,6 +10,7 @@
#include <LibWeb/Layout/Viewport.h>
#include <LibWeb/Painting/BorderRadiusCornerClipper.h>
#include <LibWeb/Painting/NestedBrowsingContextPaintable.h>
#include <LibWeb/Painting/ViewportPaintable.h>
namespace Web::Painting {
@ -43,8 +44,8 @@ void NestedBrowsingContextPaintable::paint(PaintContext& context, PaintPhase pha
auto* hosted_document = layout_box().dom_node().content_document_without_origin_check();
if (!hosted_document)
return;
auto* hosted_layout_tree = hosted_document->layout_node();
if (!hosted_layout_tree)
auto* hosted_paint_tree = hosted_document->paintable_box();
if (!hosted_paint_tree)
return;
context.painter().save();
@ -56,7 +57,7 @@ void NestedBrowsingContextPaintable::paint(PaintContext& context, PaintPhase pha
context.painter().translate(absolute_device_rect.x().value(), absolute_device_rect.y().value());
context.set_device_viewport_rect({ {}, context.enclosing_device_size(layout_box().dom_node().nested_browsing_context()->size()) });
const_cast<Layout::Viewport*>(hosted_layout_tree)->paint_all_phases(context);
const_cast<ViewportPaintable&>(verify_cast<ViewportPaintable>(*hosted_paint_tree)).paint_all_phases(context);
context.set_device_viewport_rect(old_viewport_rect);
context.painter().restore();