mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-03 00:42:54 +00:00
LibWeb: Declare optional parse results inlined in if
statements
This commit is contained in:
parent
1b9a961fb0
commit
3bfc2f5e95
Notes:
sideshowbarker
2024-07-18 03:20:18 +09:00
Author: https://github.com/bplaat
Commit: 3bfc2f5e95
Pull-request: https://github.com/SerenityOS/serenity/pull/22195
Reviewed-by: https://github.com/trflynn89 ✅
5 changed files with 40 additions and 65 deletions
|
@ -1166,11 +1166,9 @@ i32 HTMLInputElement::default_tab_index_value() const
|
|||
unsigned HTMLInputElement::size() const
|
||||
{
|
||||
// The size IDL attribute is limited to only positive numbers and has a default value of 20.
|
||||
auto maybe_size_string = get_attribute(HTML::AttributeNames::size);
|
||||
if (maybe_size_string.has_value()) {
|
||||
auto maybe_size = parse_non_negative_integer(maybe_size_string.value());
|
||||
if (maybe_size.has_value())
|
||||
return maybe_size.value();
|
||||
if (auto size_string = get_attribute(HTML::AttributeNames::size); size_string.has_value()) {
|
||||
if (auto size = parse_non_negative_integer(*size_string); size.has_value())
|
||||
return *size;
|
||||
}
|
||||
return 20;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue