mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +00:00
LibWeb: Declare optional parse results inlined in if statements
This commit is contained in:
committed by
Tim Flynn
parent
1b9a961fb0
commit
3bfc2f5e95
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user