Bug 1177378 - Fix control type announcements on OS X by checking if subrole is not NIL when calculating role descriptions. r=surkov, a=sledru
authorMarco Zehe <mzehe@mozilla.com>
Thu, 25 Jun 2015 17:23:01 -0700
changeset 275206 e9f6733322559ba0f72f93192081c50ee435fe17
parent 275205 fc70b85d2c6d414459644c3d0cd0b50e42fc443b
child 275207 d2826245bf84a2782ea3d318716724021b85ef08
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov, sledru
bugs1177378
milestone40.0a2
Bug 1177378 - Fix control type announcements on OS X by checking if subrole is not NIL when calculating role descriptions. r=surkov, a=sledru
accessible/mac/mozAccessible.mm
--- a/accessible/mac/mozAccessible.mm
+++ b/accessible/mac/mozAccessible.mm
@@ -509,20 +509,22 @@ struct RoleDescrComparator
 
 - (NSString*)roleDescription
 {
   if (mRole == roles::DOCUMENT)
     return utils::LocalizedString(NS_LITERAL_STRING("htmlContent"));
 
   NSString* subrole = [self subrole];
 
-  size_t idx = 0;
-  if (BinarySearchIf(sRoleDescrMap, 0, ArrayLength(sRoleDescrMap),
-                     RoleDescrComparator(subrole), &idx)) {
-    return utils::LocalizedString(sRoleDescrMap[idx].description);
+  if (subrole) {
+    size_t idx = 0;
+    if (BinarySearchIf(sRoleDescrMap, 0, ArrayLength(sRoleDescrMap),
+                       RoleDescrComparator(subrole), &idx)) {
+      return utils::LocalizedString(sRoleDescrMap[idx].description);
+    }
   }
 
   return NSAccessibilityRoleDescription([self role], subrole);
 }
 
 - (NSString*)title
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;