mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
LibWeb/HTML: Avoid double lookup of size attribute
This commit is contained in:
committed by
Andrew Kaster
parent
319b447fdd
commit
c647ac407d
Notes:
github-actions[bot]
2025-01-30 20:57:15 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/c647ac407dd Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3373 Reviewed-by: https://github.com/ADKaster ✅
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user