OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_gtk.h" | 5 #include "content/browser/accessibility/browser_accessibility_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/browser/accessibility/browser_accessibility_manager_gtk.h" | 10 #include "content/browser/accessibility/browser_accessibility_manager_gtk.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 BrowserAccessibilityManagerGtk* manager = | 202 BrowserAccessibilityManagerGtk* manager = |
203 static_cast<BrowserAccessibilityManagerGtk*>(obj->manager()); | 203 static_cast<BrowserAccessibilityManagerGtk*>(obj->manager()); |
204 return gtk_widget_get_accessible(manager->parent_widget()); | 204 return gtk_widget_get_accessible(manager->parent_widget()); |
205 } | 205 } |
206 | 206 |
207 static gint browser_accessibility_get_n_children(AtkObject* atk_object) { | 207 static gint browser_accessibility_get_n_children(AtkObject* atk_object) { |
208 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object); | 208 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object); |
209 if (!obj) | 209 if (!obj) |
210 return 0; | 210 return 0; |
| 211 |
| 212 if (obj->IsLeaf()) |
| 213 return 0; |
| 214 |
211 return obj->children().size(); | 215 return obj->children().size(); |
212 } | 216 } |
213 | 217 |
214 static AtkObject* browser_accessibility_ref_child( | 218 static AtkObject* browser_accessibility_ref_child( |
215 AtkObject* atk_object, gint index) { | 219 AtkObject* atk_object, gint index) { |
216 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object); | 220 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object); |
217 if (!obj) | 221 if (!obj) |
218 return NULL; | 222 return NULL; |
| 223 |
| 224 if (obj->IsLeaf()) |
| 225 return NULL; |
| 226 |
| 227 if (index < 0 || index >= static_cast<gint>(obj->children().size())) |
| 228 return NULL; |
| 229 |
219 AtkObject* result = | 230 AtkObject* result = |
220 obj->children()[index]->ToBrowserAccessibilityGtk()->GetAtkObject(); | 231 obj->children()[index]->ToBrowserAccessibilityGtk()->GetAtkObject(); |
221 g_object_ref(result); | 232 g_object_ref(result); |
222 return result; | 233 return result; |
223 } | 234 } |
224 | 235 |
225 static gint browser_accessibility_get_index_in_parent(AtkObject* atk_object) { | 236 static gint browser_accessibility_get_index_in_parent(AtkObject* atk_object) { |
226 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object); | 237 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object); |
227 if (!obj) | 238 if (!obj) |
228 return 0; | 239 return 0; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 case WebKit::WebAXRoleTextField: | 515 case WebKit::WebAXRoleTextField: |
505 atk_role_ = ATK_ROLE_ENTRY; | 516 atk_role_ = ATK_ROLE_ENTRY; |
506 break; | 517 break; |
507 default: | 518 default: |
508 atk_role_ = ATK_ROLE_UNKNOWN; | 519 atk_role_ = ATK_ROLE_UNKNOWN; |
509 break; | 520 break; |
510 } | 521 } |
511 } | 522 } |
512 | 523 |
513 } // namespace content | 524 } // namespace content |
OLD | NEW |