Bug 243715

Summary: AX: Modernize AccessibilityMenuListPopup with 2022 code style
Product: WebKit Reporter: Tyler Wilcock <tyler_w>
Component: AccessibilityAssignee: Tyler Wilcock <tyler_w>
Status: RESOLVED FIXED    
Severity: Normal CC: aboxhall, andresg_22, apinheiro, cfleizach, dmazzoni, ews-watchlist, jcraig, jdiggs, samuel_white, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Tyler Wilcock 2022-08-08 21:46:36 PDT
Modernize AccessibilityMenuListPopup with 2022 code style.
Comment 1 Radar WebKit Bug Importer 2022-08-08 21:46:47 PDT
<rdar://problem/98360331>
Comment 2 Tyler Wilcock 2022-08-08 21:49:22 PDT
Created attachment 461500 [details]
Patch
Comment 3 Andres Gonzalez 2022-08-09 05:10:49 PDT
(In reply to Tyler Wilcock from comment #2)
> Created attachment 461500 [details]
> Patch

--- a/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp
+++ a/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp
@@ -114,13 +114,13 @@ void AccessibilityMenuListPopup::addChildren()
     if (!m_parent)
         return;

-    Node* selectNode = m_parent->node();
-    if (!selectNode)
+    auto* parentNode = m_parent->node();
+    if (!parentNode || is<HTMLSelectElement>(parentNode))

Should be:
+    if (!is<HTMLSelectElement>(parentNode))


@@ -153,7 +156,7 @@ void AccessibilityMenuListPopup::didUpdateActiveOption(int optionIndex)
     if (!cache)
         return;

-    RefPtr child = downcast<AccessibilityObject>(m_children[optionIndex].get());
+    RefPtr child = dynamicDowncast<AccessibilityObject>(m_children[optionIndex].get());

I think this dynamic cast may be an overkill since how m_children may contain something that is not a AccessibilityObject?
Comment 4 Tyler Wilcock 2022-08-09 09:35:09 PDT
Created attachment 461505 [details]
Patch
Comment 5 EWS 2022-08-10 10:10:44 PDT
Committed 253299@main (bbd5fd4a3e0c): <https://commits.webkit.org/253299@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 461505 [details].