Bug 712927 - Rework the tabs hierarchy in Mac a11y. r=tbsaunde,surkov
authorHub Figuière <hfiguiere@mozilla.com>
Thu, 26 Jan 2012 22:14:09 -0800
changeset 86769 31dffd0f03e55647868c22c13f13957de83cf4d1
parent 86768 36c5d3e2f4467bdb2f1a1ccade08b2fd32336542
child 86770 ec7e23e015994429a2ea258258058d011b2ad5f1
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde, surkov
bugs712927
milestone12.0a1
Bug 712927 - Rework the tabs hierarchy in Mac a11y. r=tbsaunde,surkov
accessible/src/base/nsAccessNode.h
accessible/src/base/nsAccessible.cpp
accessible/src/base/nsAccessible.h
accessible/src/mac/MacUtils.h
accessible/src/mac/MacUtils.mm
accessible/src/mac/Makefile.in
accessible/src/mac/mozAccessible.mm
accessible/src/mac/mozActionElements.h
accessible/src/mac/mozActionElements.mm
accessible/src/mac/nsAccessibleWrap.mm
accessible/src/mac/nsRoleMap.h
dom/locales/en-US/chrome/accessibility/mac/accessible.properties
--- a/accessible/src/base/nsAccessNode.h
+++ b/accessible/src/base/nsAccessNode.h
@@ -190,22 +190,16 @@ public:
    * Return true if the accessible is primary accessible for the given DOM node.
    *
    * Accessible hierarchy may be complex for single DOM node, in this case
    * these accessibles share the same DOM node. The primary accessible "owns"
    * that DOM node in terms it gets stored in the accessible to node map.
    */
   virtual bool IsPrimaryForNode() const;
 
-  /**
-   * Return the string bundle
-   */
-  static nsIStringBundle* GetStringBundle()
-    { return gStringBundle; }
-
 protected:
     nsPresContext* GetPresContext();
 
     void LastRelease();
 
   nsCOMPtr<nsIContent> mContent;
   nsCOMPtr<nsIWeakReference> mWeakShell;
 
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -574,26 +574,23 @@ NS_IMETHODIMP
 nsAccessible::GetIndexInParent(PRInt32 *aIndexInParent)
 {
   NS_ENSURE_ARG_POINTER(aIndexInParent);
 
   *aIndexInParent = IndexInParent();
   return *aIndexInParent != -1 ? NS_OK : NS_ERROR_FAILURE;
 }
 
