OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/accessibility/browser_accessibility_android.h" | 5 #include "content/browser/accessibility/browser_accessibility_android.h" |
6 | 6 |
7 #include "base/i18n/break_iterator.h" | 7 #include "base/i18n/break_iterator.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 bool is_aria_pressed_defined; | 137 bool is_aria_pressed_defined; |
138 bool is_mixed; | 138 bool is_mixed; |
139 GetAriaTristate("aria-pressed", &is_aria_pressed_defined, &is_mixed); | 139 GetAriaTristate("aria-pressed", &is_aria_pressed_defined, &is_mixed); |
140 if (GetRole() == ui::AX_ROLE_CHECK_BOX || | 140 if (GetRole() == ui::AX_ROLE_CHECK_BOX || |
141 GetRole() == ui::AX_ROLE_RADIO_BUTTON || | 141 GetRole() == ui::AX_ROLE_RADIO_BUTTON || |
142 GetRole() == ui::AX_ROLE_MENU_ITEM_CHECK_BOX || | 142 GetRole() == ui::AX_ROLE_MENU_ITEM_CHECK_BOX || |
143 GetRole() == ui::AX_ROLE_MENU_ITEM_RADIO || | 143 GetRole() == ui::AX_ROLE_MENU_ITEM_RADIO || |
144 is_aria_pressed_defined) { | 144 is_aria_pressed_defined) { |
145 checkable = true; | 145 checkable = true; |
146 } | 146 } |
147 if (HasState(ui::AX_STATE_CHECKED)) | 147 // TODO(aleventhal) does this ever happen when checkable is not true yet? |
aleventhal
2017/03/09 17:10:50
Dominic, we had this extra logic, but I'm not sure
| |
148 if (HasIntAttribute(ui::AX_ATTR_CHECKED_STATE)) | |
148 checkable = true; | 149 checkable = true; |
149 return checkable; | 150 return checkable; |
150 } | 151 } |
151 | 152 |
152 bool BrowserAccessibilityAndroid::IsChecked() const { | 153 bool BrowserAccessibilityAndroid::IsChecked() const { |
153 return (HasState(ui::AX_STATE_CHECKED) || HasState(ui::AX_STATE_PRESSED)); | 154 const int checkedState = GetIntAttribute(ui::AX_ATTR_CHECKED_STATE); |
155 return (checkedState == ui::AX_CHECKED_STATE_TRUE || | |
156 HasState(ui::AX_STATE_PRESSED)); | |
154 } | 157 } |
155 | 158 |
156 bool BrowserAccessibilityAndroid::IsClickable() const { | 159 bool BrowserAccessibilityAndroid::IsClickable() const { |
157 // If it has a default action, it's definitely clickable. | 160 // If it has a default action, it's definitely clickable. |
158 if (HasIntAttribute(ui::AX_ATTR_ACTION)) | 161 if (HasIntAttribute(ui::AX_ATTR_ACTION)) |
159 return true; | 162 return true; |
160 | 163 |
161 // Otherwise return true if it's focusable, but skip web areas and iframes. | 164 // Otherwise return true if it's focusable, but skip web areas and iframes. |
162 if (IsIframe() || (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA)) | 165 if (IsIframe() || (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA)) |
163 return false; | 166 return false; |
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1498 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { | 1501 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { |
1499 int count = 0; | 1502 int count = 0; |
1500 for (uint32_t i = 0; i < PlatformChildCount(); i++) { | 1503 for (uint32_t i = 0; i < PlatformChildCount(); i++) { |
1501 if (PlatformGetChild(i)->GetRole() == role) | 1504 if (PlatformGetChild(i)->GetRole() == role) |
1502 count++; | 1505 count++; |
1503 } | 1506 } |
1504 return count; | 1507 return count; |
1505 } | 1508 } |
1506 | 1509 |
1507 } // namespace content | 1510 } // namespace content |
OLD | NEW |