Reland "[A11yPerformance] Clean up BrowserAccessibilityState" Problem and fix: The test NewTabPageAppA11yTest.Click failed as mentioned in crbug.com/404576872 failed because there were two call sites setting the process accessibility mode directly, basically competing with each other. This only happens after the CL landed where we are removing outdated OnScreenReaderDetected/Stopped methods and replacing them with close equivalents. However, these two methods were not symmetrical in the old code. One enabled accessibility, and one potentially disabled accessibility after a short delay. The modern way to set an accessibility mode, which fixes this issue, is to use ScopedAccessibilityMode. When it goes out of scope it doesn't destroy the a11y mode set by any other piece of code. A follow-up is to move all code setting a process accessibility mode to ScopedAccessibilityMode. Original change's description: > Revert "[A11yPerformance] Clean up BrowserAccessibilityState" > > This reverts commit 8c794f38d38f698d49c5048814d788471be7a88b. > > Reason for revert: breaks test on multiple Mac bots crbug.com/404576872 > > Original change's description: > > [A11yPerformance] Clean up BrowserAccessibilityState > > > > 1. Clarify which methods/variables are related to Auto Disable as > > opposed to just Disable (manually disabling of a11y), so that > > it's no longer confusing what belongs to what intention. > > > > 2. Rename some methods to accurately reflect what they do, > > and add comments: > > * IsRendererAccessibilityEnabled() -> IsAccessibilityAllowed(). > > This was not specific to renderers, or whether a11y was enabled. > > It returned true if a11y was not disallowed via the command line. > > * EnableAccessibility() -> EnableCompleteAccessibility(). > > This turns on kAXModeComplete. > > > > 3. Remove some poorly named and redundant methods that are not > > actually needed: > > * ResetAccessibilityMode() -- the same as DisableAccessibility(). > > * OnScreenReaderDetected() -- did not actually reflect screen > > reader detection and was just a way to EnableAccessibility(), so > > is redundant with that. Any remaining methods and modes with > > "screen reader" in the name will now make sense. > > * OnScreenReaderStopped() -- did not actually reflect the stoppage > > of a screen reader and callers are better off using > > DisableAccessibility(). > > > > 4. The new UMA Accessibility.EngineUse.TimeUntilStart that was just > > added was not working on all platforms, because some platforms > > use AddAccessibilityModeFlags() and others use > > EnableAccessibility(). Move the UMA code to > > OnAccessibilityAPIUsage() where it will always be hit. > > > > This relates to a11y performance because it helps build the > > foundation for the auto disable refresh by clarifying what > > different pieces do and cleaning up code paths. > > > > Follow-ups: > > - Audit calls to OnAccessibilityAPIUsed(), such as from > > AXPlatformNodeDelegate::GetRole(). If we don't change that, we'll > > always think that there's new API usage every time we Unserialize > > from a renderer, which breaks the auto-disable heuristic. > > - Use ScopedAccessibilityMode for chrome/browser/apps/app_shim/app_shim_host_mac.cc. > > > > Bug: 401232343 > > Change-Id: Id386c378812484aae01e2a93dac90336c0aa7ae3 > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6333854 > > Commit-Queue: Aaron Leventhal <aleventhal@chromium.org> > > Reviewed-by: Greg Thompson <grt@chromium.org> > > Reviewed-by: Benjamin Beaudry <benjamin.beaudry@microsoft.com> > > Reviewed-by: Nasko Oskov <nasko@chromium.org> > > Cr-Commit-Position: refs/heads/main@{#1434483} > > Bug: 401232343,404576872 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Change-Id: I6d43b0fa9d36b7ee0adeaf38b2b04e2b044eea60 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6367795 > Reviewed-by: Aaron Leventhal <aleventhal@chromium.org> > Reviewed-by: Takuto Ikuta <tikuta@chromium.org> > Commit-Queue: Ming-Ying Chung <mych@chromium.org> > Owners-Override: Ming-Ying Chung <mych@chromium.org> > Cr-Commit-Position: refs/heads/main@{#1434613} Bug: 401232343,404576872,404576872 Change-Id: I1192fe2310402a84f47e4c89114bba8d30ee733f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6373060 Reviewed-by: Mark Mentovai <mark@chromium.org> Auto-Submit: Aaron Leventhal <aleventhal@chromium.org> Commit-Queue: Aaron Leventhal <aleventhal@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Reviewed-by: Benjamin Beaudry <benjamin.beaudry@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1435606}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.