Bug 772060 - Part 1: Implement accessibilityArrayAttributeCount for mozPaneAccessible. r=surkov,tbsaunde
authorHubert Figuière <hfiguiere@mozilla.com>
Wed, 11 Jul 2012 17:29:19 -0700
changeset 105339 600cc083dda03b846250bdd76c1bd0a3e8c6a159
parent 105338 3e1fa8a59f8db1cc34e2942b556c4ef32d320776
child 105340 7055bd78827448669b53dc0dd1827cf477295cb2
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewerssurkov, tbsaunde
bugs772060
milestone17.0a1
Bug 772060 - Part 1: Implement accessibilityArrayAttributeCount for mozPaneAccessible. r=surkov,tbsaunde
accessible/src/mac/mozActionElements.mm
--- a/accessible/src/mac/mozActionElements.mm
+++ b/accessible/src/mac/mozActionElements.mm
@@ -333,16 +333,29 @@ enum CheckboxValue {
   [mTabs release];
   mTabs = nil;
 }
 
 @end
 
 @implementation mozPaneAccessible
 
+- (NSUInteger)accessibilityArrayAttributeCount:(NSString*)attribute
+{
+  if (!mGeckoAccessible)
+    return 0;
+
+  // By default this calls -[[mozAccessible children] count].
+  // Since we don't cache mChildren. This is faster.
+  if ([attribute isEqualToString:NSAccessibilityChildrenAttribute])
+    return mGeckoAccessible->ChildCount() ? 1 : 0;
+
+  return [super accessibilityArrayAttributeCount:attribute];
+}
+
 - (NSArray*)children
 {
   if (!mGeckoAccessible)
     return nil;
 
   nsDeckFrame* deckFrame = do_QueryFrame(mGeckoAccessible->GetFrame());
   nsIFrame* selectedFrame = deckFrame ? deckFrame->GetSelectedBox() : nullptr;