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

LibWeb: Move the painting of the border out of paint()

So other Boxes can override this function.
This commit is contained in:
Tobias Christiansen 2021-04-20 13:39:36 +02:00 committed by Andreas Kling
parent 3f42d39dce
commit ff0b3518fa
2 changed files with 11 additions and 5 deletions

View file

@ -60,11 +60,7 @@ void Box::paint(PaintContext& context, PaintPhase phase)
} }
if (phase == PaintPhase::Border) { if (phase == PaintPhase::Border) {
auto bordered_rect = this->bordered_rect(); paint_border(context);
Painting::paint_border(context, Painting::BorderEdge::Left, bordered_rect, computed_values());
Painting::paint_border(context, Painting::BorderEdge::Right, bordered_rect, computed_values());
Painting::paint_border(context, Painting::BorderEdge::Top, bordered_rect, computed_values());
Painting::paint_border(context, Painting::BorderEdge::Bottom, bordered_rect, computed_values());
} }
if (phase == PaintPhase::Overlay && dom_node() && document().inspected_node() == dom_node()) { if (phase == PaintPhase::Overlay && dom_node() && document().inspected_node() == dom_node()) {
@ -87,6 +83,15 @@ void Box::paint(PaintContext& context, PaintPhase phase)
} }
} }
void Box::paint_border(PaintContext& context)
{
auto bordered_rect = this->bordered_rect();
Painting::paint_border(context, Painting::BorderEdge::Left, bordered_rect, computed_values());
Painting::paint_border(context, Painting::BorderEdge::Right, bordered_rect, computed_values());
Painting::paint_border(context, Painting::BorderEdge::Top, bordered_rect, computed_values());
Painting::paint_border(context, Painting::BorderEdge::Bottom, bordered_rect, computed_values());
}
void Box::paint_background_image( void Box::paint_background_image(
PaintContext& context, PaintContext& context,
const Gfx::Bitmap& background_image, const Gfx::Bitmap& background_image,

View file

@ -110,6 +110,7 @@ public:
StackingContext* enclosing_stacking_context(); StackingContext* enclosing_stacking_context();
virtual void paint(PaintContext&, PaintPhase) override; virtual void paint(PaintContext&, PaintPhase) override;
virtual void paint_border(PaintContext& context);
Vector<LineBox>& line_boxes() { return m_line_boxes; } Vector<LineBox>& line_boxes() { return m_line_boxes; }
const Vector<LineBox>& line_boxes() const { return m_line_boxes; } const Vector<LineBox>& line_boxes() const { return m_line_boxes; }