mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-05 17:16:04 +00:00
WindowServer: Use early return to reduce nesting
This commit is contained in:
parent
14f9a29502
commit
97508844dc
Notes:
sideshowbarker
2024-07-19 09:27:18 +09:00
Author: https://github.com/shannonbooth
Commit: 97508844dc
Pull-request: https://github.com/SerenityOS/serenity/pull/1209
Reviewed-by: https://github.com/awesomekling
1 changed files with 27 additions and 24 deletions
|
@ -125,8 +125,11 @@ void Menu::redraw()
|
||||||
|
|
||||||
Window& Menu::ensure_menu_window()
|
Window& Menu::ensure_menu_window()
|
||||||
{
|
{
|
||||||
|
if (m_menu_window)
|
||||||
|
return *m_menu_window;
|
||||||
|
|
||||||
int width = this->content_width();
|
int width = this->content_width();
|
||||||
if (!m_menu_window) {
|
|
||||||
Gfx::Point next_item_location(frame_thickness(), frame_thickness());
|
Gfx::Point next_item_location(frame_thickness(), frame_thickness());
|
||||||
for (auto& item : m_items) {
|
for (auto& item : m_items) {
|
||||||
int height = 0;
|
int height = 0;
|
||||||
|
@ -151,7 +154,7 @@ Window& Menu::ensure_menu_window()
|
||||||
window->set_rect(0, 0, width, window_height);
|
window->set_rect(0, 0, width, window_height);
|
||||||
m_menu_window = move(window);
|
m_menu_window = move(window);
|
||||||
draw();
|
draw();
|
||||||
}
|
|
||||||
return *m_menu_window;
|
return *m_menu_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue