summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorTobias Christiansen <tobi@tobyase.de>2021-04-20 13:39:36 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-20 22:08:02 +0200
commitff0b3518fa605d0f92479462a81f23dca0ba910c (patch)
treee7b1d696d32d3c045e1f640f3af9709fcc0cef2a /Userland/Libraries
parent3f42d39dce08ed3f2811714ad5506655d7133740 (diff)
downloadserenity-ff0b3518fa605d0f92479462a81f23dca0ba910c.zip
LibWeb: Move the painting of the border out of paint()
So other Boxes can override this function.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibWeb/Layout/Box.cpp15
-rw-r--r--Userland/Libraries/LibWeb/Layout/Box.h1
2 files changed, 11 insertions, 5 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/Box.cpp b/Userland/Libraries/LibWeb/Layout/Box.cpp
index 23b98e3604..79c26947d3 100644
--- a/Userland/Libraries/LibWeb/Layout/Box.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Box.cpp
@@ -60,11 +60,7 @@ void Box::paint(PaintContext& context, PaintPhase phase)
}
if (phase == PaintPhase::Border) {
- 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());
+ paint_border(context);
}
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(
PaintContext& context,
const Gfx::Bitmap& background_image,
diff --git a/Userland/Libraries/LibWeb/Layout/Box.h b/Userland/Libraries/LibWeb/Layout/Box.h
index 08a6620241..4275ec3823 100644
--- a/Userland/Libraries/LibWeb/Layout/Box.h
+++ b/Userland/Libraries/LibWeb/Layout/Box.h
@@ -110,6 +110,7 @@ public:
StackingContext* enclosing_stacking_context();
virtual void paint(PaintContext&, PaintPhase) override;
+ virtual void paint_border(PaintContext& context);
Vector<LineBox>& line_boxes() { return m_line_boxes; }
const Vector<LineBox>& line_boxes() const { return m_line_boxes; }