mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 11:37:16 +02:00
GWidget: Fix accidentally ignored set_relative_rect() with empty size
To protect the layout system from negative input values, we were using an empty Rect() whenever an empty rect (width/height <= 0) was provided to set_relative_rect(). This caused Terminal's scrollbar code to fail, since it relies on first setting only the scrollbar width on startup, and then setting up the proper geometry in response to the initial resize event. Fixes #753.
This commit is contained in:
Notes:
sideshowbarker
2024-07-19 11:17:12 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3a01df9fb11
@@ -101,7 +101,13 @@ void GWidget::child_event(CChildEvent& event)
|
||||
|
||||
void GWidget::set_relative_rect(const Rect& a_rect)
|
||||
{
|
||||
Rect rect = a_rect.is_empty() ? Rect() : a_rect;
|
||||
// Get rid of negative width/height values.
|
||||
Rect rect = {
|
||||
a_rect.x(),
|
||||
a_rect.y(),
|
||||
max(a_rect.width(), 0),
|
||||
max(a_rect.height(), 0)
|
||||
};
|
||||
|
||||
if (rect == m_relative_rect)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user