diff options
author | MacDue <macdue@dueutil.tech> | 2023-01-29 19:12:00 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-01-28 22:09:18 +0000 |
commit | 890b4d79800f61450e903f1b6408431243a94793 (patch) | |
tree | 3c882b71a7eeb89655272340fefcdcec6c9deaf5 /Userland/Services/WebContent | |
parent | f23eba1ba806421703e05d3ce6ea456e7788e3ae (diff) | |
download | serenity-890b4d79800f61450e903f1b6408431243a94793.zip |
LibWeb: Replace ARIA role static FlyStrings with an enum
This replaces the FlyStrings for ARIA roles that were constructed in
a [[gnu::constructor]] with a single enum. I came across this as the
DOM inspector was crashing due to a null FlyString for an ARIA role.
After fixing that, I was confused as to why these roles were not an
enum. Looking at the spec there's a fixed list of roles and switching
from references to static strings to an enum was pretty much an
exercise in find and replace :).
No functional changes (outside of fixing the mentioned crash).
Diffstat (limited to 'Userland/Services/WebContent')
-rw-r--r-- | Userland/Services/WebContent/WebDriverConnection.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp index 803015adc5..f45d9b2678 100644 --- a/Userland/Services/WebContent/WebDriverConnection.cpp +++ b/Userland/Services/WebContent/WebDriverConnection.cpp @@ -1253,7 +1253,9 @@ Messages::WebDriverClient::GetComputedRoleResponse WebDriverConnection::get_comp auto role = element->role_or_default(); // 5. Return success with data role. - return DeprecatedString { role }; + if (role.has_value()) + return Web::DOM::ARIARoles::role_name(*role); + return ""sv; } // 12.5.1 Element Click, https://w3c.github.io/webdriver/#element-click |