Reland [views-ax] Migrating attributes being set from `GetData` This CL relands CL:5868477. It was originally reverted due seemingly have caused a regression on Mac https://issues.chromium.org/issues/377172674. After some investigation, we were able to determine that the overall issue was a flaw in the logic when reparenting a View that was set to be invisible by inheritance, to a tree where it shouldn't be marked as invisible by inheritance. This CL fixes that logic in `ViewAccessibility::OnViewHasNewAncestor` and adds a test for this scenario. From the original description: This CL "migrates" the attributes being set in `ViewAXPlatformNodeDelegate::GetData` from being computed every time `GetData` was called, to being cached in `ViewAccessibility` There are two attributes that are explicitly migrated: * kInvisible * kIgnored However, kInvisible affects the focusable state of a view, since a view that is invisible should not be marked as focusable, and the focusable state affects the ignored state since a view that is unfocusable and is a descendant of a focusable view should be marked as ignored (minus in ChromeOS it seems). Therefore, these two (really three) attributes had to be migrated from `GetData` in this same CL. For kInvisible: Any descendant of an invisible view should also NOT be visible. As a result, there are two main places we want to recurse and update the visible states of descendants: 1) When a View's visibility changes in `SetVisible` 2) When a View is added to be a child of another View. For kIgnored: Any unfocusable descendant of a focusable view should be marked as ignored. As a result, there are two main places where we need to recurse and update the ignored state 1) When the focus behavior of a view changes. 2) When a view gets added as a child of another View and now has a focusable ancestor. This CL makes the following updates to the function `UpdateStatesForViewAndDescendants`: 1) Changes the name to make it clear that this function is used when the View gets added to a Views tree. 2) It includes the recursive updating for kIgnored and kInvisible so that we don't have to add a different function that walks the tree again. This CL includes a change to LockContentsView: The reason we needed this change is because now with this CL we started failing a test involving this View. The reason for this was that now we are updating the View's accessible focusable state not only when queried now, and this led to a failure because LockContentsView is setting the FocusBehavior to be ALWAYS, but at the same time we are inheriting from NonAccessibleView which is setting the invisible state in the accessibility cache (due to a recent migration). This state is invalid, for a11y, a View can't be both invisible and focusable. So now we make sure that this View is not set to invisible. To prevent this in the future, I've added checks in relevant functions that should catch this. This CL is part of the ViewsAX project: https://docs.google.com/document/d/1Ku7HOyDsiZem1yaV6ccZ-tz3lO2XR2NEcm8HjR6d-VY/edit#heading=h.ke1u3utej413 Bug: 325137417, 371237539 Change-Id: I07a92a5cd17321c881a15954ed964b2448dbe586 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6190622 Reviewed-by: Dirk Pranke <dpranke@google.com> Reviewed-by: Benjamin Beaudry <benjamin.beaudry@microsoft.com> Commit-Queue: Javier Contreras <javiercon@microsoft.com> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1413761}
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.