@@ -272,33 +272,6 @@ New_HTMLTableHeaderCellIfScope(nsIContent* aContent, Accessible* aContext)
272272 return nullptr ;
273273}
274274
275- #ifdef MOZ_XUL
276- static Accessible*
277- New_MaybeImageOrToolbarButtonAccessible (nsIContent* aContent,
278- Accessible* aContext)
279- {
280- if (aContent->IsElement () &&
281- aContent->AsElement ()->HasAttr (kNameSpaceID_None , nsGkAtoms::onclick)) {
282- return new XULToolbarButtonAccessible (aContent, aContext->Document ());
283- }
284-
285- // Don't include nameless images in accessible tree.
286- if (!aContent->IsElement () ||
287- !aContent->AsElement ()->HasAttr (kNameSpaceID_None , nsGkAtoms::tooltiptext)) {
288- return nullptr ;
289- }
290-
291- return new ImageAccessibleWrap (aContent, aContext->Document ());
292- }
293- static Accessible*
294- New_MenuSeparator (nsIContent* aContent, Accessible* aContext)
295- { return new XULMenuSeparatorAccessible (aContent, aContext->Document ()); }
296-
297- static Accessible*
298- New_StatusBarAccessible (nsIContent* aContent, Accessible* aContext)
299- { return new XULStatusBarAccessible (aContent, aContext->Document ()); }
300- #endif
301-
302275/* *
303276 * Cached value of the PREF_ACCESSIBILITY_FORCE_DISABLED preference.
304277 */
@@ -319,26 +292,35 @@ static int32_t sPlatformDisabledState = 0;
319292#define MARKUPMAP (atom, new_func, r, ... ) \
320293 { &nsGkAtoms::atom, new_func, static_cast <a11y::role>(r), { __VA_ARGS__ } },
321294
322- static const MarkupMapInfo sMarkupMapList [] = {
295+ static const HTMLMarkupMapInfo sHTMLMarkupMapList [] = {
323296 #include " MarkupMap.h"
324297};
325298
299+ #undef MARKUPMAP
300+
326301#ifdef MOZ_XUL
327302#define XULMAP (atom, new_func ) \
328303 { &nsGkAtoms::atom, new_func },
329304
330- static const XULMarkupMapInfo sXULMapList [] = {
305+ #define XULMAP_TYPE (atom, new_type ) \
306+ XULMAP ( \
307+ atom, \
308+ [](nsIContent* aContent, Accessible* aContext) -> Accessible* { \
309+ return new new_type (aContent, aContext->Document ()); \
310+ } \
311+ )
312+
313+ static const XULMarkupMapInfo sXULMarkupMapList [] = {
331314 #include " XULMap.h"
332315};
316+
317+ #undef XULMAP_TYPE
318+ #undef XULMAP
333319#endif
334320
335321#undef Attr
336322#undef AttrFromDOM
337323#undef AttrFromDOMIf
338- #undef MARKUPMAP
339- #ifdef MOZ_XUL
340- #undef XULMAP
341- #endif
342324
343325// //////////////////////////////////////////////////////////////////////////////
344326// nsAccessibilityService
@@ -350,9 +332,9 @@ xpcAccessibleApplication* nsAccessibilityService::gXPCApplicationAccessible = nu
350332uint32_t nsAccessibilityService::gConsumers = 0 ;
351333
352334nsAccessibilityService::nsAccessibilityService () :
353- DocManager(), FocusManager(), mMarkupMaps (ArrayLength(sMarkupMapList ))
335+ DocManager(), FocusManager(), mHTMLMarkupMap (ArrayLength(sHTMLMarkupMapList ))
354336#ifdef MOZ_XUL
355- , mXULMarkupMaps (ArrayLength(sXULMapList ))
337+ , mXULMarkupMap (ArrayLength(sXULMarkupMapList ))
356338#endif
357339{
358340}
@@ -1170,8 +1152,8 @@ nsAccessibilityService::CreateAccessible(nsINode* aNode,
11701152 frame->AccessibleType () == eHTMLTableRowType ||
11711153 frame->AccessibleType () == eHTMLTableType) {
11721154 // Prefer to use markup to decide if and what kind of accessible to create,
1173- const MarkupMapInfo * markupMap =
1174- mMarkupMaps .Get (content->NodeInfo ()->NameAtom ());
1155+ const HTMLMarkupMapInfo * markupMap =
1156+ mHTMLMarkupMap .Get (content->NodeInfo ()->NameAtom ());
11751157 if (markupMap && markupMap->new_func )
11761158 newAcc = markupMap->new_func (content, aContext);
11771159
@@ -1234,7 +1216,7 @@ nsAccessibilityService::CreateAccessible(nsINode* aNode,
12341216#ifdef MOZ_XUL
12351217 // Prefer to use XUL to decide if and what kind of accessible to create.
12361218 const XULMarkupMapInfo* xulMap =
1237- mXULMarkupMaps .Get (content->NodeInfo ()->NameAtom ());
1219+ mXULMarkupMap .Get (content->NodeInfo ()->NameAtom ());
12381220 if (xulMap && xulMap->new_func ) {
12391221 newAcc = xulMap->new_func (content, aContext);
12401222 }
@@ -1271,8 +1253,8 @@ nsAccessibilityService::CreateAccessible(nsINode* aNode,
12711253 }
12721254
12731255 } else if (content->IsMathMLElement ()) {
1274- const MarkupMapInfo * markupMap =
1275- mMarkupMaps .Get (content->NodeInfo ()->NameAtom ());
1256+ const HTMLMarkupMapInfo * markupMap =
1257+ mHTMLMarkupMap .Get (content->NodeInfo ()->NameAtom ());
12761258 if (markupMap && markupMap->new_func )
12771259 newAcc = markupMap->new_func (content, aContext);
12781260
@@ -1350,12 +1332,12 @@ nsAccessibilityService::Init()
13501332
13511333 eventListenerService->AddListenerChangeListener (this );
13521334
1353- for (uint32_t i = 0 ; i < ArrayLength (sMarkupMapList ); i++)
1354- mMarkupMaps .Put (*sMarkupMapList [i].tag , &sMarkupMapList [i]);
1335+ for (uint32_t i = 0 ; i < ArrayLength (sHTMLMarkupMapList ); i++)
1336+ mHTMLMarkupMap .Put (*sHTMLMarkupMapList [i].tag , &sHTMLMarkupMapList [i]);
13551337
13561338#ifdef MOZ_XUL
1357- for (uint32_t i = 0 ; i < ArrayLength (sXULMapList ); i++)
1358- mXULMarkupMaps .Put (*sXULMapList [i].tag , &sXULMapList [i]);
1339+ for (uint32_t i = 0 ; i < ArrayLength (sXULMarkupMapList ); i++)
1340+ mXULMarkupMap .Put (*sXULMarkupMapList [i].tag , &sXULMarkupMapList [i]);
13591341#endif
13601342
13611343#ifdef A11Y_LOG
@@ -1765,8 +1747,8 @@ void
17651747nsAccessibilityService::MarkupAttributes (const nsIContent* aContent,
17661748 nsIPersistentProperties* aAttributes) const
17671749{
1768- const mozilla::a11y::MarkupMapInfo * markupMap =
1769- mMarkupMaps .Get (aContent->NodeInfo ()->NameAtom ());
1750+ const mozilla::a11y::HTMLMarkupMapInfo * markupMap =
1751+ mHTMLMarkupMap .Get (aContent->NodeInfo ()->NameAtom ());
17701752 if (!markupMap)
17711753 return ;
17721754
0 commit comments