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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/browser/accessibility/browser_accessibility_manager_android.h" | 8 #include "content/browser/accessibility/browser_accessibility_manager_android.h" |
9 #include "content/common/accessibility_messages.h" | 9 #include "content/common/accessibility_messages.h" |
10 | 10 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 } | 184 } |
185 | 185 |
186 bool BrowserAccessibilityAndroid::IsSelected() const { | 186 bool BrowserAccessibilityAndroid::IsSelected() const { |
187 return HasState(ui::AX_STATE_SELECTED); | 187 return HasState(ui::AX_STATE_SELECTED); |
188 } | 188 } |
189 | 189 |
190 bool BrowserAccessibilityAndroid::IsVisibleToUser() const { | 190 bool BrowserAccessibilityAndroid::IsVisibleToUser() const { |
191 return !HasState(ui::AX_STATE_INVISIBLE); | 191 return !HasState(ui::AX_STATE_INVISIBLE); |
192 } | 192 } |
193 | 193 |
194 bool BrowserAccessibilityAndroid::IsLink() const { | |
dmazzoni
2014/03/03 22:41:28
Nit: same sorted order
| |
195 return role() == ui::AX_ROLE_LINK || role() == ui::AX_ROLE_IMAGE_MAP_LINK; | |
196 } | |
197 | |
194 bool BrowserAccessibilityAndroid::CanOpenPopup() const { | 198 bool BrowserAccessibilityAndroid::CanOpenPopup() const { |
195 return HasState(ui::AX_STATE_HASPOPUP); | 199 return HasState(ui::AX_STATE_HASPOPUP); |
196 } | 200 } |
197 | 201 |
198 const char* BrowserAccessibilityAndroid::GetClassName() const { | 202 const char* BrowserAccessibilityAndroid::GetClassName() const { |
199 const char* class_name = NULL; | 203 const char* class_name = NULL; |
200 | 204 |
201 switch(role()) { | 205 switch(role()) { |
202 case ui::AX_ROLE_EDITABLE_TEXT: | 206 case ui::AX_ROLE_EDITABLE_TEXT: |
203 case ui::AX_ROLE_SPIN_BUTTON: | 207 case ui::AX_ROLE_SPIN_BUTTON: |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 // This is called from PlatformIsLeaf, so don't call PlatformChildCount | 277 // This is called from PlatformIsLeaf, so don't call PlatformChildCount |
274 // from within this! | 278 // from within this! |
275 if (text.empty() && HasOnlyStaticTextChildren()) { | 279 if (text.empty() && HasOnlyStaticTextChildren()) { |
276 for (uint32 i = 0; i < child_count(); i++) { | 280 for (uint32 i = 0; i < child_count(); i++) { |
277 BrowserAccessibility* child = children()[i]; | 281 BrowserAccessibility* child = children()[i]; |
278 text += static_cast<BrowserAccessibilityAndroid*>(child)->GetText(); | 282 text += static_cast<BrowserAccessibilityAndroid*>(child)->GetText(); |
279 } | 283 } |
280 } | 284 } |
281 | 285 |
282 switch(role()) { | 286 switch(role()) { |
283 case ui::AX_ROLE_IMAGE_MAP_LINK: | |
284 case ui::AX_ROLE_LINK: | |
285 if (!text.empty()) | |
286 text += base::ASCIIToUTF16(" "); | |
287 text += base::ASCIIToUTF16("Link"); | |
288 break; | |
289 case ui::AX_ROLE_HEADING: | 287 case ui::AX_ROLE_HEADING: |
290 // Only append "heading" if this node already has text. | 288 // Only append "heading" if this node already has text. |
291 if (!text.empty()) | 289 if (!text.empty()) |
292 text += base::ASCIIToUTF16(" Heading"); | 290 text += base::ASCIIToUTF16(" Heading"); |
293 break; | 291 break; |
294 } | 292 } |
295 | 293 |
296 return text; | 294 return text; |
297 } | 295 } |
298 | 296 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
605 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { | 603 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { |
606 int count = 0; | 604 int count = 0; |
607 for (uint32 i = 0; i < PlatformChildCount(); i++) { | 605 for (uint32 i = 0; i < PlatformChildCount(); i++) { |
608 if (PlatformGetChild(i)->role() == role) | 606 if (PlatformGetChild(i)->role() == role) |
609 count++; | 607 count++; |
610 } | 608 } |
611 return count; | 609 return count; |
612 } | 610 } |
613 | 611 |
614 } // namespace content | 612 } // namespace content |
OLD | NEW |