Bug 1439778 - Move XBL accessibility role="xul:panel" into XULMap.h
MozReview-Commit-ID: LqdGEZqRTWA
--- a/accessible/base/XULMap.h
+++ b/accessible/base/XULMap.h
@@ -82,16 +82,38 @@ XULMAP(
XULMAP(
menupopup,
[](nsIContent* aContent, Accessible* aContext) {
return CreateMenupopupAccessible(aContent, aContext);
}
)
XULMAP(
+ panel,
+ [](nsIContent* aContent, 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) {
+ return nullptr;
+ }
+
+ if (aContent->AsElement()->AttrValueIs(kNameSpaceID_None,
+ nsGkAtoms::noautofocus,
+ nsGkAtoms::_true, eCaseMatters)) {
+ return new XULAlertAccessible(aContent, aContext->Document());
+ }
+
+ return new EnumRoleAccessible<roles::PANE>(aContent, aContext->Document());
+ }
+)
+
+XULMAP(
popup,
[](nsIContent* aContent, Accessible* aContext) {
return CreateMenupopupAccessible(aContent, aContext);
}
)
XULMAP(
textbox,
--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -317,18 +317,18 @@ static int32_t sPlatformDisabledState =
static const HTMLMarkupMapInfo sHTMLMarkupMapList[] = {
#include "MarkupMap.h"
};
#undef MARKUPMAP
#ifdef MOZ_XUL
-#define XULMAP(atom, new_func) \
- { &nsGkAtoms::atom, new_func },
+#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()); \
} \
)
@@ -1482,25 +1482,16 @@ nsAccessibilityService::CreateAccessible
accessible = new XULColorPickerAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:colorpickertile")) {
accessible = new XULColorPickerTileAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:link")) {
accessible = new XULLinkAccessible(aContent, aDoc);
- } else if (role.EqualsLiteral("xul:panel")) {
- if (aContent->IsElement() &&
- aContent->AsElement()->AttrValueIs(kNameSpaceID_None,
- nsGkAtoms::noautofocus,
- nsGkAtoms::_true, eCaseMatters))
- accessible = new XULAlertAccessible(aContent, aDoc);
- else
- accessible = new EnumRoleAccessible<roles::PANE>(aContent, aDoc);
-
} else if (role.EqualsLiteral("xul:text")) {
accessible = new XULLabelAccessible(aContent, aDoc);
}
#endif // MOZ_XUL
return accessible.forget();
}
--- a/accessible/xul/XULColorPickerAccessible.cpp
+++ b/accessible/xul/XULColorPickerAccessible.cpp
@@ -2,17 +2,16 @@
/* 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/. */
#include "XULColorPickerAccessible.h"
#include "Accessible-inl.h"
#include "nsAccUtils.h"
-#include "nsCoreUtils.h"
#include "DocAccessible.h"
#include "Role.h"
#include "States.h"
#include "nsIDOMElement.h"
#include "nsMenuPopupFrame.h"
using namespace mozilla::a11y;
@@ -130,15 +129,12 @@ XULColorPickerAccessible::AreItemsOperab
}
////////////////////////////////////////////////////////////////////////////////
// XULColorPickerAccessible: Accessible
bool
XULColorPickerAccessible::IsAcceptableChild(nsIContent* aEl) const
{
- nsAutoString role;
- nsCoreUtils::XBLBindingRole(aEl, role);
- return role.EqualsLiteral("xul:panel") &&
- aEl->IsElement() &&
+ return aEl->IsXULElement(nsGkAtoms::panel) &&
aEl->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::noautofocus,
nsGkAtoms::_true, eCaseMatters);
}
--- a/dom/base/nsGkAtomList.h
+++ b/dom/base/nsGkAtomList.h
@@ -150,16 +150,17 @@ GK_ATOM(assign, "assign")
GK_ATOM(async, "async")
GK_ATOM(attribute, "attribute")
GK_ATOM(attributes, "attributes")
GK_ATOM(attributeSet, "attribute-set")
GK_ATOM(aural, "aural")
GK_ATOM(_auto, "auto")
GK_ATOM(autocheck, "autocheck")
GK_ATOM(autocomplete, "autocomplete")
+GK_ATOM(autocomplete_richlistbox, "autocomplete-richlistbox")
GK_ATOM(autofocus, "autofocus")
GK_ATOM(autoplay, "autoplay")
GK_ATOM(autorepeatbutton, "autorepeatbutton")
GK_ATOM(axis, "axis")
GK_ATOM(b, "b")
GK_ATOM(background, "background")
GK_ATOM(base, "base")
GK_ATOM(basefont, "basefont")
--- a/toolkit/content/widgets/popup.xml
+++ b/toolkit/content/widgets/popup.xml
@@ -284,17 +284,17 @@
}
for (var i = 0; i < array.length; i++)
array[i].width = width;
]]>
</handler>
</handlers>
</binding>
- <binding id="panel" role="xul:panel"
+ <binding id="panel"
extends="chrome://global/content/bindings/popup.xml#popup-base">
<implementation>
<field name="_prevFocus">0</field>
<field name="_dragBindingAlive">true</field>
<constructor>
<![CDATA[
if (this.getAttribute("backdrag") == "true" && !this._draggableStarted) {
this._draggableStarted = true;