mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:07:34 +00:00
Userland: Change static const variables to static constexpr
`static const` variables can be computed and initialized at run-time during initialization or the first time a function is called. Change them to `static constexpr` to ensure they are computed at compile-time. This allows some removal of `strlen` because the length of the `StringView` can be used which is pre-computed at compile-time.
This commit is contained in:
parent
31515a9147
commit
f912a48315
23 changed files with 111 additions and 82 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Alex McGrath <amk@amk.ie>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -48,7 +49,7 @@ void LinkLabel::set_hovered(bool hover)
|
|||
|
||||
void LinkLabel::mousemove_event(MouseEvent& event)
|
||||
{
|
||||
static const int extra_target_width = 3;
|
||||
constexpr int extra_target_width = 3;
|
||||
set_hovered(event.position().x() <= font().width(text()) + extra_target_width);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue