Remove Add/Remove AXMode methods, unify usage to ScopedAccessibilityMode
Moderate
Commit Hash:
c7d7fd807032908a70d2b29f58d730bbe1e304dc
Commit Time: 2025-04-29 21:08:16+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review:
View Upstream Review 🔗
📋 Summary
This submission primarily removes the methods for manually adding and removing AXMode flags (AddAccessibilityModeFlags and RemoveAccessibilityModeFlags) in BrowserAccessibilityState, switching to a unified management of process-level accessibility modes using ScopedAccessibilityMode. This change affects the render_widget_host_view_cocoa.mm file in Remote Cocoa, which needs to activate basic accessibility support when assistive technologies are detected. The change also refactors the accessibility API usage detection mechanism, consolidating previously scattered API call detections into a more unified callback system. In particular, on the Windows platform, methods such as OnAdvancedIAccessible2Used have been renamed to more explicit names like OnIAccessible2UsedInWebContent.
🎯 Impact Analysis
The impact on WebView2Mac is mainly reflected in the following aspects: 1) Code architecture impact: The original method of activating accessibility features by directly calling AddAccessibilityModeFlags has been replaced with the use of ScopedAccessibilityMode, which provides better lifecycle management. 2) Accessibility activation mechanism: In Remote Cocoa’s render_widget_host_view_cocoa.mm, the logic for activating basic accessibility support when assistive technologies access the web content container has changed; it now uses CreateScopedModeForProcess to create a scoped mode. 3) API usage detection: The previously scattered API usage detection methods across different platforms have been reorganized, which may affect the detection and response mechanism of accessibility APIs in WebView2Mac. 4) Dependencies: A new dependency on scoped_accessibility_mode.h has been introduced. Overall, this change improves the consistency and reliability of accessibility mode management, but may require corresponding adjustments in WebView2Mac’s related code to adapt to the new API pattern.
Impacted Classes:
RenderWidgetHostViewCocoa
BrowserAccessibilityStateImpl
ScopedAccessibilityMode
WinAccessibilityAPIUsageObserver