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

LibGUI: Constrain widgets to invalidating themselves only

This commit is contained in:
Tom 2021-02-15 19:57:30 -07:00 committed by Andreas Kling
parent 8129f3da52
commit 35170715bc

View file

@ -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