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_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 case ui::AX_ROLE_COMBO_BOX: | 344 case ui::AX_ROLE_COMBO_BOX: |
345 case ui::AX_ROLE_POP_UP_BUTTON: | 345 case ui::AX_ROLE_POP_UP_BUTTON: |
346 case ui::AX_ROLE_TEXT_FIELD: | 346 case ui::AX_ROLE_TEXT_FIELD: |
347 return value; | 347 return value; |
348 } | 348 } |
349 } | 349 } |
350 | 350 |
351 // For color wells, the color is stored in separate attributes. | 351 // For color wells, the color is stored in separate attributes. |
352 // Perhaps we could return color names in the future? | 352 // Perhaps we could return color names in the future? |
353 if (GetRole() == ui::AX_ROLE_COLOR_WELL) { | 353 if (GetRole() == ui::AX_ROLE_COLOR_WELL) { |
354 int red = GetIntAttribute(ui::AX_ATTR_COLOR_VALUE_RED); | 354 int color = GetIntAttribute(ui::AX_ATTR_COLOR_VALUE); |
355 int green = GetIntAttribute(ui::AX_ATTR_COLOR_VALUE_GREEN); | 355 int red = (color >> 16) & 0xFF; |
356 int blue = GetIntAttribute(ui::AX_ATTR_COLOR_VALUE_BLUE); | 356 int green = (color >> 8) & 0xFF; |
| 357 int blue = color & 0xFF; |
357 return base::UTF8ToUTF16( | 358 return base::UTF8ToUTF16( |
358 base::StringPrintf("#%02X%02X%02X", red, green, blue)); | 359 base::StringPrintf("#%02X%02X%02X", red, green, blue)); |
359 } | 360 } |
360 | 361 |
361 // Always prefer visible text if this is a link. Sites sometimes add | 362 // Always prefer visible text if this is a link. Sites sometimes add |
362 // a "title" attribute to a link with more information, but we can't | 363 // a "title" attribute to a link with more information, but we can't |
363 // lose the link text. | 364 // lose the link text. |
364 base::string16 name = GetString16Attribute(ui::AX_ATTR_NAME); | 365 base::string16 name = GetString16Attribute(ui::AX_ATTR_NAME); |
365 if (!name.empty() && GetRole() == ui::AX_ROLE_LINK) | 366 if (!name.empty() && GetRole() == ui::AX_ROLE_LINK) |
366 return name; | 367 return name; |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { | 876 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { |
876 int count = 0; | 877 int count = 0; |
877 for (uint32 i = 0; i < PlatformChildCount(); i++) { | 878 for (uint32 i = 0; i < PlatformChildCount(); i++) { |
878 if (PlatformGetChild(i)->GetRole() == role) | 879 if (PlatformGetChild(i)->GetRole() == role) |
879 count++; | 880 count++; |
880 } | 881 } |
881 return count; | 882 return count; |
882 } | 883 } |
883 | 884 |
884 } // namespace content | 885 } // namespace content |
OLD | NEW |