Bug 810572, part 3 - merge Accessible::AccessibleTypes with AccTypes, r=tbsaude
authorAlexander Surkov <surkov.alexander@gmail.com>
Tue, 18 Dec 2012 14:22:26 +0900
changeset 126240 2e0bc271e28f452bf046a488b5547ae65cdffc8f
parent 126236 dd277d439d313b477f4809c20783668478c3ecd7
child 126241 9c63294d0a871095fbb9bdb4b35008e0f86c8d48
push id297
push userlsblakk@mozilla.com
push dateTue, 26 Mar 2013 17:28:00 +0000
treeherdermozilla-release@64d7b45c34e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaude
bugs810572
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 810572, part 3 - merge Accessible::AccessibleTypes with AccTypes, r=tbsaude
accessible/src/base/AccTypes.h
accessible/src/base/nsARIAMap.cpp
accessible/src/base/nsAccessibilityService.cpp
accessible/src/generic/Accessible-inl.h
accessible/src/generic/Accessible.cpp
accessible/src/generic/Accessible.h
accessible/src/generic/ApplicationAccessible.cpp
accessible/src/generic/DocAccessible.cpp
accessible/src/generic/DocAccessible.h
accessible/src/generic/FormControlAccessible.h
accessible/src/generic/HyperTextAccessible.cpp
accessible/src/generic/HyperTextAccessible.h
accessible/src/generic/ImageAccessible.cpp
accessible/src/generic/RootAccessible.cpp
accessible/src/generic/RootAccessible.h
accessible/src/generic/TextLeafAccessible.cpp
accessible/src/generic/TextLeafAccessible.h
accessible/src/html/HTMLFormControlAccessible.cpp
accessible/src/html/HTMLImageMapAccessible.cpp
accessible/src/html/HTMLImageMapAccessible.h
accessible/src/html/HTMLListAccessible.cpp
accessible/src/html/HTMLListAccessible.h
accessible/src/html/HTMLSelectAccessible.cpp
accessible/src/html/HTMLTableAccessible.cpp
accessible/src/html/HTMLTableAccessible.h
accessible/src/xul/XULColorPickerAccessible.cpp
accessible/src/xul/XULComboboxAccessible.cpp
accessible/src/xul/XULFormControlAccessible.cpp
accessible/src/xul/XULListboxAccessible.cpp
accessible/src/xul/XULMenuAccessible.cpp
accessible/src/xul/XULSelectControlAccessible.cpp
accessible/src/xul/XULTabAccessible.h
accessible/src/xul/XULTreeAccessible.cpp
accessible/src/xul/XULTreeGridAccessible.cpp
layout/generic/nsObjectFrame.cpp
--- a/accessible/src/base/AccTypes.h
+++ b/accessible/src/base/AccTypes.h
@@ -1,23 +1,28 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#pragma once
+#ifndef mozilla_a11y_AccTypes_h
+#define mozilla_a11y_AccTypes_h
 
 namespace mozilla {
 namespace a11y {
 
 /**
- * Accessible object types used when creating an accessible based on the frame.
+ * Accessible object types. Each accessible class can have own type.
  */
 enum AccType {
+  /**
+   * This set of types is used for accessible creation, keep them together in
+   * alphabetical order since they are used in switch statement.
+   */
   eNoType,
   eHTMLBRType,
   eHTMLButtonType,
   eHTMLCanvasType,
   eHTMLCaptionType,
   eHTMLCheckboxType,
   eHTMLComboboxType,
   eHTMLFileInputType,
@@ -31,14 +36,50 @@ enum AccType {
   eHTMLRadioButtonType,
   eHTMLTableType,
   eHTMLTableCellType,
   eHTMLTableRowType,
   eHTMLTextFieldType,
   eHyperTextType,
   eImageType,
   eOuterDocType,
-  ePlugin,
-  eTextLeafType
+  ePluginType,
+  eTextLeafType,
+
+  /**
+   * Other accessible types.
+   */
+  eApplicationType,
+  eImageMapType,
+  eMenuPopupType,
+  eProgressType,
+  eRootType,
+  eXULDeckType,
+  eXULTreeType,
+
+  eLastAccType = eXULTreeType
 };
-}
-}
 
+/**
+ * Generic accessible type, different accessible classes can share the same
+ * type, the same accessible class can have several types.
+ */
+enum AccGenericType {
+  eAutoComplete = 1 << 0,
+  eAutoCompletePopup = 1 << 1,
+  eCombobox = 1 << 2,
+  eDocument = 1 << 3,
+  eHyperText = 1 << 4,
+  eList = 1 << 5,
+  eListControl = 1 << 6,
+  eMenuButton = 1 << 7,
+  eSelect = 1 << 8,
+  eTable = 1 << 9,
+  eTableCell = 1 << 10,
+  eTableRow = 1 << 11,
+
+  eLastAccGenericType = eTableRow
+};
+
+} // namespace a11y
+} // namespace mozilla
+
+#endif // mozilla_a11y_AccTypes_h
--- a/accessible/src/base/nsARIAMap.cpp
+++ b/accessible/src/base/nsARIAMap.cpp
@@ -105,17 +105,17 @@ static nsRoleMapEntry sWAIRoleMaps[] =
   },
   { // columnheader
     &nsGkAtoms::columnheader,
     roles::COLUMNHEADER,
     kUseMapRole,
     eNoValue,
     eSortAction,
     eNoLiveAttr,
-    Accessible::eTableCellAccessible,
+    eTableCell,
     kNoReqStates,
     eARIASelectable,
     eARIAReadonly
   },
   { // combobox
     &nsGkAtoms::combobox,
     roles::COMBOBOX,
     kUseMapRole,
@@ -139,17 +139,17 @@ static nsRoleMapEntry sWAIRoleMaps[] =
   },
   { // directory
     &nsGkAtoms::directory,
     roles::LIST,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
-    Accessible::eListAccessible,
+    eList,
     kNoReqStates
   },
   { // document
     &nsGkAtoms::document,
     roles::DOCUMENT,
     kUseMapRole,
     eNoValue,
     eNoAction,
@@ -170,29 +170,29 @@ static nsRoleMapEntry sWAIRoleMaps[] =
   },
   { // grid
     &nsGkAtoms::grid,
     roles::TABLE,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
-    Accessible::eSelectAccessible | Accessible::eTableAccessible,
+    eSelect | eTable,
     states::FOCUSABLE,
     eARIAMultiSelectable,
     eARIAReadonly
   },
   { // gridcell
     &nsGkAtoms::gridcell,
     roles::GRID_CELL,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
-    Accessible::eTableCellAccessible,
+    eTableCell,
     kNoReqStates,
     eARIASelectable,
     eARIAReadonly
   },
   { // group
     &nsGkAtoms::group,
     roles::GROUPING,
     kUseMapRole,
@@ -234,27 +234,27 @@ static nsRoleMapEntry sWAIRoleMaps[] =
   },
   { // list
     &nsGkAtoms::list,
     roles::LIST,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
-    Accessible::eListAccessible,
+    eList,
     states::READONLY
   },
   { // listbox
     &nsGkAtoms::listbox,
     roles::LISTBOX,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
-    Accessible::eSelectAccessible,
+    eSelect,
     kNoReqStates,
     eARIAMultiSelectable,
     eARIAReadonly
   },
   { // listitem
     &nsGkAtoms::listitem,
     roles::LISTITEM,
     kUseMapRole,
@@ -424,17 +424,17 @@ static nsRoleMapEntry sWAIRoleMaps[] =
   },
   { // row
     &nsGkAtoms::row,
     roles::ROW,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
-    Accessible::eTableRowAccessible,
+    eTableRow,
     kNoReqStates,
     eARIASelectable
   },
   { // rowgroup
     &nsGkAtoms::rowgroup,
     roles::GROUPING,
     kUseMapRole,
     eNoValue,
@@ -445,17 +445,17 @@ static nsRoleMapEntry sWAIRoleMaps[] =
   },
   { // rowheader
     &nsGkAtoms::rowheader,
     roles::ROWHEADER,
     kUseMapRole,
     eNoValue,
     eSortAction,
     eNoLiveAttr,
-    Accessible::eTableCellAccessible,
+    eTableCell,
     kNoReqStates,
     eARIASelectable,
     eARIAReadonly
   },
   { // scrollbar
     &nsGkAtoms::scrollbar,
     roles::SCROLLBAR,
     kUseMapRole,
@@ -524,17 +524,17 @@ static nsRoleMapEntry sWAIRoleMaps[] =
   },
   { // tablist
     &nsGkAtoms::tablist,
     roles::PAGETABLIST,
     kUseMapRole,
     eNoValue,
     eNoAction,
     ePoliteLiveAttr,
-    Accessible::eSelectAccessible,
+    eSelect,
     kNoReqStates
   },
   { // tabpanel
     &nsGkAtoms::tabpanel,
     roles::PROPERTYPAGE,
     kUseMapRole,
     eNoValue,
     eNoAction,
@@ -586,29 +586,29 @@ static nsRoleMapEntry sWAIRoleMaps[] =
   },
   { // tree
     &nsGkAtoms::tree,
     roles::OUTLINE,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
-    Accessible::eSelectAccessible,
+    eSelect,
     kNoReqStates,
     eARIAReadonly,
     eARIAMultiSelectable
   },
   { // treegrid
     &nsGkAtoms::treegrid,
     roles::TREE_TABLE,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
-    Accessible::eSelectAccessible | Accessible::eTableAccessible,
+    eSelect | eTable,
     kNoReqStates,
     eARIAReadonly,
     eARIAMultiSelectable
   },
   { // treeitem
     &nsGkAtoms::treeitem,
     roles::OUTLINEITEM,
     kUseMapRole,
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -792,24 +792,24 @@ nsAccessibilityService::GetOrCreateAcces
 
     roleMapEntry = nullptr;
   }
 
   if (!newAcc && isHTML) {  // HTML accessibles
     if (roleMapEntry) {
       // Create pure ARIA grid/treegrid related accessibles if they weren't used
       // on accessible HTML table elements.
-      if ((roleMapEntry->accTypes & Accessible::eTableCellAccessible)) {
-        if (aContext->IsOfType(Accessible::eTableRowAccessible) &&
+      if ((roleMapEntry->accTypes & eTableCell)) {
+        if (aContext->IsTableRow() &&
             (frame->AccessibleType() != eHTMLTableCellType ||
              aContext->GetContent() != content->GetParent())) {
           newAcc = new ARIAGridCellAccessibleWrap(content, document);
         }
 
-      } else if ((roleMapEntry->accTypes & Accessible::eTableAccessible) &&
+      } else if ((roleMapEntry->accTypes & eTable) &&
                  frame->AccessibleType() != eHTMLTableType) {
         newAcc = new ARIAGridAccessibleWrap(content, document);
       }
     }
 
     if (!newAcc) {
       // Prefer to use markup (mostly tag name, perhaps attributes) to decide if
       // and what kind of accessible to create.
@@ -819,31 +819,29 @@ nsAccessibilityService::GetOrCreateAcces
       if (!newAcc)
         newAcc = CreateAccessibleByFrameType(frame, content, aContext);
 
       // If table has strong ARIA role then all table descendants shouldn't
       // expose their native roles.
       if (!roleMapEntry && newAcc) {
         if (frame->AccessibleType() == eHTMLTableRowType) {
           nsRoleMapEntry* contextRoleMap = aContext->ARIARoleMap();
-          if (contextRoleMap &&
-              !(contextRoleMap->accTypes & Accessible::eTableAccessible))
+          if (contextRoleMap && !(contextRoleMap->accTypes & eTable))
             roleMapEntry = &nsARIAMap::gEmptyRoleMap;
 
         } else if (frame->AccessibleType() == eHTMLTableCellType &&
                    aContext->ARIARoleMap() == &nsARIAMap::gEmptyRoleMap) {
           roleMapEntry = &nsARIAMap::gEmptyRoleMap;
 
         } else if (content->Tag() == nsGkAtoms::dt ||
                    content->Tag() == nsGkAtoms::li ||
                    content->Tag() == nsGkAtoms::dd ||
                    frame->AccessibleType() == eHTMLLiType) {
           nsRoleMapEntry* contextRoleMap = aContext->ARIARoleMap();
-          if (contextRoleMap &&
-              !(contextRoleMap->accTypes & Accessible::eListAccessible))
+          if (contextRoleMap && !(contextRoleMap->accTypes & eList))
             roleMapEntry = &nsARIAMap::gEmptyRoleMap;
         }
       }
     }
   }
 
   if (!newAcc) {
     // Elements may implement nsIAccessibleProvider via XBL. This allows them to
@@ -1171,17 +1169,17 @@ nsAccessibilityService::CreateAccessible
 }
 
 already_AddRefed<Accessible>
 nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
                                                      nsIContent* aContent,
                                                      Accessible* aContext)
 {
   DocAccessible* document = aContext->Document();
-  if (aContext->IsOfType(Accessible::eTableRowAccessible)) {
+  if (aContext->IsTableRow()) {
     if (nsCoreUtils::IsHTMLTableHeader(aContent) &&
         aContext->GetContent() == aContent->GetParent()) {
       Accessible* accessible = new HTMLTableHeaderCellAccessibleWrap(aContent,
                                                                      document);
       NS_ADDREF(accessible);
       return accessible;
     }
 
@@ -1239,17 +1237,17 @@ nsAccessibilityService::CreateHTMLAccess
       return accessible;
     }
 
     Accessible* accessible = new HTMLLinkAccessible(aContent, document);
     NS_ADDREF(accessible);
     return accessible;
   }
 
-  if (aContext->IsOfType(Accessible::eListAccessible)) {
+  if (aContext->IsList()) {
     // If list item is a child of accessible list then create an accessible for
     // it unconditionally by tag name. nsBlockFrame creates the list item
     // accessible for other elements styled as list items.
     if (aContext->GetContent() == aContent->GetParent()) {
       if (tag == nsGkAtoms::dt || tag == nsGkAtoms::li) {
         Accessible* accessible = new HTMLLIAccessible(aContent, document);
         NS_ADDREF(accessible);
         return accessible;
@@ -1313,17 +1311,17 @@ nsAccessibilityService::CreateAccessible
       break;
     case eHTMLButtonType:
       newAcc = new HTMLButtonAccessible(aContent, document);
       break;
     case eHTMLCanvasType:
       newAcc = new HTMLCanvasAccessible(aContent, document);
       break;
     case eHTMLCaptionType:
-      if (aContext->IsOfType(Accessible::eTableAccessible) &&
+      if (aContext->IsTable() &&
           aContext->GetContent() == aContent->GetParent()) {
         newAcc = new HTMLCaptionAccessible(aContent, document);
       }
       break;
     case eHTMLCheckboxType:
       newAcc = new HTMLCheckboxAccessible(aContent, document);
       break;
     case eHTMLComboboxType:
@@ -1340,17 +1338,17 @@ nsAccessibilityService::CreateAccessible
       break;
     case eHTMLImageMapType:
       newAcc = new HTMLImageMapAccessible(aContent, document);
       break;
     case eHTMLLabelType:
       newAcc = new HTMLLabelAccessible(aContent, document);
       break;
     case eHTMLLiType:
-      if (aContext->IsOfType(Accessible::eListAccessible) &&
+      if (aContext->IsList() &&
           aContext->GetContent() == aContent->GetParent()) {
         newAcc = new HTMLLIAccessible(aContent, document);
       }
       break;
     case eHTMLSelectListType:
       newAcc = new HTMLSelectListAccessible(aContent, document);
       break;
     case eHTMLMediaType:
@@ -1359,24 +1357,24 @@ nsAccessibilityService::CreateAccessible
     case eHTMLRadioButtonType:
       newAcc = new HTMLRadioButtonAccessible(aContent, document);
       break;
     case eHTMLTableType:
       newAcc = new HTMLTableAccessibleWrap(aContent, document);
       break;
     case eHTMLTableCellType:
       // Accessible HTML table cell must be a child of accessible HTML table row.
-      if (aContext->IsOfType(Accessible::eHTMLTableRowAccessible))
+      if (aContext->IsHTMLTableRow())
         newAcc = new HTMLTableCellAccessibleWrap(aContent, document);
       break;
 
     case eHTMLTableRowType: {
       // Accessible HTML table row must be a child of tbody/tfoot/thead of
       // accessible HTML table or must be a child of accessible of HTML table.
-      if (aContext->IsOfType(Accessible::eTableAccessible)) {
+      if (aContext->IsTable()) {
         nsIContent* parentContent = aContent->GetParent();
         nsIFrame* parentFrame = parentContent->GetPrimaryFrame();
         if (parentFrame->GetType() == nsGkAtoms::tableRowGroupFrame) {
           parentContent = parentContent->GetParent();
           parentFrame = parentContent->GetPrimaryFrame();
         }
 
         if (parentFrame->GetType() == nsGkAtoms::tableOuterFrame &&
@@ -1395,17 +1393,17 @@ nsAccessibilityService::CreateAccessible
       break;
 
     case eImageType:
       newAcc = new ImageAccessibleWrap(aContent, document);
       break;
     case eOuterDocType:
       newAcc = new OuterDocAccessible(aContent, document);
       break;
-    case ePlugin: {
+    case ePluginType: {
       nsObjectFrame* objectFrame = do_QueryFrame(aFrame);
       newAcc = CreatePluginAccessible(objectFrame, aContent, aContext);
       break;
     }
     case eTextLeafType:
       newAcc = new TextLeafAccessibleWrap(aContent, document);
       break;
   }
--- a/accessible/src/generic/Accessible-inl.h
+++ b/accessible/src/generic/Accessible-inl.h
@@ -31,17 +31,17 @@ Accessible::ARIARole()
   return ARIATransformRole(mRoleMapEntry->role);
 }
 
 inline void
 Accessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
 {
   mRoleMapEntry = aRoleMapEntry;
   if (mRoleMapEntry)
-    mFlags |= mRoleMapEntry->accTypes;
+    mGenericTypes |= mRoleMapEntry->accTypes;
 }
 
 inline bool
 Accessible::HasNumericValue() const
 {
   if (mStateFlags & eHasNumericValue)
     return true;
 
--- a/accessible/src/generic/Accessible.cpp
+++ b/accessible/src/generic/Accessible.cpp
@@ -68,16 +68,17 @@
 #include "nsAttrName.h"
 #include "nsNetUtil.h"
 #include "nsEventStates.h"
 
 #ifdef DEBUG
 #include "nsIDOMCharacterData.h"
 #endif
 
+#include "mozilla/Assertions.h"
 #include "mozilla/unused.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/Element.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 
@@ -141,17 +142,18 @@ Accessible::QueryInterface(REFNSIID aIID
   }
 
   return nsAccessNodeWrap::QueryInterface(aIID, aInstancePtr);
 }
 
 Accessible::Accessible(nsIContent* aContent, DocAccessible* aDoc) :
   nsAccessNodeWrap(aContent, aDoc),
   mParent(nullptr), mIndexInParent(-1), mChildrenFlags(eChildrenUninitialized),
-  mStateFlags(0), mFlags(0), mIndexOfEmbeddedChild(-1), mRoleMapEntry(nullptr)
+  mStateFlags(0), mType(0), mGenericTypes(0), mIndexOfEmbeddedChild(-1),
+  mRoleMapEntry(nullptr)
 {
 #ifdef NS_DEBUG_X
    {
      nsCOMPtr<nsIPresShell> shell(do_QueryReferent(aShell));
      printf(">>> %p Created Acc - DOM: %p  PS: %p", 
             (void*)static_cast<nsIAccessible*>(this), (void*)aNode,
             (void*)shell.get());
     nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
@@ -3170,16 +3172,29 @@ Accessible::GetLevelInternal()
     } else {
       ++ level; // level is 1-index based
     }
   }
 
   return level;
 }
 
+void
+Accessible::StaticAsserts() const
+{
+  MOZ_STATIC_ASSERT(eLastChildrenFlag <= (2 << kChildrenFlagsBits) - 1,
+                    "Accessible::mChildrenFlags was oversized by eLastChildrenFlag!");
+  MOZ_STATIC_ASSERT(eLastStateFlag <= (2 << kStateFlagsBits) - 1,
+                    "Accessible::mStateFlags was oversized by eLastStateFlag!");
+  MOZ_STATIC_ASSERT(eLastAccType <= (2 << kTypeBits) - 1,
+                    "Accessible::mType was oversized by eLastAccType!");
+  MOZ_STATIC_ASSERT(eLastAccGenericType <= (2 << kGenericTypesBits) - 1,
+                    "Accessible::mGenericType was oversized by eLastAccGenericType!");
+}
+
 
 ////////////////////////////////////////////////////////////////////////////////
 // KeyBinding class
 
 void
 KeyBinding::ToPlatformFormat(nsAString& aValue) const
 {
   nsCOMPtr<nsIStringBundle> keyStringBundle;
--- a/accessible/src/generic/Accessible.h
+++ b/accessible/src/generic/Accessible.h
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef _Accessible_H_
 #define _Accessible_H_
 
+#include "mozilla/a11y/AccTypes.h"
 #include "mozilla/a11y/Role.h"
 #include "mozilla/a11y/States.h"
 #include "nsAccessNodeWrap.h"
 
 #include "nsIAccessible.h"
 #include "nsIAccessibleHyperLink.h"
 #include "nsIAccessibleSelectable.h"
 #include "nsIAccessibleValue.h"
@@ -460,63 +461,73 @@ public:
   // Downcasting and types
 
   inline bool IsAbbreviation() const
   {
     return mContent->IsHTML() &&
       (mContent->Tag() == nsGkAtoms::abbr || mContent->Tag() == nsGkAtoms::acronym);
   }
 
-  inline bool IsApplication() const { return mFlags & eApplicationAccessible; }
+  bool IsApplication() const { return mType == eApplicationType; }
 
-  bool IsAutoComplete() const { return mFlags & eAutoCompleteAccessible; }
+  bool IsAutoComplete() const { return mGenericTypes & eAutoComplete; }
 
-  inline bool IsAutoCompletePopup() const { return mFlags & eAutoCompletePopupAccessible; }
+  bool IsAutoCompletePopup() const
+    { return mGenericTypes & eAutoCompletePopup; }
 
-  inline bool IsCombobox() const { return mFlags & eComboboxAccessible; }
+  bool IsCombobox() const { return mGenericTypes & eCombobox; }
 
-  inline bool IsDoc() const { return mFlags & eDocAccessible; }
+  bool IsDoc() const { return mGenericTypes & eDocument; }
   DocAccessible* AsDoc();
 
-  inline bool IsHyperText() const { return mFlags & eHyperTextAccessible; }
+  bool IsHyperText() const { return mGenericTypes & eHyperText; }
   HyperTextAccessible* AsHyperText();
 
-  inline bool IsHTMLFileInput() const { return mFlags & eHTMLFileInputAccessible; }
+  bool IsHTMLFileInput() const { return mType == eHTMLFileInputType; }
+
+  bool IsHTMLListItem() const { return mType == eHTMLLiType; }
+  HTMLLIAccessible* AsHTMLListItem();
 
-  inline bool IsHTMLListItem() const { return mFlags & eHTMLListItemAccessible; }
-  mozilla::a11y::HTMLLIAccessible* AsHTMLListItem();
+  bool IsHTMLTableRow() const { return mType == eHTMLTableRowType; }
 
-  inline bool IsImage() const { return mFlags & eImageAccessible; }
-  mozilla::a11y::ImageAccessible* AsImage();
+  bool IsImage() const { return mType == eImageType; }
+  ImageAccessible* AsImage();
 
-  bool IsImageMapAccessible() const { return mFlags & eImageMapAccessible; }
-  mozilla::a11y::HTMLImageMapAccessible* AsImageMap();
+  bool IsImageMap() const { return mType == eImageMapType; }
+  HTMLImageMapAccessible* AsImageMap();
+
+  bool IsList() const { return mGenericTypes & eList; }
 
-  inline bool IsXULTree() const { return mFlags & eXULTreeAccessible; }
-  mozilla::a11y::XULTreeAccessible* AsXULTree();
+  bool IsListControl() const { return mGenericTypes & eListControl; }
 
-  inline bool IsXULDeck() const { return mFlags & eXULDeckAccessible; }
+  bool IsMenuButton() const { return mGenericTypes & eMenuButton; }
+
+  bool IsMenuPopup() const { return mType == eMenuPopupType; }
 
-  inline bool IsListControl() const { return mFlags & eListControlAccessible; }
+  bool IsProgress() const { return mType == eProgressType; }
 
-  inline bool IsMenuButton() const { return mFlags & eMenuButtonAccessible; }
+  bool IsRoot() const { return mType == eRootType; }
+  a11y::RootAccessible* AsRoot();
 
-  inline bool IsMenuPopup() const { return mFlags & eMenuPopupAccessible; }
+  bool IsSelect() const { return mGenericTypes & eSelect; }
 
-  inline bool IsProgress() const { return mFlags & eProgressAccessible; }
+  bool IsTable() const { return mGenericTypes & eTable; }
+  virtual TableAccessible* AsTable() { return nullptr; }
 
-  inline bool IsRoot() const { return mFlags & eRootAccessible; }
-  mozilla::a11y::RootAccessible* AsRoot();
+  virtual TableCellAccessible* AsTableCell() { return nullptr; }
 
-  virtual mozilla::a11y::TableAccessible* AsTable() { return nullptr; }
+  bool IsTableRow() const { return mGenericTypes & eTableRow; }
 
-  virtual mozilla::a11y::TableCellAccessible* AsTableCell() { return nullptr; }
+  bool IsTextLeaf() const { return mType == eTextLeafType; }
+  TextLeafAccessible* AsTextLeaf();
 
-  inline bool IsTextLeaf() const { return mFlags & eTextLeafAccessible; }
-  mozilla::a11y::TextLeafAccessible* AsTextLeaf();
+  bool IsXULDeck() const { return mType == eXULDeckType; }
+
+  bool IsXULTree() const { return mType == eXULTreeType; }
+  XULTreeAccessible* AsXULTree();
 
   //////////////////////////////////////////////////////////////////////////////
   // ActionAccessible
 
   /**
    * Return the number of actions that can be performed on this accessible.
    */
   virtual uint8_t ActionCount();
@@ -583,22 +594,16 @@ public:
    * Returns an anchor URI at the given index.
    */
   virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
 
   //////////////////////////////////////////////////////////////////////////////
   // SelectAccessible
 
   /**
-   * Return true if the accessible is a select control containing selectable
-   * items.
-   */
-  bool IsSelect() const { return mFlags & eSelectAccessible; }
-
-  /**
    * Return an array of selected items.
    */
   virtual already_AddRefed<nsIArray> SelectedItems();
 
   /**
    * Return the number of selected items.
    */
   virtual uint32_t SelectedItemCount();
@@ -693,21 +698,16 @@ public:
 
   /**
    * Return true if the accessible has associated DOM content.
    */
   bool HasOwnContent() const
     { return mContent && !(mStateFlags & eSharedNode); }
 
   /**
-   * Return true if accessible is of given type.
-   */
-  bool IsOfType(uint32_t aType) const { return mFlags & aType; }
-
-  /**
   * Return true if the accessible has a numeric value.
   */
   bool HasNumericValue() const;
 
 protected:
 
   /**
    * Return the accessible name provided by native markup. It doesn't take
@@ -742,17 +742,19 @@ protected:
                                          nsresult *aError = nullptr) const;
 
   /**
    * Flags used to describe the state and type of children.
    */
   enum ChildrenFlags {
     eChildrenUninitialized = 0, // children aren't initialized
     eMixedChildren = 1 << 0, // text leaf children are presented
-    eEmbeddedChildren = 1 << 1 // all children are embedded objects
+    eEmbeddedChildren = 1 << 1, // all children are embedded objects
+
+    eLastChildrenFlag = eEmbeddedChildren
   };
 
   /**
    * Return true if the children flag is set.
    */
   bool IsChildrenFlag(ChildrenFlags aFlag) const
     { return static_cast<ChildrenFlags>(mChildrenFlags) == aFlag; }
 
@@ -765,49 +767,19 @@ protected:
    * Flags used to describe the state of this accessible.
    * @note keep these flags in sync with ChildrenFlags
    */
   enum StateFlags {
     eIsDefunct = 1 << 0, // accessible is defunct
     eIsNotInDocument = 1 << 1, // accessible is not in document
     eSharedNode = 1 << 2, // accessible shares DOM node from another accessible
     eNotNodeMapEntry = 1 << 3, // accessible shouldn't be in document node map
-    eHasNumericValue = 1 << 4 // accessible has a numeric value
-  };
+    eHasNumericValue = 1 << 4, // accessible has a numeric value
 
-public: // XXX: a small hack to make these visible for nsARIAMap
-  /**
-   * Flags describing the type of this accessible.
-   * @note keep these flags in sync with ChildrenFlags and StateFlags
-   */
-  enum AccessibleTypes {
-    eApplicationAccessible = 1 << 0,
-    eAutoCompleteAccessible = 1 << 1,
-    eAutoCompletePopupAccessible = 1 << 2,
-    eComboboxAccessible = 1 << 3,
-    eDocAccessible = 1 << 4,
-    eHyperTextAccessible = 1 << 5,
-    eHTMLFileInputAccessible = 1 << 6,
-    eHTMLListItemAccessible = 1 << 7,
-    eHTMLTableRowAccessible = 1 << 8,
-    eImageAccessible = 1 << 9,
-    eImageMapAccessible = 1 << 10,
-    eListAccessible = 1 << 11,
-    eListControlAccessible = 1 << 12,
-    eMenuButtonAccessible = 1 << 13,
-    eMenuPopupAccessible = 1 << 14,
-    eProgressAccessible = 1 << 15,
-    eRootAccessible = 1 << 16,
-    eSelectAccessible = 1 << 17,
-    eTableAccessible = 1 << 18,
-    eTableCellAccessible = 1 << 19,
-    eTableRowAccessible = 1 << 20,
-    eTextLeafAccessible = 1 << 21,
-    eXULDeckAccessible = 1 << 22,
-    eXULTreeAccessible = 1 << 23
+    eLastStateFlag = eHasNumericValue
   };
 
 protected:
 
   //////////////////////////////////////////////////////////////////////////////
   // Miscellaneous helpers
 
   /**
@@ -904,22 +876,30 @@ protected:
    */
   virtual nsresult FirePlatformEvent(AccEvent* aEvent) = 0;
 
   // Data Members
   nsRefPtr<Accessible> mParent;
   nsTArray<nsRefPtr<Accessible> > mChildren;
   int32_t mIndexInParent;
 
+  static const uint8_t kChildrenFlagsBits = 2;
+  static const uint8_t kStateFlagsBits = 5;
+  static const uint8_t kTypeBits = 5;
+  static const uint8_t kGenericTypesBits = 12;
+
   /**
-   * Keep in sync with ChildrenFlags, StateFlags and AccessibleTypes.
+   * Keep in sync with ChildrenFlags, StateFlags and AccTypes.
    */
-  uint32_t mChildrenFlags : 2;
-  uint32_t mStateFlags : 5;
-  uint32_t mFlags : 25;
+  uint32_t mChildrenFlags : kChildrenFlagsBits;
+  uint32_t mStateFlags : kStateFlagsBits;
+  uint32_t mType : kTypeBits;
+  uint32_t mGenericTypes : kGenericTypesBits;
+
+  void StaticAsserts() const;
 
   friend class DocAccessible;
 
   nsAutoPtr<mozilla::a11y::EmbeddedObjCollector> mEmbeddedObjCollector;
   int32_t mIndexOfEmbeddedChild;
   friend class EmbeddedObjCollector;
 
   nsAutoPtr<AccGroupInfo> mGroupInfo;
--- a/accessible/src/generic/ApplicationAccessible.cpp
+++ b/accessible/src/generic/ApplicationAccessible.cpp
@@ -21,17 +21,17 @@
 #include "mozilla/Services.h"
 #include "nsIStringBundle.h"
 
 using namespace mozilla::a11y;
 
 ApplicationAccessible::ApplicationAccessible() :
   AccessibleWrap(nullptr, nullptr)
 {
-  mFlags |= eApplicationAccessible;
+  mType = eApplicationType;
   mAppInfo = do_GetService("@mozilla.org/xre/app-info;1");
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsISupports
 
 NS_IMPL_ISUPPORTS_INHERITED1(ApplicationAccessible, Accessible,
                              nsIAccessibleApplication)
--- a/accessible/src/generic/DocAccessible.cpp
+++ b/accessible/src/generic/DocAccessible.cpp
@@ -74,30 +74,30 @@ DocAccessible::
   DocAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
                   nsIPresShell* aPresShell) :
   HyperTextAccessibleWrap(aRootContent, this),
   mDocumentNode(aDocument), mScrollPositionChangedTicks(0),
   mLoadState(eTreeConstructionPending), mLoadEventType(0),
   mVirtualCursor(nullptr),
   mPresShell(aPresShell)
 {
-  mFlags |= eDocAccessible;
+  mGenericTypes |= eDocument;
   mStateFlags |= eNotNodeMapEntry;
 
   MOZ_ASSERT(mPresShell, "should have been given a pres shell");
   mPresShell->SetDocAccessible(this);
 
   mDependentIDsHash.Init();
   // XXX aaronl should we use an algorithm for the initial cache size?
   mAccessibleCache.Init(kDefaultCacheSize);
   mNodeToAccessibleMap.Init(kDefaultCacheSize);
 
   // If this is a XUL Document, it should not implement nsHyperText
   if (mDocumentNode && mDocumentNode->IsXUL())
-    mFlags &= ~eHyperTextAccessible;
+    mGenericTypes &= ~eHyperText;
 
   // For GTK+ native window, we do nothing here.
   if (!mDocumentNode)
     return;
 
   // DocManager creates document accessible when scrollable frame is
   // available already, it should be safe time to add scroll listener.
   AddScrollListener();
--- a/accessible/src/generic/DocAccessible.h
+++ b/accessible/src/generic/DocAccessible.h
@@ -569,16 +569,15 @@ protected:
 private:
 
   nsIPresShell* mPresShell;
 };
 
 inline DocAccessible*
 Accessible::AsDoc()
 {
-  return mFlags & eDocAccessible ?
-    static_cast<DocAccessible*>(this) : nullptr;
+  return IsDoc() ? static_cast<DocAccessible*>(this) : nullptr;
 }
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/src/generic/FormControlAccessible.h
+++ b/accessible/src/generic/FormControlAccessible.h
@@ -17,17 +17,17 @@ namespace a11y {
 template<int Max>
 class ProgressMeterAccessible : public LeafAccessible
 {
 public:
   ProgressMeterAccessible(nsIContent* aContent, DocAccessible* aDoc) :
     LeafAccessible(aContent, aDoc)
   {
     mStateFlags |= eHasNumericValue;
-    mFlags |= eProgressAccessible;
+    mType = eProgressType;
   }
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLEVALUE
 
   // Accessible
   virtual void Value(nsString& aValue);
   virtual mozilla::a11y::role NativeRole();
--- a/accessible/src/generic/HyperTextAccessible.cpp
+++ b/accessible/src/generic/HyperTextAccessible.cpp
@@ -36,17 +36,17 @@ using namespace mozilla::a11y;
 ////////////////////////////////////////////////////////////////////////////////
 // HyperTextAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HyperTextAccessible::
   HyperTextAccessible(nsIContent* aNode, DocAccessible* aDoc) :
   AccessibleWrap(aNode, aDoc)
 {
-  mFlags |= eHyperTextAccessible;
+  mGenericTypes |= eHyperText;
 }
 
 NS_IMPL_ADDREF_INHERITED(HyperTextAccessible, AccessibleWrap)
 NS_IMPL_RELEASE_INHERITED(HyperTextAccessible, AccessibleWrap)
 
 nsresult
 HyperTextAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
 {
--- a/accessible/src/generic/HyperTextAccessible.h
+++ b/accessible/src/generic/HyperTextAccessible.h
@@ -395,17 +395,16 @@ private:
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcasting method
 
 inline HyperTextAccessible*
 Accessible::AsHyperText()
 {
-  return mFlags & eHyperTextAccessible ?
-    static_cast<HyperTextAccessible*>(this) : nullptr;
+  return IsHyperText() ? static_cast<HyperTextAccessible*>(this) : nullptr;
 }
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
 
--- a/accessible/src/generic/ImageAccessible.cpp
+++ b/accessible/src/generic/ImageAccessible.cpp
@@ -26,17 +26,17 @@ using namespace mozilla::a11y;
 ////////////////////////////////////////////////////////////////////////////////
 // ImageAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 ImageAccessible::
   ImageAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   LinkableAccessible(aContent, aDoc)
 {
-  mFlags |= eImageAccessible;
+  mType = eImageType;
 }
 
 NS_IMPL_ISUPPORTS_INHERITED1(ImageAccessible, Accessible,
                              nsIAccessibleImage)
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible public
 
--- a/accessible/src/generic/RootAccessible.cpp
+++ b/accessible/src/generic/RootAccessible.cpp
@@ -56,17 +56,17 @@ NS_IMPL_ISUPPORTS_INHERITED1(RootAccessi
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor/destructor
 
 RootAccessible::
   RootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
                  nsIPresShell* aPresShell) :
   DocAccessibleWrap(aDocument, aRootContent, aPresShell)
 {
-  mFlags |= eRootAccessible;
+  mType = eRootType;
 }
 
 RootAccessible::~RootAccessible()
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible
--- a/accessible/src/generic/RootAccessible.h
+++ b/accessible/src/generic/RootAccessible.h
@@ -80,16 +80,15 @@ protected:
 #endif
 
     nsRefPtr<nsCaretAccessible> mCaretAccessible;
 };
 
 inline RootAccessible*
 Accessible::AsRoot()
 {
-  return mFlags & eRootAccessible ?
-    static_cast<mozilla::a11y::RootAccessible*>(this) : nullptr;
+  return IsRoot() ? static_cast<mozilla::a11y::RootAccessible*>(this) : nullptr;
 }
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/src/generic/TextLeafAccessible.cpp
+++ b/accessible/src/generic/TextLeafAccessible.cpp
@@ -14,17 +14,17 @@ using namespace mozilla::a11y;
 ////////////////////////////////////////////////////////////////////////////////
 // TextLeafAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 TextLeafAccessible::
   TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   LinkableAccessible(aContent, aDoc)
 {
-  mFlags |= eTextLeafAccessible;
+  mType = eTextLeafType;
 }
 
 TextLeafAccessible::~TextLeafAccessible()
 {
 }
 
 role
 TextLeafAccessible::NativeRole()
--- a/accessible/src/generic/TextLeafAccessible.h
+++ b/accessible/src/generic/TextLeafAccessible.h
@@ -40,17 +40,16 @@ protected:
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcast method
 
 inline TextLeafAccessible*
 Accessible::AsTextLeaf()
 {
-  return mFlags & eTextLeafAccessible ?
-    static_cast<TextLeafAccessible*>(this) : nullptr;
+  return IsTextLeaf() ? static_cast<TextLeafAccessible*>(this) : nullptr;
 }
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
 
--- a/accessible/src/html/HTMLFormControlAccessible.cpp
+++ b/accessible/src/html/HTMLFormControlAccessible.cpp
@@ -527,17 +527,17 @@ HTMLTextFieldAccessible::ContainerWidget
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLFileInputAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLFileInputAccessible::
 HTMLFileInputAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   HyperTextAccessibleWrap(aContent, aDoc)
 {
-  mFlags |= eHTMLFileInputAccessible;
+  mType = eHTMLFileInputType;
 }
 
 role
 HTMLFileInputAccessible::NativeRole()
 {
   // JAWS wants a text container, others don't mind. No specific role in
   // AT APIs.
   return roles::TEXT_CONTAINER;
--- a/accessible/src/html/HTMLImageMapAccessible.cpp
+++ b/accessible/src/html/HTMLImageMapAccessible.cpp
@@ -23,17 +23,17 @@ using namespace mozilla::a11y;
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLImageMapAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLImageMapAccessible::
   HTMLImageMapAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   ImageAccessibleWrap(aContent, aDoc)
 {
-  mFlags |= eImageMapAccessible;
+  mType = eImageMapType;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLImageMapAccessible: nsISupports
 
 NS_IMPL_ISUPPORTS_INHERITED0(HTMLImageMapAccessible, ImageAccessible)
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/accessible/src/html/HTMLImageMapAccessible.h
+++ b/accessible/src/html/HTMLImageMapAccessible.h
@@ -71,16 +71,15 @@ protected:
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcasting method
 
 inline HTMLImageMapAccessible*
 Accessible::AsImageMap()
 {
-  return IsImageMapAccessible() ?
-    static_cast<HTMLImageMapAccessible*>(this) : nullptr;
+  return IsImageMap() ? static_cast<HTMLImageMapAccessible*>(this) : nullptr;
 }
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/src/html/HTMLListAccessible.cpp
+++ b/accessible/src/html/HTMLListAccessible.cpp
@@ -41,17 +41,17 @@ HTMLListAccessible::NativeState()
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLLIAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLLIAccessible::
   HTMLLIAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   HyperTextAccessibleWrap(aContent, aDoc), mBullet(nullptr)
 {
-  mFlags |= eHTMLListItemAccessible;
+  mType = eHTMLLiType;
 
   nsBlockFrame* blockFrame = do_QueryFrame(GetFrame());
   if (blockFrame && blockFrame->HasBullet()) {
     mBullet = new HTMLListBulletAccessible(mContent, mDoc);
     if (!Document()->BindToDocument(mBullet, nullptr))
       mBullet = nullptr;
   }
 }
--- a/accessible/src/html/HTMLListAccessible.h
+++ b/accessible/src/html/HTMLListAccessible.h
@@ -17,17 +17,17 @@ class HTMLListBulletAccessible;
 
 /**
  * Used for HTML list (like HTML ul).
  */
 class HTMLListAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLListAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-    HyperTextAccessibleWrap(aContent, aDoc) { mFlags |= eListAccessible; }
+    HyperTextAccessibleWrap(aContent, aDoc) { mGenericTypes |= eList; }
   virtual ~HTMLListAccessible() { }
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
   virtual a11y::role NativeRole();
   virtual uint64_t NativeState();
@@ -95,16 +95,15 @@ public:
    */
   bool IsInside() const;
 };
 
 
 inline HTMLLIAccessible*
 Accessible::AsHTMLListItem()
 {
-  return mFlags & eHTMLListItemAccessible ?
-    static_cast<HTMLLIAccessible*>(this) : nullptr;
+  return IsHTMLListItem() ? static_cast<HTMLLIAccessible*>(this) : nullptr;
 }
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/src/html/HTMLSelectAccessible.cpp
+++ b/accessible/src/html/HTMLSelectAccessible.cpp
@@ -26,17 +26,17 @@ using namespace mozilla::a11y;
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLSelectListAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLSelectListAccessible::
   HTMLSelectListAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   AccessibleWrap(aContent, aDoc)
 {
-  mFlags |= eSelectAccessible | eListControlAccessible;
+  mGenericTypes |= eListControl | eSelect;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLSelectListAccessible: Accessible public
 
 uint64_t
 HTMLSelectListAccessible::NativeState()
 {
@@ -392,17 +392,17 @@ HTMLSelectOptGroupAccessible::CacheChild
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLComboboxAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLComboboxAccessible::
   HTMLComboboxAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   AccessibleWrap(aContent, aDoc)
 {
-  mFlags |= eComboboxAccessible;
+  mGenericTypes |= eCombobox;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLComboboxAccessible: Accessible
 
 role
 HTMLComboboxAccessible::NativeRole()
 {
--- a/accessible/src/html/HTMLTableAccessible.cpp
+++ b/accessible/src/html/HTMLTableAccessible.cpp
@@ -342,17 +342,17 @@ HTMLTableRowAccessible::NativeRole()
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLTableAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLTableAccessible::
   HTMLTableAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   AccessibleWrap(aContent, aDoc), xpcAccessibleTable(this)
 {
-  mFlags |= eTableAccessible;
+  mGenericTypes |= eTable;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLTableAccessible: nsISupports implementation
 
 NS_IMPL_ISUPPORTS_INHERITED1(HTMLTableAccessible, Accessible,
                              nsIAccessibleTable)
 
--- a/accessible/src/html/HTMLTableAccessible.h
+++ b/accessible/src/html/HTMLTableAccessible.h
@@ -88,17 +88,20 @@ public:
 /**
  * HTML table row accessible (html:tr).
  */
 class HTMLTableRowAccessible : public AccessibleWrap
 {
 public:
   HTMLTableRowAccessible(nsIContent* aContent, DocAccessible* aDoc) :
     AccessibleWrap(aContent, aDoc)
-    { mFlags |= eTableRowAccessible | eHTMLTableRowAccessible; }
+  {
+    mType = eHTMLTableRowType;
+    mGenericTypes |= eTableRow;
+  }
   virtual ~HTMLTableRowAccessible() { }
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
   virtual a11y::role NativeRole();
 };
 
--- a/accessible/src/xul/XULColorPickerAccessible.cpp
+++ b/accessible/src/xul/XULColorPickerAccessible.cpp
@@ -83,17 +83,17 @@ XULColorPickerTileAccessible::ContainerW
 ////////////////////////////////////////////////////////////////////////////////
 // XULColorPickerAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 XULColorPickerAccessible::
   XULColorPickerAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   XULColorPickerTileAccessible(aContent, aDoc)
 {
-  mFlags |= eMenuButtonAccessible;
+  mGenericTypes |= eMenuButton;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULColorPickerAccessible: Accessible
 
 uint64_t
 XULColorPickerAccessible::NativeState()
 {
--- a/accessible/src/xul/XULComboboxAccessible.cpp
+++ b/accessible/src/xul/XULComboboxAccessible.cpp
@@ -23,19 +23,19 @@ using namespace mozilla::a11y;
 ////////////////////////////////////////////////////////////////////////////////
 
 XULComboboxAccessible::
   XULComboboxAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   AccessibleWrap(aContent, aDoc)
 {
   if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                             nsGkAtoms::autocomplete, eIgnoreCase))
-    mFlags |= eAutoCompleteAccessible;
+    mGenericTypes |= eAutoComplete;
   else
-    mFlags |= eComboboxAccessible;
+    mGenericTypes |= eCombobox;
 }
 
 role
 XULComboboxAccessible::NativeRole()
 {
   return IsAutoComplete() ? roles::AUTOCOMPLETE : roles::COMBOBOX;
 }
 
--- a/accessible/src/xul/XULFormControlAccessible.cpp
+++ b/accessible/src/xul/XULFormControlAccessible.cpp
@@ -35,17 +35,17 @@ using namespace mozilla::a11y;
 // XULButtonAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 XULButtonAccessible::
   XULButtonAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   AccessibleWrap(aContent, aDoc)
 {
   if (ContainsMenu())
-    mFlags |= eMenuButtonAccessible;
+    mGenericTypes |= eMenuButton;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULButtonAccessible: nsISupports
 
 NS_IMPL_ISUPPORTS_INHERITED0(XULButtonAccessible, Accessible)
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/accessible/src/xul/XULListboxAccessible.cpp
+++ b/accessible/src/xul/XULListboxAccessible.cpp
@@ -103,17 +103,17 @@ XULListboxAccessible::
   XULListboxAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   XULSelectControlAccessible(aContent, aDoc), xpcAccessibleTable(this)
 {
   nsIContent* parentContent = mContent->GetParent();
   if (parentContent) {
     nsCOMPtr<nsIAutoCompletePopup> autoCompletePopupElm =
       do_QueryInterface(parentContent);
     if (autoCompletePopupElm)
-      mFlags |= eAutoCompletePopupAccessible;
+      mGenericTypes |= eAutoCompletePopup;
   }
 }
 
 NS_IMPL_ADDREF_INHERITED(XULListboxAccessible, XULSelectControlAccessible)
 NS_IMPL_RELEASE_INHERITED(XULListboxAccessible, XULSelectControlAccessible)
 
 nsresult
 XULListboxAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
--- a/accessible/src/xul/XULMenuAccessible.cpp
+++ b/accessible/src/xul/XULMenuAccessible.cpp
@@ -431,22 +431,22 @@ XULMenuSeparatorAccessible::ActionCount(
 ////////////////////////////////////////////////////////////////////////////////
 
 XULMenupopupAccessible::
   XULMenupopupAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   XULSelectControlAccessible(aContent, aDoc)
 {
   nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetFrame());
   if (menuPopupFrame && menuPopupFrame->IsMenu())
-    mFlags |= eMenuPopupAccessible;
+    mType = eMenuPopupType;
 
   // May be the anonymous <menupopup> inside <menulist> (a combobox)
   mSelectControl = do_QueryInterface(mContent->GetParent());
   if (!mSelectControl)
-    mFlags &= ~eSelectAccessible;
+    mGenericTypes &= ~eSelect;
 }
 
 uint64_t
 XULMenupopupAccessible::NativeState()
 {
   uint64_t state = Accessible::NativeState();
 
 #ifdef DEBUG
--- a/accessible/src/xul/XULSelectControlAccessible.cpp
+++ b/accessible/src/xul/XULSelectControlAccessible.cpp
@@ -26,17 +26,17 @@ using namespace mozilla::a11y;
 ////////////////////////////////////////////////////////////////////////////////
 // XULSelectControlAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 XULSelectControlAccessible::
   XULSelectControlAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   AccessibleWrap(aContent, aDoc)
 {
-  mFlags |= eSelectAccessible;
+  mGenericTypes |= eSelect;
   mSelectControl = do_QueryInterface(aContent);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULSelectControlAccessible: nsAccessNode
 
 void
 XULSelectControlAccessible::Shutdown()
--- a/accessible/src/xul/XULTabAccessible.h
+++ b/accessible/src/xul/XULTabAccessible.h
@@ -62,17 +62,17 @@ protected:
 /**
  * A container of tab panels, xul:tabpanels element.
  */
 class XULDeckAccessible : public AccessibleWrap
 {
 public:
   XULDeckAccessible(nsIContent* aContent, DocAccessible* aDoc) :
     AccessibleWrap(aContent, aDoc)
-    { mFlags |= eXULDeckAccessible; }
+    { mType = eXULDeckType; }
 
   // Accessible
   virtual a11y::role NativeRole();
 };
 
 
 /**
  * A tabpanel object, child elements of xul:tabpanels element. Note,the object
--- a/accessible/src/xul/XULTreeAccessible.cpp
+++ b/accessible/src/xul/XULTreeAccessible.cpp
@@ -32,33 +32,34 @@ using namespace mozilla::a11y;
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 XULTreeAccessible::
   XULTreeAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   AccessibleWrap(aContent, aDoc)
 {
-  mFlags |= eSelectAccessible | eXULTreeAccessible;
+  mType = eXULTreeType;
+  mGenericTypes |= eSelect;
 
   mTree = nsCoreUtils::GetTreeBoxObject(aContent);
   NS_ASSERTION(mTree, "Can't get mTree!\n");
 
   if (mTree) {
     nsCOMPtr<nsITreeView> treeView;
     mTree->GetView(getter_AddRefs(treeView));
     mTreeView = treeView;
   }
 
   nsIContent* parentContent = mContent->GetParent();
   if (parentContent) {
     nsCOMPtr<nsIAutoCompletePopup> autoCompletePopupElm =
       do_QueryInterface(parentContent);
     if (autoCompletePopupElm)
-      mFlags |= eAutoCompletePopupAccessible;
+      mGenericTypes |= eAutoCompletePopup;
   }
 
   mAccessibleCache.Init(kDefaultTreeCacheSize);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeAccessible: nsISupports and cycle collection implementation
 
--- a/accessible/src/xul/XULTreeGridAccessible.cpp
+++ b/accessible/src/xul/XULTreeGridAccessible.cpp
@@ -23,17 +23,17 @@ using namespace mozilla::a11y;
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeGridAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 XULTreeGridAccessible::
   XULTreeGridAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   XULTreeAccessible(aContent, aDoc), xpcAccessibleTable(this)
 {
-  mFlags |= eTableAccessible;
+  mGenericTypes |= eTable;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeGridAccessible: nsISupports implementation
 
 NS_IMPL_ISUPPORTS_INHERITED1(XULTreeGridAccessible,
                              XULTreeAccessible,
                              nsIAccessibleTable)
@@ -275,17 +275,17 @@ XULTreeGridAccessible::CreateTreeItemAcc
 ////////////////////////////////////////////////////////////////////////////////
 
 XULTreeGridRowAccessible::
   XULTreeGridRowAccessible(nsIContent* aContent, DocAccessible* aDoc,
                            Accessible* aTreeAcc, nsITreeBoxObject* aTree,
                            nsITreeView* aTreeView, int32_t aRow) :
   XULTreeItemAccessibleBase(aContent, aDoc, aTreeAcc, aTree, aTreeView, aRow)
 {
-  mFlags |= eTableRowAccessible;
+  mGenericTypes |= eTableRow;
 
   mAccessibleCache.Init(kDefaultTreeCacheSize);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeGridRowAccessible: nsISupports and cycle collection implementation
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED_1(XULTreeGridRowAccessible,
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -270,17 +270,17 @@ NS_QUERYFRAME_HEAD(nsObjectFrame)
   NS_QUERYFRAME_ENTRY(nsObjectFrame)
   NS_QUERYFRAME_ENTRY(nsIObjectFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsObjectFrameSuper)
 
 #ifdef ACCESSIBILITY
 a11y::AccType
 nsObjectFrame::AccessibleType()
 {
-  return a11y::ePlugin;
+  return a11y::ePluginType;
 }
 
 #ifdef XP_WIN
 NS_IMETHODIMP nsObjectFrame::GetPluginPort(HWND *aPort)
 {
   *aPort = (HWND) mInstanceOwner->GetPluginPortFromWidget();
   return NS_OK;
 }