mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
LibWeb: Declare optional parse results inlined in if statements
This commit is contained in:
committed by
Tim Flynn
parent
1b9a961fb0
commit
3bfc2f5e95
Notes:
sideshowbarker
2024-07-18 03:20:18 +09:00
Author: https://github.com/bplaat Commit: https://github.com/SerenityOS/serenity/commit/3bfc2f5e95 Pull-request: https://github.com/SerenityOS/serenity/pull/22195 Reviewed-by: https://github.com/trflynn89 ✅
@@ -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