Bug 1442800 - Let New_Accessible take Element instead of nsIContent r=surkov
authorTimothy Guan-tin Chien <timdream@gmail.com>
Tue, 06 Mar 2018 13:47:43 -0800
changeset 414094 46caf0a4faa8d8c01cac0161af502ec2e2f60ba6
parent 414093 4eb369e8ad7884a3dd20fe3145f7ad58c42db450
child 414095 d9f589a760631ef61885b4846c6f5479fb5addc2
push id33858
push userncsoregi@mozilla.com
push dateTue, 17 Apr 2018 21:55:44 +0000
treeherdermozilla-central@d6eb5597d744 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1442800
milestone61.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 1442800 - Let New_Accessible take Element instead of nsIContent r=surkov The passed nsIContent is always an Element. MozReview-Commit-ID: IMvWuK6MIra
accessible/base/XULMap.h
accessible/base/nsAccessibilityService.cpp
accessible/base/nsAccessibilityService.h
--- a/accessible/base/XULMap.h
+++ b/accessible/base/XULMap.h
@@ -39,158 +39,148 @@ XULMAP_TYPE(treecol, XULColumnItemAccess
 XULMAP_TYPE(treecolpicker, XULButtonAccessible)
 XULMAP_TYPE(treecols, XULTreeColumAccessible)
 XULMAP_TYPE(toolbar, XULToolbarAccessible)
 XULMAP_TYPE(toolbarbutton, XULToolbarButtonAccessible)
 XULMAP_TYPE(tooltip, XULTooltipAccessible)
 
 XULMAP(
   colorpicker,
-  [](nsIContent* aContent, Accessible* aContext) -> Accessible* {
-    if (aContent->IsElement() &&
-        aContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
-                                           nsGkAtoms::button, eIgnoreCase)) {
-      return new XULColorPickerAccessible(aContent, aContext->Document());
+  [](Element* aElement, Accessible* aContext) -> Accessible* {
+    if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
+                              nsGkAtoms::button, eIgnoreCase)) {
+      return new XULColorPickerAccessible(aElement, aContext->Document());
     }
     return nullptr;
   }
 )
 
 XULMAP(
   label,
-  [](nsIContent* aContent, Accessible* aContext) -> Accessible* {
-    if (aContent->IsElement() &&
-        aContent->AsElement()->ClassList()->Contains(NS_LITERAL_STRING("text-link"))) {
-      return new XULLinkAccessible(aContent, aContext->Document());
+  [](Element* aElement, Accessible* aContext) -> Accessible* {
+    if (aElement->ClassList()->Contains(NS_LITERAL_STRING("text-link"))) {
+      return new XULLinkAccessible(aElement, aContext->Document());
     }
-    return new XULLabelAccessible(aContent, aContext->Document());
+    return new XULLabelAccessible(aElement, aContext->Document());
   }
 )
 
 XULMAP(
   image,
-  [](nsIContent* aContent, Accessible* aContext) -> Accessible* {
-    if (!aContent->IsElement()) {
+  [](Element* aElement, Accessible* aContext) -> Accessible* {
+    if (aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::onclick)) {
+      return new XULToolbarButtonAccessible(aElement, aContext->Document());
+    }
+
+    if (aElement->ClassList()->Contains(NS_LITERAL_STRING("colorpickertile"))) {
+      return new XULColorPickerTileAccessible(aElement, aContext->Document());
+    }
+
+    // Don't include nameless images in accessible tree.
+    if (!aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext)) {
       return nullptr;
     }
 
-    if (aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::onclick)) {
-      return new XULToolbarButtonAccessible(aContent, aContext->Document());
-    }
-
-    if (aContent->AsElement()->ClassList()->Contains(NS_LITERAL_STRING("colorpickertile"))) {
-      return new XULColorPickerTileAccessible(aContent, aContext->Document());
-    }
-
-    // Don't include nameless images in accessible tree.
-    if (!aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext)) {
-      return nullptr;
-    }
-
-    return new ImageAccessibleWrap(aContent, aContext->Document());
+    return new ImageAccessibleWrap(aElement, aContext->Document());
   }
 )
 
 XULMAP(
   listcell,
-  [](nsIContent* aContent, Accessible* aContext) -> Accessible* {
+  [](Element* aElement, Accessible* aContext) -> Accessible* {
     // Only create cells if there's more than one per row.
-    nsIContent* listItem = aContent->GetParent();
+    nsIContent* listItem = aElement->GetParent();
     if (!listItem) {
       return nullptr;
     }
 
     for (nsIContent* child = listItem->GetFirstChild(); child;
          child = child->GetNextSibling()) {
-      if (child->IsXULElement(nsGkAtoms::listcell) && child != aContent) {
-        return new XULListCellAccessibleWrap(aContent, aContext->Document());
+      if (child->IsXULElement(nsGkAtoms::listcell) && child != aElement) {
+        return new XULListCellAccessibleWrap(aElement, aContext->Document());
       }
     }
 
     return nullptr;
   }
 )
 
 XULMAP(
   menupopup,
-  [](nsIContent* aContent, Accessible* aContext) {
-    return CreateMenupopupAccessible(aContent, aContext);
+  [](Element* aElement, Accessible* aContext) {
+    return CreateMenupopupAccessible(aElement, aContext);
   }
 )
 
 XULMAP(
   panel,
-  [](nsIContent* aContent, Accessible* aContext) -> Accessible* {
+  [](Element* aElement, Accessible* aContext) -> Accessible* {
     static const Element::AttrValuesArray sIgnoreTypeVals[] =
       { &nsGkAtoms::autocomplete_richlistbox, &nsGkAtoms::autocomplete, nullptr };
 
-    if (!aContent->IsElement() ||
-        aContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type,
-                                               sIgnoreTypeVals, eIgnoreCase) >= 0) {
+    if (aElement->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type,
+                                  sIgnoreTypeVals, eIgnoreCase) >= 0) {
       return nullptr;
     }
 
-    if (aContent->AsElement()->AttrValueIs(kNameSpaceID_None,
-                                           nsGkAtoms::noautofocus,
-                                           nsGkAtoms::_true, eCaseMatters)) {
-      return new XULAlertAccessible(aContent, aContext->Document());
+    if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::noautofocus,
+                              nsGkAtoms::_true, eCaseMatters)) {
+      return new XULAlertAccessible(aElement, aContext->Document());
     }
 
-    return new EnumRoleAccessible<roles::PANE>(aContent, aContext->Document());
+    return new EnumRoleAccessible<roles::PANE>(aElement, aContext->Document());
   }
 )
 
 XULMAP(
   popup,
-  [](nsIContent* aContent, Accessible* aContext) {
-    return CreateMenupopupAccessible(aContent, aContext);
+  [](Element* aElement, Accessible* aContext) {
+    return CreateMenupopupAccessible(aElement, aContext);
   }
 )
 
 XULMAP(
   textbox,
-  [](nsIContent* aContent, Accessible* aContext) -> Accessible* {
-    if (aContent->IsElement() &&
-        aContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
-                                           nsGkAtoms::autocomplete, eIgnoreCase)) {
-      return new XULComboboxAccessible(aContent, aContext->Document());
+  [](Element* aElement, Accessible* aContext) -> Accessible* {
+    if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
+                              nsGkAtoms::autocomplete, eIgnoreCase)) {
+      return new XULComboboxAccessible(aElement, aContext->Document());
     }
 
-    return new EnumRoleAccessible<roles::SECTION>(aContent, aContext->Document());
+    return new EnumRoleAccessible<roles::SECTION>(aElement, aContext->Document());
   }
 )
 
 XULMAP(
   thumb,
-  [](nsIContent* aContent, Accessible* aContext) -> Accessible* {
-    if (aContent->IsElement() &&
-        aContent->AsElement()->ClassList()->Contains(NS_LITERAL_STRING("scale-thumb"))) {
-      return new XULThumbAccessible(aContent, aContext->Document());
+  [](Element* aElement, Accessible* aContext) -> Accessible* {
+    if (aElement->ClassList()->Contains(NS_LITERAL_STRING("scale-thumb"))) {
+      return new XULThumbAccessible(aElement, aContext->Document());
     }
     return nullptr;
   }
 )
 
 XULMAP(
   tree,
-  [](nsIContent* aContent, Accessible* aContext) -> Accessible* {
-    nsIContent* child = nsTreeUtils::GetDescendantChild(aContent,
+  [](Element* aElement, Accessible* aContext) -> Accessible* {
+    nsIContent* child = nsTreeUtils::GetDescendantChild(aElement,
                                                         nsGkAtoms::treechildren);
     if (!child)
       return nullptr;
 
     nsTreeBodyFrame* treeFrame = do_QueryFrame(child->GetPrimaryFrame());
     if (!treeFrame)
       return nullptr;
 
     RefPtr<nsTreeColumns> treeCols = treeFrame->Columns();
     int32_t count = 0;
     treeCols->GetCount(&count);
 
     // Outline of list accessible.
     if (count == 1) {
-      return new XULTreeAccessible(aContent, aContext->Document(), treeFrame);
+      return new XULTreeAccessible(aElement, aContext->Document(), treeFrame);
     }
 
     // Table or tree table accessible.
-    return new XULTreeGridAccessibleWrap(aContent, aContext->Document(), treeFrame);
+    return new XULTreeGridAccessibleWrap(aElement, aContext->Document(), treeFrame);
   }
 )
--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -144,159 +144,153 @@ MustBeAccessible(nsIContent* aContent, D
   return false;
 }
 
 /**
  * Used by XULMap.h to map both menupopup and popup elements
  */
 #ifdef MOZ_XUL
 Accessible*
-CreateMenupopupAccessible(nsIContent* aContent, Accessible* aContext)
+CreateMenupopupAccessible(Element* aElement, Accessible* aContext)
 {
 #ifdef MOZ_ACCESSIBILITY_ATK
     // ATK considers this node to be redundant when within menubars, and it makes menu
     // navigation with assistive technologies more difficult
     // XXX In the future we will should this for consistency across the nsIAccessible
     // implementations on each platform for a consistent scripting environment, but
     // then strip out redundant accessibles in the AccessibleWrap class for each platform.
-    nsIContent *parent = aContent->GetParent();
+    nsIContent *parent = aElement->GetParent();
     if (parent && parent->IsXULElement(nsGkAtoms::menu))
       return nullptr;
 #endif
 
-    return new XULMenupopupAccessible(aContent, aContext->Document());
+    return new XULMenupopupAccessible(aElement, aContext->Document());
 }
 #endif
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible constructors
 
 static Accessible*
-New_HTMLLink(nsIContent* aContent, Accessible* aContext)
+New_HTMLLink(Element* aElement, Accessible* aContext)
 {
   // Only some roles truly enjoy life as HTMLLinkAccessibles, for details
   // see closed bug 494807.
-  const nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aContent->AsElement());
+  const nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aElement);
   if (roleMapEntry && roleMapEntry->role != roles::NOTHING &&
       roleMapEntry->role != roles::LINK) {
-    return new HyperTextAccessibleWrap(aContent, aContext->Document());
+    return new HyperTextAccessibleWrap(aElement, aContext->Document());
   }
 
-  return new HTMLLinkAccessible(aContent, aContext->Document());
+  return new HTMLLinkAccessible(aElement, aContext->Document());
 }
 
-static Accessible* New_HyperText(nsIContent* aContent, Accessible* aContext)
-  { return new HyperTextAccessibleWrap(aContent, aContext->Document()); }
+static Accessible* New_HyperText(Element* aElement, Accessible* aContext)
+  { return new HyperTextAccessibleWrap(aElement, aContext->Document()); }
 
-static Accessible* New_HTMLFigcaption(nsIContent* aContent, Accessible* aContext)
-  { return new HTMLFigcaptionAccessible(aContent, aContext->Document()); }
+static Accessible* New_HTMLFigcaption(Element* aElement, Accessible* aContext)
+  { return new HTMLFigcaptionAccessible(aElement, aContext->Document()); }
 
-static Accessible* New_HTMLFigure(nsIContent* aContent, Accessible* aContext)
-  { return new HTMLFigureAccessible(aContent, aContext->Document()); }
+static Accessible* New_HTMLFigure(Element* aElement, Accessible* aContext)
+  { return new HTMLFigureAccessible(aElement, aContext->Document()); }
 
-static Accessible* New_HTMLHeaderOrFooter(nsIContent* aContent, Accessible* aContext)
-  { return new HTMLHeaderOrFooterAccessible(aContent, aContext->Document()); }
+static Accessible* New_HTMLHeaderOrFooter(Element* aElement, Accessible* aContext)
+  { return new HTMLHeaderOrFooterAccessible(aElement, aContext->Document()); }
 
-static Accessible* New_HTMLLegend(nsIContent* aContent, Accessible* aContext)
-  { return new HTMLLegendAccessible(aContent, aContext->Document()); }
+static Accessible* New_HTMLLegend(Element* aElement, Accessible* aContext)
+  { return new HTMLLegendAccessible(aElement, aContext->Document()); }
 
-static Accessible* New_HTMLOption(nsIContent* aContent, Accessible* aContext)
-  { return new HTMLSelectOptionAccessible(aContent, aContext->Document()); }
+static Accessible* New_HTMLOption(Element* aElement, Accessible* aContext)
+  { return new HTMLSelectOptionAccessible(aElement, aContext->Document()); }
 
-static Accessible* New_HTMLOptgroup(nsIContent* aContent, Accessible* aContext)
-  { return new HTMLSelectOptGroupAccessible(aContent, aContext->Document()); }
+static Accessible* New_HTMLOptgroup(Element* aElement, Accessible* aContext)
+  { return new HTMLSelectOptGroupAccessible(aElement, aContext->Document()); }
 
-static Accessible* New_HTMLList(nsIContent* aContent, Accessible* aContext)
-  { return new HTMLListAccessible(aContent, aContext->Document()); }
+static Accessible* New_HTMLList(Element* aElement, Accessible* aContext)
+  { return new HTMLListAccessible(aElement, aContext->Document()); }
 
 static Accessible*
-New_HTMLListitem(nsIContent* aContent, Accessible* aContext)
+New_HTMLListitem(Element* aElement, Accessible* aContext)
 {
   // 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->IsList() && aContext->GetContent() == aContent->GetParent())
-    return new HTMLLIAccessible(aContent, aContext->Document());
+  if (aContext->IsList() && aContext->GetContent() == aElement->GetParent())
+    return new HTMLLIAccessible(aElement, aContext->Document());
 
   return nullptr;
 }
 
 static Accessible*
-New_HTMLDefinition(nsIContent* aContent, Accessible* aContext)
+New_HTMLDefinition(Element* aElement, Accessible* aContext)
 {
   if (aContext->IsList())
-    return new HyperTextAccessibleWrap(aContent, aContext->Document());
+    return new HyperTextAccessibleWrap(aElement, aContext->Document());
   return nullptr;
 }
 
-static Accessible* New_HTMLLabel(nsIContent* aContent, Accessible* aContext)
-  { return new HTMLLabelAccessible(aContent, aContext->Document()); }
+static Accessible* New_HTMLLabel(Element* aElement, Accessible* aContext)
+  { return new HTMLLabelAccessible(aElement, aContext->Document()); }
 
-static Accessible* New_HTMLInput(nsIContent* aContent, Accessible* aContext)
+static Accessible* New_HTMLInput(Element* aElement, Accessible* aContext)
 {
-  if (!aContent->IsElement()) {
-    return nullptr;
-  }
-
-  Element* element = aContent->AsElement();
-  if (element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
+  if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                            nsGkAtoms::checkbox, eIgnoreCase)) {
-    return new HTMLCheckboxAccessible(aContent, aContext->Document());
+    return new HTMLCheckboxAccessible(aElement, aContext->Document());
   }
-  if (element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
+  if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                            nsGkAtoms::radio, eIgnoreCase)) {
-    return new HTMLRadioButtonAccessible(aContent, aContext->Document());
+    return new HTMLRadioButtonAccessible(aElement, aContext->Document());
   }
-  if (element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
+  if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                            nsGkAtoms::time, eIgnoreCase)) {
-    return new EnumRoleAccessible<roles::GROUPING>(aContent, aContext->Document());
+    return new EnumRoleAccessible<roles::GROUPING>(aElement, aContext->Document());
   }
-  if (element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
+  if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                            nsGkAtoms::date, eIgnoreCase)) {
-    return new EnumRoleAccessible<roles::DATE_EDITOR>(aContent, aContext->Document());
+    return new EnumRoleAccessible<roles::DATE_EDITOR>(aElement, aContext->Document());
   }
   return nullptr;
 }
 
