mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 06:18:59 +00:00
LibWeb/HTML: Avoid double lookup of size attribute
This commit is contained in:
parent
319b447fdd
commit
c647ac407d
Notes:
github-actions[bot]
2025-01-30 20:57:15 +00:00
Author: https://github.com/shannonbooth
Commit: c647ac407d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3373
Reviewed-by: https://github.com/ADKaster ✅
1 changed files with 3 additions and 5 deletions
|
@ -297,11 +297,9 @@ Optional<ARIA::Role> HTMLSelectElement::default_role() const
|
|||
// https://www.w3.org/TR/html-aria/#el-select-multiple-or-size-greater-1
|
||||
if (has_attribute(AttributeNames::multiple))
|
||||
return ARIA::Role::listbox;
|
||||
if (has_attribute(AttributeNames::size)) {
|
||||
if (auto size_string = get_attribute(HTML::AttributeNames::size); size_string.has_value()) {
|
||||
if (auto size = size_string->to_number<int>(); size.has_value() && *size > 1)
|
||||
return ARIA::Role::listbox;
|
||||
}
|
||||
if (auto size_string = get_attribute(HTML::AttributeNames::size); size_string.has_value()) {
|
||||
if (auto size = size_string->to_number<int>(); size.has_value() && *size > 1)
|
||||
return ARIA::Role::listbox;
|
||||
}
|
||||
// https://www.w3.org/TR/html-aria/#el-select
|
||||
return ARIA::Role::combobox;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue