summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2021-02-15 19:57:30 -0700
committerAndreas Kling <kling@serenityos.org>2021-02-25 18:04:06 +0100
commit35170715bc1e31f7ce75228a5f861988eafb4129 (patch)
tree898eae59001cd5a84dffe32c332a459fcd932421 /Userland/Libraries/LibGUI
parent8129f3da52eeec0b7cf6c342bdf22580193f8a9b (diff)
downloadserenity-35170715bc1e31f7ce75228a5f861988eafb4129.zip
LibGUI: Constrain widgets to invalidating themselves only
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r--Userland/Libraries/LibGUI/Widget.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp
index 807bc1cbad..65dfdd4de7 100644
--- a/Userland/Libraries/LibGUI/Widget.cpp
+++ b/Userland/Libraries/LibGUI/Widget.cpp
@@ -553,6 +553,10 @@ void Widget::update(const Gfx::IntRect& rect)
if (!updates_enabled())
return;
+ auto bound_by_widget = rect.intersected(this->rect());
+ if (bound_by_widget.is_empty())
+ return;
+
Window* window = m_window;
Widget* parent = parent_widget();
while (parent) {
@@ -562,7 +566,7 @@ void Widget::update(const Gfx::IntRect& rect)
parent = parent->parent_widget();
}
if (window)
- window->update(rect.translated(window_relative_rect().location()));
+ window->update(bound_by_widget.translated(window_relative_rect().location()));
}
Gfx::IntRect Widget::window_relative_rect() const