| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 return (role() == ui::AX_ROLE_COLUMN_HEADER || | 157 return (role() == ui::AX_ROLE_COLUMN_HEADER || |
| 158 role() == ui::AX_ROLE_HEADING || | 158 role() == ui::AX_ROLE_HEADING || |
| 159 role() == ui::AX_ROLE_ROW_HEADER); | 159 role() == ui::AX_ROLE_ROW_HEADER); |
| 160 } | 160 } |
| 161 | 161 |
| 162 bool BrowserAccessibilityAndroid::IsHierarchical() const { | 162 bool BrowserAccessibilityAndroid::IsHierarchical() const { |
| 163 return (role() == ui::AX_ROLE_LIST || | 163 return (role() == ui::AX_ROLE_LIST || |
| 164 role() == ui::AX_ROLE_TREE); | 164 role() == ui::AX_ROLE_TREE); |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool BrowserAccessibilityAndroid::IsLink() const { |
| 168 return role() == ui::AX_ROLE_LINK || role() == ui::AX_ROLE_IMAGE_MAP_LINK; |
| 169 } |
| 170 |
| 167 bool BrowserAccessibilityAndroid::IsMultiLine() const { | 171 bool BrowserAccessibilityAndroid::IsMultiLine() const { |
| 168 return role() == ui::AX_ROLE_TEXT_AREA; | 172 return role() == ui::AX_ROLE_TEXT_AREA; |
| 169 } | 173 } |
| 170 | 174 |
| 171 bool BrowserAccessibilityAndroid::IsPassword() const { | 175 bool BrowserAccessibilityAndroid::IsPassword() const { |
| 172 return HasState(ui::AX_STATE_PROTECTED); | 176 return HasState(ui::AX_STATE_PROTECTED); |
| 173 } | 177 } |
| 174 | 178 |
| 175 bool BrowserAccessibilityAndroid::IsRangeType() const { | 179 bool BrowserAccessibilityAndroid::IsRangeType() const { |
| 176 return (role() == ui::AX_ROLE_PROGRESS_INDICATOR || | 180 return (role() == ui::AX_ROLE_PROGRESS_INDICATOR || |
| (...skipping 96 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 |