-static Accessible* New_HTMLOutput(nsIContent* aContent, Accessible* aContext)
-  { return new HTMLOutputAccessible(aContent, aContext->Document()); }
+static Accessible* New_HTMLOutput(Element* aElement, Accessible* aContext)
+  { return new HTMLOutputAccessible(aElement, aContext->Document()); }
 
-static Accessible* New_HTMLProgress(nsIContent* aContent, Accessible* aContext)
-  { return new HTMLProgressMeterAccessible(aContent, aContext->Document()); }
+static Accessible* New_HTMLProgress(Element* aElement, Accessible* aContext)
+  { return new HTMLProgressMeterAccessible(aElement, aContext->Document()); }
 
-static Accessible* New_HTMLSummary(nsIContent* aContent, Accessible* aContext)
-  { return new HTMLSummaryAccessible(aContent, aContext->Document()); }
+static Accessible* New_HTMLSummary(Element* aElement, Accessible* aContext)
+  { return new HTMLSummaryAccessible(aElement, aContext->Document()); }
 
 static Accessible*
-New_HTMLTableAccessible(nsIContent* aContent, Accessible* aContext)
-  { return new HTMLTableAccessible(aContent, aContext->Document()); }
+New_HTMLTableAccessible(Element* aElement, Accessible* aContext)
+  { return new HTMLTableAccessible(aElement, aContext->Document()); }
 
 static Accessible*
