summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-08-25 21:25:35 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-26 00:51:35 +0200
commitac7853175655fd430986f8931f3a9409cb58982b (patch)
treef4d4546f0223bda9579c32347514800418fef83d /Libraries
parenta265d40d6e2300cb008f73c627ed43fda1fa17eb (diff)
downloadserenity-ac7853175655fd430986f8931f3a9409cb58982b.zip
LibGUI: Clip GUI::Frame children to the frame_inner_rect()
This way we don't draw the frame border underneath our children. :^)
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibGUI/Frame.cpp6
-rw-r--r--Libraries/LibGUI/Frame.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/Libraries/LibGUI/Frame.cpp b/Libraries/LibGUI/Frame.cpp
index 9b82c5b7f9..7215f1d985 100644
--- a/Libraries/LibGUI/Frame.cpp
+++ b/Libraries/LibGUI/Frame.cpp
@@ -59,4 +59,10 @@ void Frame::paint_event(PaintEvent& event)
painter.add_clip_rect(event.rect());
Gfx::StylePainter::paint_frame(painter, rect(), palette(), m_shape, m_shadow, m_thickness, spans_entire_window_horizontally());
}
+
+Gfx::IntRect Frame::children_clip_rect() const
+{
+ return frame_inner_rect();
+}
+
}
diff --git a/Libraries/LibGUI/Frame.h b/Libraries/LibGUI/Frame.h
index 5bf43f238a..6d94112423 100644
--- a/Libraries/LibGUI/Frame.h
+++ b/Libraries/LibGUI/Frame.h
@@ -48,6 +48,8 @@ public:
Gfx::IntRect frame_inner_rect_for_size(const Gfx::IntSize& size) const { return { m_thickness, m_thickness, size.width() - m_thickness * 2, size.height() - m_thickness * 2 }; }
Gfx::IntRect frame_inner_rect() const { return frame_inner_rect_for_size(size()); }
+ virtual Gfx::IntRect children_clip_rect() const override;
+
protected:
Frame();
void paint_event(PaintEvent&) override;