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 return obj->children().size(); | 211 |
| 212 return obj->PlatformChildCount(); |
212 } | 213 } |
213 | 214 |
214 static AtkObject* browser_accessibility_ref_child( | 215 static AtkObject* browser_accessibility_ref_child( |
215 AtkObject* atk_object, gint index) { | 216 AtkObject* atk_object, gint index) { |
216 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object); | 217 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object); |
217 if (!obj) | 218 if (!obj) |
218 return NULL; | 219 return NULL; |
| 220 |
| 221 if (index < 0 || index >= static_cast<gint>(obj->PlatformChildCount())) |
| 222 return NULL; |
| 223 |
219 AtkObject* result = | 224 AtkObject* result = |
220 obj->children()[index]->ToBrowserAccessibilityGtk()->GetAtkObject(); | 225 obj->children()[index]->ToBrowserAccessibilityGtk()->GetAtkObject(); |
221 g_object_ref(result); | 226 g_object_ref(result); |
222 return result; | 227 return result; |
223 } | 228 } |
224 | 229 |
225 static gint browser_accessibility_get_index_in_parent(AtkObject* atk_object) { | 230 static gint browser_accessibility_get_index_in_parent(AtkObject* atk_object) { |
226 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object); | 231 BrowserAccessibilityGtk* obj = ToBrowserAccessibilityGtk(atk_object); |
227 if (!obj) | 232 if (!obj) |
228 return 0; | 233 return 0; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 case WebKit::WebAXRoleTextField: | 509 case WebKit::WebAXRoleTextField: |
505 atk_role_ = ATK_ROLE_ENTRY; | 510 atk_role_ = ATK_ROLE_ENTRY; |
506 break; | 511 break; |
507 default: | 512 default: |
508 atk_role_ = ATK_ROLE_UNKNOWN; | 513 atk_role_ = ATK_ROLE_UNKNOWN; |
509 break; | 514 break; |
510 } | 515 } |
511 } | 516 } |
512 | 517 |
513 } // namespace content | 518 } // namespace content |
OLD | NEW |