Bug 243715 - AX: Modernize AccessibilityMenuListPopup with 2022 code style
Summary: AX: Modernize AccessibilityMenuListPopup with 2022 code style
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tyler Wilcock
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-08-08 21:46 PDT by Tyler Wilcock
Modified: 2022-08-10 10:10 PDT (History)
10 users (show)

See Also:


Attachments
Patch (3.24 KB, patch)
2022-08-08 21:49 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff
Patch (2.74 KB, patch)
2022-08-09 09:35 PDT, Tyler Wilcock
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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].