summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout/Box.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-03-10 14:02:25 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-11 00:21:49 +0100
commit02b316fd5cc2039a30cab33edee4595900cb35aa (patch)
tree22c7ac3c6c93d97fd7548a2b1286516260545a05 /Userland/Libraries/LibWeb/Layout/Box.h
parentf6497b64ac52674e99564d83c4fad6229d06b1ef (diff)
downloadserenity-02b316fd5cc2039a30cab33edee4595900cb35aa.zip
LibWeb: Let Paintable perform the painting
This patch adds a bunch of Paintable subclasses, each corresponding to the Layout::Node subclasses that had a paint() override. All painting logic is moved from layout nodes into their corresponding paintables. Paintables are now created by asking a Layout::Box to produce one: static NonnullOwnPtr<Paintable> Layout::Box::create_paintable() Note that inline nodes still have their painting logic. Since they are not boxes, and all paintables have a corresponding box, we'll need to come up with some other solution for them.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout/Box.h')
-rw-r--r--Userland/Libraries/LibWeb/Layout/Box.h12
1 files changed, 2 insertions, 10 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/Box.h b/Userland/Libraries/LibWeb/Layout/Box.h
index 03c4f13565..730bebcbf4 100644
--- a/Userland/Libraries/LibWeb/Layout/Box.h
+++ b/Userland/Libraries/LibWeb/Layout/Box.h
@@ -32,13 +32,6 @@ public:
bool is_body() const;
- virtual void paint(PaintContext&, Painting::PaintPhase) override;
- virtual void paint_border(PaintContext& context);
- virtual void paint_box_shadow(PaintContext& context);
- virtual void paint_background(PaintContext& context);
-
- Painting::BorderRadiusData normalized_border_radius_data();
-
virtual Optional<float> intrinsic_width() const { return {}; }
virtual Optional<float> intrinsic_height() const { return {}; }
virtual Optional<float> intrinsic_aspect_ratio() const { return {}; }
@@ -47,13 +40,12 @@ public:
bool has_intrinsic_height() const { return intrinsic_height().has_value(); }
bool has_intrinsic_aspect_ratio() const { return intrinsic_aspect_ratio().has_value(); }
- virtual void before_children_paint(PaintContext&, Painting::PaintPhase) override;
- virtual void after_children_paint(PaintContext&, Painting::PaintPhase) override;
-
virtual ~Box() override;
virtual void did_set_rect() { }
+ virtual OwnPtr<Painting::Paintable> create_paintable() const;
+
protected:
Box(DOM::Document&, DOM::Node*, NonnullRefPtr<CSS::StyleProperties>);
Box(DOM::Document&, DOM::Node*, CSS::ComputedValues);