-New_HTMLTableRowAccessible(nsIContent* aContent, Accessible* aContext)
-  { return new HTMLTableRowAccessible(aContent, aContext->Document()); }
+New_HTMLTableRowAccessible(Element* aElement, Accessible* aContext)
+  { return new HTMLTableRowAccessible(aElement, aContext->Document()); }
 
 static Accessible*
-New_HTMLTableCellAccessible(nsIContent* aContent, Accessible* aContext)
-  { return new HTMLTableCellAccessible(aContent, aContext->Document()); }
+New_HTMLTableCellAccessible(Element* aElement, Accessible* aContext)
+  { return new HTMLTableCellAccessible(aElement, aContext->Document()); }
 
 static Accessible*
-New_HTMLTableHeaderCell(nsIContent* aContent, Accessible* aContext)
+New_HTMLTableHeaderCell(Element* aElement, Accessible* aContext)
 {
-  if (aContext->IsTableRow() && aContext->GetContent() == aContent->GetParent())
-    return new HTMLTableHeaderCellAccessibleWrap(aContent, aContext->Document());
+  if (aContext->IsTableRow() && aContext->GetContent() == aElement->GetParent())
+    return new HTMLTableHeaderCellAccessibleWrap(aElement, aContext->Document());
   return nullptr;
 }
 
 static Accessible*
