Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Unified Diff: ui/views/accessibility/native_view_accessibility.cc

Issue 2601883002: MacViews/a11y: Mark Views as invisible if their parents are invisible. (Closed)
Patch Set: Add test. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/accessibility/native_view_accessibility.cc
diff --git a/ui/views/accessibility/native_view_accessibility.cc b/ui/views/accessibility/native_view_accessibility.cc
index 7c960348478b020d7b0bfeed5adf0f50f45e5d70..7d0910f100a9f9983518231221015cd910547ae4 100644
--- a/ui/views/accessibility/native_view_accessibility.cc
+++ b/ui/views/accessibility/native_view_accessibility.cc
@@ -13,6 +13,21 @@
namespace views {
+namespace {
+
+// Determine a View's visibility accounting for potentially invisible ancestors,
+// since View::visible() won't return true for descendants of invisible Views.
+bool IsViewVisible(View* view) {
+ while (view) {
karandeepb 2016/12/28 10:59:59 Also a visible view with no parent would return tr
Patti Lor 2016/12/29 00:57:56 This was fixed when replacing this method with IsD
+ if (!view->visible())
+ return false;
+ view = view->parent();
+ }
+ return true;
+}
+
+} // namespace
+
#if !defined(PLATFORM_HAS_NATIVE_VIEW_ACCESSIBILITY_IMPL)
// static
NativeViewAccessibility* NativeViewAccessibility::Create(View* view) {
@@ -85,7 +100,7 @@ const ui::AXNodeData& NativeViewAccessibility::GetData() {
if (!view_->enabled())
data_.state |= (1 << ui::AX_STATE_DISABLED);
- if (!view_->visible())
+ if (!IsViewVisible(view_))
karandeepb 2016/12/28 10:57:10 It seems to me that View::IsDrawn accomplishes the
Patti Lor 2016/12/29 00:57:56 Oops, you're totally right. Thanks for pointing it
data_.state |= (1 << ui::AX_STATE_INVISIBLE);
return data_;

Powered by Google App Engine
This is Rietveld 408576698