-nsresult nsAccessible::GetTranslatedString(const nsAString& aKey, nsAString& aStringOut)
+void 
+nsAccessible::TranslateString(const nsAString& aKey, nsAString& aStringOut)
 {
   nsXPIDLString xsValue;
 
-  if (!gStringBundle || 
-    NS_FAILED(gStringBundle->GetStringFromName(PromiseFlatString(aKey).get(), getter_Copies(xsValue)))) 
-    return NS_ERROR_FAILURE;
-
+  gStringBundle->GetStringFromName(PromiseFlatString(aKey).get(), getter_Copies(xsValue));
   aStringOut.Assign(xsValue);
-  return NS_OK;
 }
 
 PRUint64
 nsAccessible::VisibilityState()
 {
   PRUint64 vstates = states::INVISIBLE | states::OFFSCREEN;
 
   // We need to check the parent chain for visibility.
@@ -1891,17 +1888,18 @@ nsAccessible::GetActionName(PRUint8 aInd
 NS_IMETHODIMP
 nsAccessible::GetActionDescription(PRUint8 aIndex, nsAString& aDescription)
 {
   // default to localized action name.
   nsAutoString name;
   nsresult rv = GetActionName(aIndex, name);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  return GetTranslatedString(name, aDescription);
+  TranslateString(name, aDescription);
+  return NS_OK;
 }
 
 // void doAction(in PRUint8 index)
 NS_IMETHODIMP
 nsAccessible::DoAction(PRUint8 aIndex)
 {
   if (aIndex != 0)
     return NS_ERROR_INVALID_ARG;
--- a/accessible/src/base/nsAccessible.h
+++ b/accessible/src/base/nsAccessible.h
@@ -606,16 +606,21 @@ public:
    */
   virtual void SetCurrentItem(nsAccessible* aItem);
 
   /**
    * Return container widget this accessible belongs to.
    */
   virtual nsAccessible* ContainerWidget() const;
 
+  /**
+   * Return the localized string for the given key.
+   */
+  static void TranslateString(const nsAString& aKey, nsAString& aStringOut);
+
 protected:
 
   //////////////////////////////////////////////////////////////////////////////
   // Initializing, cache and tree traverse methods
 
   /**
    * Cache accessible children.
    */
@@ -698,17 +703,16 @@ protected:
 
   /**
    * Compute the name for XUL node.
    */
   nsresult GetXULName(nsAString& aName);
 
   // helper method to verify frames
   static nsresult GetFullKeyName(const nsAString& aModifierName, const nsAString& aKeyName, nsAString& aStringOut);
-  static nsresult GetTranslatedString(const nsAString& aKey, nsAString& aStringOut);
 
   /**
    * Return an accessible for the given DOM node, or if that node isn't
    * accessible, return the accessible for the next DOM node which has one
    * (based on forward depth first search).
    *
    * @param  aStartNode  [in] the DOM node to start from
    * @return              the resulting accessible
new file mode 100644
--- /dev/null
+++ b/accessible/src/mac/MacUtils.h
@@ -0,0 +1,60 @@
+/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2012
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Original Author: Hubert Figuiere <hub@mozilla.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef _MacUtils_H_
+#define _MacUtils_H_
+
+@class NSString;
+class nsString;
+
+namespace mozilla {
+namespace a11y {
+namespace utils {
+
+/**
+ * Get a localized string from the string bundle.
+ * Return nil if not found.
+ */
+NSString* LocalizedString(const nsString& aString);
+
+}
+}
+}
+
+#endif
new file mode 100644
--- /dev/null
+++ b/accessible/src/mac/MacUtils.mm
@@ -0,0 +1,66 @@
+/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2012
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Original Author: Hubert Figuiere <hub@mozilla.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#import "MacUtils.h"
+
+#include "nsAccessible.h"
+
+#include "nsCocoaUtils.h"
+
+namespace mozilla {
+namespace a11y {
+namespace utils {
+
+/**
+ * Get a localized string from the a11y string bundle.
+ * Return nil if not found.
+ */
+NSString* 
+LocalizedString(const nsString& aString)
+{
+  nsString text;
+  
+  nsAccessible::TranslateString(aString, text);
+  
+  return text.IsEmpty() ? nil : nsCocoaUtils::ToNSString(text);
+}
+
+}
+}
+}
--- a/accessible/src/mac/Makefile.in
+++ b/accessible/src/mac/Makefile.in
@@ -52,18 +52,19 @@ CMMSRCS = nsAccessNodeWrap.mm \
           nsDocAccessibleWrap.mm \
           nsRootAccessibleWrap.mm \
           nsAccessibleWrap.mm \
           mozAccessible.mm \
           mozDocAccessible.mm \
           mozActionElements.mm \
           mozTextAccessible.mm \
           mozHTMLAccessible.mm \
+          MacUtils.mm \
           $(NULL)
-          
+
 
 EXPORTS = \
   nsAccessNodeWrap.h \
   nsTextAccessibleWrap.h \
   nsAccessibleWrap.h \
   nsARIAGridAccessibleWrap.h \
   nsDocAccessibleWrap.h \
   nsRootAccessibleWrap.h \
--- a/accessible/src/mac/mozAccessible.mm
+++ b/accessible/src/mac/mozAccessible.mm
@@ -33,17 +33,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
  
 #import "mozAccessible.h"
 
