| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 break; | 296 break; |
| 297 case ui::AX_ROLE_LIST: | 297 case ui::AX_ROLE_LIST: |
| 298 case ui::AX_ROLE_LIST_BOX: | 298 case ui::AX_ROLE_LIST_BOX: |
| 299 case ui::AX_ROLE_DESCRIPTION_LIST: | 299 case ui::AX_ROLE_DESCRIPTION_LIST: |
| 300 class_name = "android.widget.ListView"; | 300 class_name = "android.widget.ListView"; |
| 301 break; | 301 break; |
| 302 case ui::AX_ROLE_DIALOG: | 302 case ui::AX_ROLE_DIALOG: |
| 303 class_name = "android.app.Dialog"; | 303 class_name = "android.app.Dialog"; |
| 304 break; | 304 break; |
| 305 case ui::AX_ROLE_ROOT_WEB_AREA: | 305 case ui::AX_ROLE_ROOT_WEB_AREA: |
| 306 class_name = "android.webkit.WebView"; | 306 if (GetParent() == nullptr) |
| 307 class_name = "android.webkit.WebView"; |
| 308 else |
| 309 class_name = "android.view.View"; |
| 307 break; | 310 break; |
| 308 case ui::AX_ROLE_MENU_ITEM: | 311 case ui::AX_ROLE_MENU_ITEM: |
| 309 case ui::AX_ROLE_MENU_ITEM_CHECK_BOX: | 312 case ui::AX_ROLE_MENU_ITEM_CHECK_BOX: |
| 310 case ui::AX_ROLE_MENU_ITEM_RADIO: | 313 case ui::AX_ROLE_MENU_ITEM_RADIO: |
| 311 class_name = "android.view.MenuItem"; | 314 class_name = "android.view.MenuItem"; |
| 312 break; | 315 break; |
| 313 default: | 316 default: |
| 314 class_name = "android.view.View"; | 317 class_name = "android.view.View"; |
| 315 break; | 318 break; |
| 316 } | 319 } |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 int x = GetIntAttribute(ui::AX_ATTR_SCROLL_X); | 931 int x = GetIntAttribute(ui::AX_ATTR_SCROLL_X); |
| 929 int x_min = GetIntAttribute(ui::AX_ATTR_SCROLL_X_MIN); | 932 int x_min = GetIntAttribute(ui::AX_ATTR_SCROLL_X_MIN); |
| 930 int x_max = GetIntAttribute(ui::AX_ATTR_SCROLL_X_MAX); | 933 int x_max = GetIntAttribute(ui::AX_ATTR_SCROLL_X_MAX); |
| 931 int y = GetIntAttribute(ui::AX_ATTR_SCROLL_Y); | 934 int y = GetIntAttribute(ui::AX_ATTR_SCROLL_Y); |
| 932 int y_min = GetIntAttribute(ui::AX_ATTR_SCROLL_Y_MIN); | 935 int y_min = GetIntAttribute(ui::AX_ATTR_SCROLL_Y_MIN); |
| 933 int y_max = GetIntAttribute(ui::AX_ATTR_SCROLL_Y_MAX); | 936 int y_max = GetIntAttribute(ui::AX_ATTR_SCROLL_Y_MAX); |
| 934 | 937 |
| 935 // Figure out the bounding box of the visible portion of this scrollable | 938 // Figure out the bounding box of the visible portion of this scrollable |
| 936 // view so we know how much to scroll by. | 939 // view so we know how much to scroll by. |
| 937 gfx::Rect bounds; | 940 gfx::Rect bounds; |
| 938 if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA) { | 941 if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA && !GetParent()) { |
| 939 // If this is the root web area, use the bounds of the view to determine | 942 // If this is the root web area, use the bounds of the view to determine |
| 940 // how big one page is. | 943 // how big one page is. |
| 941 if (!manager()->delegate()) | 944 if (!manager()->delegate()) |
| 942 return false; | 945 return false; |
| 943 bounds = manager()->delegate()->AccessibilityGetViewBounds(); | 946 bounds = manager()->delegate()->AccessibilityGetViewBounds(); |
| 944 } else if (GetRole() == ui::AX_ROLE_WEB_AREA) { | 947 } else if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA && GetParent()) { |
| 945 // If this is a web area inside of an iframe, try to use the bounds of | 948 // If this is a web area inside of an iframe, try to use the bounds of |
| 946 // the containing element. | 949 // the containing element. |
| 947 BrowserAccessibility* parent = GetParent(); | 950 BrowserAccessibility* parent = GetParent(); |
| 948 while (parent && (parent->GetLocation().width() == 0 || | 951 while (parent && (parent->GetLocation().width() == 0 || |
| 949 parent->GetLocation().height() == 0)) { | 952 parent->GetLocation().height() == 0)) { |
| 950 parent = parent->GetParent(); | 953 parent = parent->GetParent(); |
| 951 } | 954 } |
| 952 if (parent) | 955 if (parent) |
| 953 bounds = parent->GetLocation(); | 956 bounds = parent->GetLocation(); |
| 954 else | 957 else |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { | 1382 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { |
| 1380 int count = 0; | 1383 int count = 0; |
| 1381 for (uint32_t i = 0; i < PlatformChildCount(); i++) { | 1384 for (uint32_t i = 0; i < PlatformChildCount(); i++) { |
| 1382 if (PlatformGetChild(i)->GetRole() == role) | 1385 if (PlatformGetChild(i)->GetRole() == role) |
| 1383 count++; | 1386 count++; |
| 1384 } | 1387 } |
| 1385 return count; | 1388 return count; |
| 1386 } | 1389 } |
| 1387 | 1390 |
| 1388 } // namespace content | 1391 } // namespace content |
| OLD | NEW |