-New_HTMLTableHeaderCellIfScope(nsIContent* aContent, Accessible* aContext)
+New_HTMLTableHeaderCellIfScope(Element* aElement, Accessible* aContext)
 {
-  if (aContext->IsTableRow() && aContext->GetContent() == aContent->GetParent() &&
-      aContent->IsElement() &&
-      aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::scope))
-    return new HTMLTableHeaderCellAccessibleWrap(aContent, aContext->Document());
+  if (aContext->IsTableRow() && aContext->GetContent() == aElement->GetParent() &&
+      aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::scope))
+    return new HTMLTableHeaderCellAccessibleWrap(aElement, aContext->Document());
   return nullptr;
 }
 
 /**
  * Cached value of the PREF_ACCESSIBILITY_FORCE_DISABLED preference.
  */
 static int32_t sPlatformDisabledState = 0;
 
@@ -323,18 +317,18 @@ static const HTMLMarkupMapInfo sHTMLMark
 
 #ifdef MOZ_XUL
 #define XULMAP(atom, ...) \
   { &nsGkAtoms::atom, __VA_ARGS__ },
 
 #define XULMAP_TYPE(atom, new_type) \
 XULMAP( \
   atom, \
-  [](nsIContent* aContent, Accessible* aContext) -> Accessible* { \
-    return new new_type(aContent, aContext->Document()); \
+  [](Element* aElement, Accessible* aContext) -> Accessible* { \
+    return new new_type(aElement, aContext->Document()); \
   } \
 )
 
 static const XULMarkupMapInfo sXULMarkupMapList[] = {
   #include "XULMap.h"
 };
 
 #undef XULMAP_TYPE
@@ -1172,17 +1166,17 @@ nsAccessibilityService::CreateAccessible
     if (!isARIATablePart ||
         frame->AccessibleType() == eHTMLTableCellType ||
         frame->AccessibleType() == eHTMLTableRowType ||
         frame->AccessibleType() == eHTMLTableType) {
       // Prefer to use markup to decide if and what kind of accessible to create,
       const HTMLMarkupMapInfo* markupMap =
         mHTMLMarkupMap.Get(content->NodeInfo()->NameAtom());
       if (markupMap && markupMap->new_func)
-        newAcc = markupMap->new_func(content, aContext);
+        newAcc = markupMap->new_func(content->AsElement(), aContext);
 
       if (!newAcc) // try by frame accessible type.
         newAcc = CreateAccessibleByFrameType(frame, content, aContext);
     }
 
     // In case of ARIA grid or table use table-specific classes if it's not
     // native table based.
     if (isARIATablePart && (!newAcc || newAcc->IsGenericHyperText())) {
@@ -1235,17 +1229,17 @@ nsAccessibilityService::CreateAccessible
       }
     }
 
 #ifdef MOZ_XUL
     // Prefer to use XUL to decide if and what kind of accessible to create.
     const XULMarkupMapInfo* xulMap =
       mXULMarkupMap.Get(content->NodeInfo()->NameAtom());
     if (xulMap && xulMap->new_func) {
-      newAcc = xulMap->new_func(content, aContext);
+      newAcc = xulMap->new_func(content->AsElement(), aContext);
     }
 #endif
 
     // Any XUL box can be used as tabpanel, make sure we create a proper
     // accessible for it.
     if (!newAcc && aContext->IsXULTabpanels() &&
         content->GetParent() == aContext->GetContent()) {
       LayoutFrameType frameType = frame->Type();
@@ -1267,17 +1261,17 @@ nsAccessibilityService::CreateAccessible
       } else if (content->IsSVGElement(nsGkAtoms::svg)) {
         newAcc = new EnumRoleAccessible<roles::DIAGRAM>(content, document);
       }
 
     } else if (content->IsMathMLElement()) {
       const HTMLMarkupMapInfo* markupMap =
         mHTMLMarkupMap.Get(content->NodeInfo()->NameAtom());
       if (markupMap && markupMap->new_func)
-        newAcc = markupMap->new_func(content, aContext);
+        newAcc = markupMap->new_func(content->AsElement(), aContext);
 
       // Fall back to text when encountering Content MathML.
       if (!newAcc && !content->IsAnyOfMathMLElements(nsGkAtoms::annotation_,
                                                      nsGkAtoms::annotation_xml_,
                                                      nsGkAtoms::mpadded_,
                                                      nsGkAtoms::mphantom_,
                                                      nsGkAtoms::maligngroup_,
                                                      nsGkAtoms::malignmark_,
--- a/accessible/base/nsAccessibilityService.h
+++ b/accessible/base/nsAccessibilityService.h
@@ -46,17 +46,17 @@ FocusManager* FocusMgr();
 SelectionManager* SelectionMgr();
 
 /**
  * Returns the application accessible.
  */
 ApplicationAccessible* ApplicationAcc();
 xpcAccessibleApplication* XPCApplicationAcc();
 
-typedef Accessible* (New_Accessible)(nsIContent* aContent, Accessible* aContext);
+typedef Accessible* (New_Accessible)(Element* aElement, Accessible* aContext);
 
 struct MarkupAttrInfo {
   nsStaticAtom** name;
   nsStaticAtom** value;
 
   nsStaticAtom** DOMAttrName;
   nsStaticAtom** DOMAttrValue;
 };