-// to get the mozView formal protocol, that all gecko's ChildViews implement.
+#import "MacUtils.h"
 #import "mozView.h"
 #import "nsRoleMap.h"
 
 #include "nsRect.h"
 #include "nsCocoaUtils.h"
 #include "nsCoord.h"
 #include "nsObjCExceptions.h"
 
@@ -122,34 +122,16 @@ GetNativeFromGeckoAccessible(nsIAccessib
 
   mozAccessible *native = nil;
   anAccessible->GetNativeInterface ((void**)&native);
   return native;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSNULL;
 }
 
-/**
- * Get a localized string from the string bundle.
- * Return nil is not found.
- */
-static NSString* 
-GetLocalizedString(const nsString& aString)
-{
-  if (!nsAccessNode::GetStringBundle())
-    return nil;
-
-  nsXPIDLString text;
-  nsresult rv = nsAccessNode::GetStringBundle()->GetStringFromName(aString.get(),
-                                 getter_Copies(text));
-  NS_ENSURE_SUCCESS(rv, nil);
-
-  return !text.IsEmpty() ? nsCocoaUtils::ToNSString(text) : nil;
-}
-
 #pragma mark -
 
 @implementation mozAccessible
  
 - (id)initWithAccessible:(nsAccessibleWrap*)geckoAccessible
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
@@ -214,30 +196,38 @@ GetLocalizedString(const nsString& aStri
                                                            NSAccessibilityEnabledAttribute,
                                                            NSAccessibilitySizeAttribute,
                                                            NSAccessibilityWindowAttribute,
                                                            NSAccessibilityFocusedAttribute,
                                                            NSAccessibilityHelpAttribute,
                                                            NSAccessibilityTitleUIElementAttribute,
                                                            NSAccessibilityTopLevelUIElementAttribute,
                                                            NSAccessibilityDescriptionAttribute,
+#if DEBUG
+                                                           @"AXMozDescription",
+#endif
                                                            nil];
   }
 
   return generalAttributes;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 - (id)accessibilityAttributeValue:(NSString*)attribute
 {  
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   if (mIsExpired)
     return nil;
+
+#if DEBUG
+  if ([attribute isEqualToString:@"AXMozDescription"])
+    return [NSString stringWithFormat:@"role = %u", mRole];
+#endif
   
   if ([attribute isEqualToString:NSAccessibilityChildrenAttribute])
     return [self children];
   if ([attribute isEqualToString:NSAccessibilityParentAttribute]) 
     return [self parent];
   
 #ifdef DEBUG_hakan
   NSLog (@"(%@ responding to attr %@)", self, attribute);
@@ -249,18 +239,18 @@ GetLocalizedString(const nsString& aStri
     return [self position];
   if ([attribute isEqualToString:NSAccessibilitySubroleAttribute])
     return [self subrole];
   if ([attribute isEqualToString:NSAccessibilityEnabledAttribute])
     return [NSNumber numberWithBool:[self isEnabled]];
   if ([attribute isEqualToString:NSAccessibilityValueAttribute])
     return [self value];
   if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) {
-    if (mRole == roles::INTERNAL_FRAME || mRole == roles::DOCUMENT_FRAME)
-      return GetLocalizedString(NS_LITERAL_STRING("htmlContent")) ? : @"HTML Content";
+    if (mRole == roles::DOCUMENT)
+      return utils::LocalizedString(NS_LITERAL_STRING("htmlContent"));
 
     return NSAccessibilityRoleDescription([self role], nil);
   }
   
   if ([attribute isEqualToString:NSAccessibilityDescriptionAttribute])
     return [self customDescription];
   if ([attribute isEqualToString:NSAccessibilityFocusedAttribute])
     return [NSNumber numberWithBool:[self isFocused]];
--- a/accessible/src/mac/mozActionElements.h
+++ b/accessible/src/mac/mozActionElements.h
@@ -38,18 +38,27 @@
 
 #import <Cocoa/Cocoa.h>
 #import "mozAccessible.h"
 
 /* Simple subclasses for things like checkboxes, buttons, etc. */
 
 @interface mozButtonAccessible : mozAccessible
 - (void)click;
+- (BOOL)isTab;
 @end
 
 @interface mozCheckboxAccessible : mozButtonAccessible
 // returns one of the constants defined in CheckboxValue
 - (int)isChecked;
 @end
 
 /* Used for buttons that may pop up a menu. */
 @interface mozPopupButtonAccessible : mozButtonAccessible
 @end
+
+/* Class for tabs - not individual tabs */
+@interface mozTabsAccessible : mozAccessible
+{
+  NSMutableArray* mTabs;
+}
+-(id)tabs;
+@end
--- a/accessible/src/mac/mozActionElements.mm
+++ b/accessible/src/mac/mozActionElements.mm
@@ -32,17 +32,21 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #import "mozActionElements.h"
+
+#import "MacUtils.h"
+
 #import "nsIAccessible.h"
+#import "nsXULTabAccessible.h"
 
 #include "nsObjCExceptions.h"
 
 using namespace mozilla::a11y;
 
 enum CheckboxValue {
   // these constants correspond to the values in the OS
   kUnchecked = 0,
@@ -55,16 +59,17 @@ enum CheckboxValue {
 - (NSArray*)accessibilityAttributeNames
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   static NSArray *attributes = nil;
   if (!attributes) {
     attributes = [[NSArray alloc] initWithObjects:NSAccessibilityParentAttribute, // required
                                                   NSAccessibilityRoleAttribute, // required
+                                                  NSAccessibilityRoleDescriptionAttribute,
                                                   NSAccessibilityPositionAttribute, // required
                                                   NSAccessibilitySizeAttribute, // required
                                                   NSAccessibilityWindowAttribute, // required
                                                   NSAccessibilityPositionAttribute, // required
                                                   NSAccessibilityTopLevelUIElementAttribute, // required
                                                   NSAccessibilityHelpAttribute,
                                                   NSAccessibilityEnabledAttribute, // required
                                                   NSAccessibilityFocusedAttribute, // required
@@ -78,16 +83,23 @@ enum CheckboxValue {
 }
 
 - (id)accessibilityAttributeValue:(NSString *)attribute
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   if ([attribute isEqualToString:NSAccessibilityChildrenAttribute])
     return nil;
+  if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) {
+    if ([self isTab])
+      return utils::LocalizedString(NS_LITERAL_STRING("tab"));
+    
+    return NSAccessibilityRoleDescription([self role], nil);
+  }
+  
   return [super accessibilityAttributeValue:attribute];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 - (BOOL)accessibilityIsIgnored
 {
   return mIsExpired;
@@ -104,19 +116,23 @@ enum CheckboxValue {
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 - (NSString*)accessibilityActionDescription:(NSString*)action 
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
-  if ([action isEqualToString:NSAccessibilityPressAction])
+  if ([action isEqualToString:NSAccessibilityPressAction]) {
+    if ([self isTab])
+      return utils::LocalizedString(NS_LITERAL_STRING("switch"));
+  
     return @"press button"; // XXX: localize this later?
-    
+  }
+  
   return nil;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 - (void)accessibilityPerformAction:(NSString*)action 
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
@@ -129,16 +145,21 @@ enum CheckboxValue {
 
 - (void)click
 {
   // both buttons and checkboxes have only one action. we should really stop using arbitrary
   // arrays with actions, and define constants for these actions.
   mGeckoAccessible->DoAction(0);
 }
 
+- (BOOL)isTab
+{
+  return (mGeckoAccessible && (mGeckoAccessible->Role() == roles::PAGETAB));
+}
+
 @end
 
 @implementation mozCheckboxAccessible
 
 - (NSString*)accessibilityActionDescription:(NSString*)action 
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
@@ -253,8 +274,90 @@ enum CheckboxValue {
     //       the action needed to show the menu.
     [super click];
   }
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 @end
+
+@implementation mozTabsAccessible
+
+- (void)dealloc
+{
+  [mTabs release];
+
+  [super dealloc];
+}
+
+- (NSArray*)accessibilityAttributeNames
+{
+  // standard attributes that are shared and supported by root accessible (AXMain) elements.
+  static NSMutableArray* attributes = nil;
+  
+  if (!attributes) {
+    attributes = [[super accessibilityAttributeNames] mutableCopy];
+    [attributes addObject:NSAccessibilityContentsAttribute];
+    [attributes addObject:NSAccessibilityTabsAttribute];
+  }
+  
+  return attributes;  
+}
+
+- (id)accessibilityAttributeValue:(NSString *)attribute
+{  
+  if ([attribute isEqualToString:NSAccessibilityContentsAttribute])
+    return [super children];
+  if ([attribute isEqualToString:NSAccessibilityTabsAttribute])
+    return [self tabs];
+  
+  return [super accessibilityAttributeValue:attribute];  
+}
+
+/**
+ * Returns the selected tab (the mozAccessible)
+ */
+- (id)value
+{
+  if (!mGeckoAccessible)
+    return nil;
+    
+  nsAccessible* accessible = mGeckoAccessible->GetSelectedItem(0);
+  if (!accessible)
+    return nil;
+
+  mozAccessible* nativeAcc = nil;
+  nsresult rv = accessible->GetNativeInterface((void**)&nativeAcc);
+  NS_ENSURE_SUCCESS(rv, nil);
+  
+  return nativeAcc;
+}
+
+/**
+ * Return the mozAccessibles that are the tabs.
+ */
+- (id)tabs
+{
+  if (mTabs)
+    return mTabs;
+
+  NSArray* children = [self children];
+  NSEnumerator* enumerator = [children objectEnumerator];
+  mTabs = [[NSMutableArray alloc] init];
+  
+  id obj;
+  while ((obj = [enumerator nextObject]))
+    if ([obj isTab])
+      [mTabs addObject:obj];
+
+  return mTabs;
+}
+
+- (void)invalidateChildren
+{
+  [super invalidateChildren];
+
+  [mTabs release];
+  mTabs = nil;
+}
+
+@end
--- a/accessible/src/mac/nsAccessibleWrap.mm
+++ b/accessible/src/mac/nsAccessibleWrap.mm
@@ -99,25 +99,31 @@ nsAccessibleWrap::GetNativeType ()
     case roles::SPLITBUTTON:
     case roles::TOGGLE_BUTTON:
     {
       // if this button may show a popup, let's make it of the popupbutton type.
       return HasPopup() ? [mozPopupButtonAccessible class] : 
              [mozButtonAccessible class];
     }
     
+    case roles::PAGETAB:
+      return [mozButtonAccessible class];
+
     case roles::CHECKBUTTON:
       return [mozCheckboxAccessible class];
       
     case roles::AUTOCOMPLETE:
       return [mozComboboxAccessible class];
 
     case roles::HEADING:
       return [mozHeadingAccessible class];
 
+    case roles::PAGETABLIST:
+      return [mozTabsAccessible class];
+      
     case roles::ENTRY:
     case roles::STATICTEXT:
     case roles::LABEL:
     case roles::CAPTION:
     case roles::ACCEL_LABEL:
     case roles::TEXT_LEAF:
       // normal textfield (static or editable)
       return [mozTextAccessible class]; 
--- a/accessible/src/mac/nsRoleMap.h
+++ b/accessible/src/mac/nsRoleMap.h
@@ -47,22 +47,22 @@ static const NSString* AXRoles [] = {
   NSAccessibilityMenuBarRole,                   // ROLE_MENUBAR. (irrelevant on OS X; the menubar will always be native and on the top of the screen.)
   NSAccessibilityScrollBarRole,                 // ROLE_SCROLLBAR. we might need to make this its own mozAccessible, to support the children objects (valueindicator, down/up buttons).
   NSAccessibilitySplitterRole,                  // ROLE_GRIP
   NSAccessibilityUnknownRole,                   // ROLE_SOUND. unused on OS X
   NSAccessibilityUnknownRole,                   // ROLE_CURSOR. unused on OS X
   NSAccessibilityUnknownRole,                   // ROLE_CARET. unused on OS X
   NSAccessibilityWindowRole,                    // ROLE_ALERT
   NSAccessibilityWindowRole,                    // ROLE_WINDOW. irrelevant on OS X; all window a11y is handled by the system.
-  @"AXWebArea",                                 // ROLE_INTERNAL_FRAME
+  NSAccessibilityScrollAreaRole,                // ROLE_INTERNAL_FRAME
   NSAccessibilityMenuRole,                      // ROLE_MENUPOPUP. the parent of menuitems
   NSAccessibilityMenuItemRole,                  // ROLE_MENUITEM.
   @"AXHelpTag",                                 // ROLE_TOOLTIP. 10.4+ only, so we re-define the constant.
   NSAccessibilityGroupRole,                     // ROLE_APPLICATION. unused on OS X. the system will take care of this.
-  NSAccessibilityGroupRole,                     // ROLE_DOCUMENT
+  @"AXWebArea",                                 // ROLE_DOCUMENT
   NSAccessibilityGroupRole,                     // ROLE_PANE
   NSAccessibilityUnknownRole,                   // ROLE_CHART
   NSAccessibilityWindowRole,                    // ROLE_DIALOG. there's a dialog subrole.
   NSAccessibilityUnknownRole,                   // ROLE_BORDER. unused on OS X
   NSAccessibilityGroupRole,                     // ROLE_GROUPING
   NSAccessibilityUnknownRole,                   // ROLE_SEPARATOR
   NSAccessibilityToolbarRole,                   // ROLE_TOOLBAR
   NSAccessibilityUnknownRole,                   // ROLE_STATUSBAR. doesn't exist on OS X (a status bar is its parts; a progressbar, a label, etc.)
@@ -74,17 +74,17 @@ static const NSString* AXRoles [] = {
   NSAccessibilityGroupRole,                     // ROLE_CELL
   @"AXLink",                                    // ROLE_LINK. 10.4+ the attr first define in SDK 10.4, so we define it here too. ROLE_LINK
   @"AXHelpTag",                                 // ROLE_HELPBALLOON
   NSAccessibilityUnknownRole,                   // ROLE_CHARACTER. unused on OS X
   NSAccessibilityListRole,                      // ROLE_LIST
   NSAccessibilityRowRole,                       // ROLE_LISTITEM
   NSAccessibilityOutlineRole,                   // ROLE_OUTLINE
   NSAccessibilityRowRole,                       // ROLE_OUTLINEITEM. XXX: use OutlineRow as subrole.
-  NSAccessibilityGroupRole,                     // ROLE_PAGETAB
+  NSAccessibilityRadioButtonRole,               // ROLE_PAGETAB
   NSAccessibilityGroupRole,                     // ROLE_PROPERTYPAGE
   NSAccessibilityUnknownRole,                   // ROLE_INDICATOR
   NSAccessibilityImageRole,                     // ROLE_GRAPHIC
   NSAccessibilityStaticTextRole,                // ROLE_STATICTEXT
   NSAccessibilityStaticTextRole,                // ROLE_TEXT_LEAF
   NSAccessibilityButtonRole,                    // ROLE_PUSHBUTTON
   NSAccessibilityCheckBoxRole,                  // ROLE_CHECKBUTTON
   NSAccessibilityRadioButtonRole,               // ROLE_RADIOBUTTON
@@ -97,17 +97,17 @@ static const NSString* AXRoles [] = {
   NSAccessibilityIncrementorRole,               // ROLE_SPINBUTTON. subroles: Increment/Decrement.
   NSAccessibilityUnknownRole,                   // ROLE_DIAGRAM
   NSAccessibilityUnknownRole,                   // ROLE_ANIMATION
   NSAccessibilityUnknownRole,                   // ROLE_EQUATION
   NSAccessibilityPopUpButtonRole,               // ROLE_BUTTONDROPDOWN.
   NSAccessibilityMenuButtonRole,                // ROLE_BUTTONMENU
   NSAccessibilityGroupRole,                     // ROLE_BUTTONDROPDOWNGRID
   NSAccessibilityUnknownRole,                   // ROLE_WHITESPACE
-  NSAccessibilityGroupRole,                     // ROLE_PAGETABLIST
+  NSAccessibilityTabGroupRole,                  // ROLE_PAGETABLIST
   NSAccessibilityUnknownRole,                   // ROLE_CLOCK. unused on OS X
   NSAccessibilityButtonRole,                    // ROLE_SPLITBUTTON
   NSAccessibilityUnknownRole,                   // ROLE_IPADDRESS
   NSAccessibilityStaticTextRole,                // ROLE_ACCEL_LABEL
   NSAccessibilityUnknownRole,                   // ROLE_ARROW
   NSAccessibilityImageRole,                     // ROLE_CANVAS
   NSAccessibilityMenuItemRole,                  // ROLE_CHECK_MENU_ITEM
   NSAccessibilityColorWellRole,                 // ROLE_COLOR_CHOOSER
@@ -141,19 +141,19 @@ static const NSString* AXRoles [] = {
   NSAccessibilityGroupRole,                     // ROLE_HEADER
   NSAccessibilityGroupRole,                     // ROLE_FOOTER
   NSAccessibilityGroupRole,                     // ROLE_PARAGRAPH
   @"AXRuler",                                   // ROLE_RULER. 10.4+ only, so we re-define the constant.
   NSAccessibilityComboBoxRole,                  // ROLE_AUTOCOMPLETE
   NSAccessibilityTextFieldRole,                 // ROLE_EDITBAR
   NSAccessibilityTextFieldRole,                 // ROLE_ENTRY
   NSAccessibilityStaticTextRole,                // ROLE_CAPTION
-  @"AXWebArea",                                 // ROLE_DOCUMENT_FRAME
+  NSAccessibilityScrollAreaRole,                // ROLE_DOCUMENT_FRAME
   @"AXHeading",                                 // ROLE_HEADING
-  NSAccessibilityGroupRole,                     // ROLE_PAGE
+  NSAccessibilityGroupRole,                     // ROLE_PAG
   NSAccessibilityGroupRole,                     // ROLE_SECTION
   NSAccessibilityUnknownRole,                   // ROLE_REDUNDANT_OBJECT
   NSAccessibilityGroupRole,                     // ROLE_FORM
   NSAccessibilityUnknownRole,                   // ROLE_IME
   NSAccessibilityUnknownRole,                   // ROLE_APP_ROOT. unused on OS X
   NSAccessibilityMenuItemRole,                  // ROLE_PARENT_MENUITEM
   NSAccessibilityGroupRole,                     // ROLE_CALENDAR
   NSAccessibilityMenuRole,                      // ROLE_COMBOBOX_LIST
--- a/dom/locales/en-US/chrome/accessibility/mac/accessible.properties
+++ b/dom/locales/en-US/chrome/accessibility/mac/accessible.properties
@@ -11,8 +11,10 @@ collapse=       Collapse
 expand  =       Expand
 activate=       Activate
 cycle   =       Cycle
 
 # Universal Access API support
 # (Mac Only)
 # The Role Description for AXWebArea (the web widget). Like in Safari.
 htmlContent = HTML Content
+# The Role Description for the Tab button.
+tab     =       tab