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

LibWeb: Split Paintable into Paintable and PaintableBox

To prepare for paintable inline content, we take the basic painting
functionality and hoist it into a base class.
This commit is contained in:
Andreas Kling 2022-03-10 15:50:57 +01:00
parent 0500dbc3f6
commit 053766d79c
34 changed files with 133 additions and 95 deletions

View file

@ -10,18 +10,18 @@
namespace Web::Painting {
SVGPaintable::SVGPaintable(Layout::SVGBox const& layout_box)
: Paintable(layout_box)
: PaintableBox(layout_box)
{
}
Layout::SVGBox const& SVGPaintable::layout_box() const
{
return static_cast<Layout::SVGBox const&>(m_layout_box);
return static_cast<Layout::SVGBox const&>(layout_node());
}
void SVGPaintable::before_children_paint(PaintContext& context, PaintPhase phase) const
{
Paintable::before_children_paint(context, phase);
PaintableBox::before_children_paint(context, phase);
if (phase != PaintPhase::Foreground)
return;
context.svg_context().save();
@ -29,7 +29,7 @@ void SVGPaintable::before_children_paint(PaintContext& context, PaintPhase phase
void SVGPaintable::after_children_paint(PaintContext& context, PaintPhase phase) const
{
Paintable::after_children_paint(context, phase);
PaintableBox::after_children_paint(context, phase);
if (phase != PaintPhase::Foreground)
return;
context.svg_context().restore();