mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1134280 - Get rid of Tag() - patch 2.1 - /accessible - Fix all the occurrences, m=smaug, r=surkov
This commit is contained in:
parent
5a32f7fa5a
commit
431587e94f
@ -141,7 +141,7 @@ HTMLLabelIterator::Next()
|
||||
// element, or <label> ancestor which implicitly point to it.
|
||||
Accessible* label = nullptr;
|
||||
while ((label = mRelIter.Next())) {
|
||||
if (label->GetContent()->Tag() == nsGkAtoms::label)
|
||||
if (label->GetContent()->IsHTMLElement(nsGkAtoms::label))
|
||||
return label;
|
||||
}
|
||||
|
||||
@ -155,17 +155,15 @@ HTMLLabelIterator::Next()
|
||||
Accessible* walkUp = mAcc->Parent();
|
||||
while (walkUp && !walkUp->IsDoc()) {
|
||||
nsIContent* walkUpElm = walkUp->GetContent();
|
||||
if (walkUpElm->IsHTMLElement()) {
|
||||
if (walkUpElm->Tag() == nsGkAtoms::label &&
|
||||
!walkUpElm->HasAttr(kNameSpaceID_None, nsGkAtoms::_for)) {
|
||||
mLabelFilter = eSkipAncestorLabel; // prevent infinite loop
|
||||
return walkUp;
|
||||
}
|
||||
|
||||
if (walkUpElm->Tag() == nsGkAtoms::form)
|
||||
break;
|
||||
if (walkUpElm->IsHTMLElement(nsGkAtoms::label) &&
|
||||
!walkUpElm->HasAttr(kNameSpaceID_None, nsGkAtoms::_for)) {
|
||||
mLabelFilter = eSkipAncestorLabel; // prevent infinite loop
|
||||
return walkUp;
|
||||
}
|
||||
|
||||
if (walkUpElm->IsHTMLElement(nsGkAtoms::form))
|
||||
break;
|
||||
|
||||
walkUp = walkUp->Parent();
|
||||
}
|
||||
|
||||
@ -188,7 +186,7 @@ HTMLOutputIterator::Next()
|
||||
{
|
||||
Accessible* output = nullptr;
|
||||
while ((output = mRelIter.Next())) {
|
||||
if (output->GetContent()->Tag() == nsGkAtoms::output)
|
||||
if (output->GetContent()->IsHTMLElement(nsGkAtoms::output))
|
||||
return output;
|
||||
}
|
||||
|
||||
@ -211,7 +209,7 @@ XULLabelIterator::Next()
|
||||
{
|
||||
Accessible* label = nullptr;
|
||||
while ((label = mRelIter.Next())) {
|
||||
if (label->GetContent()->Tag() == nsGkAtoms::label)
|
||||
if (label->GetContent()->IsXULElement(nsGkAtoms::label))
|
||||
return label;
|
||||
}
|
||||
|
||||
@ -234,7 +232,7 @@ XULDescriptionIterator::Next()
|
||||
{
|
||||
Accessible* descr = nullptr;
|
||||
while ((descr = mRelIter.Next())) {
|
||||
if (descr->GetContent()->Tag() == nsGkAtoms::description)
|
||||
if (descr->GetContent()->IsXULElement(nsGkAtoms::description))
|
||||
return descr;
|
||||
}
|
||||
|
||||
|
@ -713,7 +713,7 @@ logging::Node(const char* aDescr, nsINode* aNode)
|
||||
dom::Element* elm = aNode->AsElement();
|
||||
|
||||
nsAutoCString tag;
|
||||
elm->Tag()->ToUTF8String(tag);
|
||||
elm->NodeInfo()->NameAtom()->ToUTF8String(tag);
|
||||
|
||||
nsIAtom* idAtom = elm->GetID();
|
||||
nsAutoCString id;
|
||||
|
@ -872,11 +872,10 @@ TextAttrsMgr::TextPosTextAttr::
|
||||
}
|
||||
|
||||
const nsIContent* content = aFrame->GetContent();
|
||||
if (content && content->IsHTMLElement()) {
|
||||
const nsIAtom* tagName = content->Tag();
|
||||
if (tagName == nsGkAtoms::sup)
|
||||
if (content) {
|
||||
if (content->IsHTMLElement(nsGkAtoms::sup))
|
||||
return eTextPosSuper;
|
||||
if (tagName == nsGkAtoms::sub)
|
||||
if (content->IsHTMLElement(nsGkAtoms::sub))
|
||||
return eTextPosSub;
|
||||
}
|
||||
|
||||
|
@ -893,8 +893,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
|
||||
#ifdef DEBUG
|
||||
nsImageFrame* imageFrame = do_QueryFrame(frame);
|
||||
NS_ASSERTION(imageFrame && content->IsHTMLElement() &&
|
||||
content->Tag() == nsGkAtoms::area,
|
||||
NS_ASSERTION(imageFrame && content->IsHTMLElement(nsGkAtoms::area),
|
||||
"Unknown case of not main content for the frame!");
|
||||
#endif
|
||||
return nullptr;
|
||||
@ -902,8 +901,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
|
||||
#ifdef DEBUG
|
||||
nsImageFrame* imageFrame = do_QueryFrame(frame);
|
||||
NS_ASSERTION(!imageFrame || !content->IsHTMLElement() ||
|
||||
content->Tag() != nsGkAtoms::area,
|
||||
NS_ASSERTION(!imageFrame || !content->IsHTMLElement(nsGkAtoms::area),
|
||||
"Image map manages the area accessible creation!");
|
||||
#endif
|
||||
|
||||
@ -933,8 +931,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
return newAcc;
|
||||
}
|
||||
|
||||
bool isHTML = content->IsHTMLElement();
|
||||
if (isHTML && content->Tag() == nsGkAtoms::map) {
|
||||
if (content->IsHTMLElement(nsGkAtoms::map)) {
|
||||
// Create hyper text accessible for HTML map if it is used to group links
|
||||
// (see http://www.w3.org/TR/WCAG10-HTML-TECHS/#group-bypass). If the HTML
|
||||
// map rect is empty then it is used for links grouping. Otherwise it should
|
||||
@ -973,7 +970,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
roleMapEntry = nullptr;
|
||||
}
|
||||
|
||||
if (!newAcc && isHTML) { // HTML accessibles
|
||||
if (!newAcc && content->IsHTMLElement()) { // HTML accessibles
|
||||
bool isARIATableOrCell = roleMapEntry &&
|
||||
(roleMapEntry->accTypes & (eTableCell | eTable));
|
||||
|
||||
@ -1011,9 +1008,9 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
aContext->ARIARoleMap() == &aria::gEmptyRoleMap) {
|
||||
roleMapEntry = &aria::gEmptyRoleMap;
|
||||
|
||||
} else if (content->Tag() == nsGkAtoms::dt ||
|
||||
content->Tag() == nsGkAtoms::li ||
|
||||
content->Tag() == nsGkAtoms::dd ||
|
||||
} else if (content->IsAnyOfHTMLElements(nsGkAtoms::dt,
|
||||
nsGkAtoms::li,
|
||||
nsGkAtoms::dd) ||
|
||||
frame->AccessibleType() == eHTMLLiType) {
|
||||
nsRoleMapEntry* contextRoleMap = aContext->ARIARoleMap();
|
||||
if (!contextRoleMap->IsOfType(eList))
|
||||
@ -1059,11 +1056,11 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
// polyline and image. A 'use' and 'text' graphic elements require
|
||||
// special support.
|
||||
newAcc = new EnumRoleAccessible(content, document, roles::GRAPHIC);
|
||||
} else if (content->Tag() == nsGkAtoms::svg) {
|
||||
} else if (content->IsSVGElement(nsGkAtoms::svg)) {
|
||||
newAcc = new EnumRoleAccessible(content, document, roles::DIAGRAM);
|
||||
}
|
||||
} else if (content->IsMathMLElement()) {
|
||||
if (content->Tag() == nsGkAtoms::math)
|
||||
if (content->IsMathMLElement(nsGkAtoms::math))
|
||||
newAcc = new EnumRoleAccessible(content, document, roles::EQUATION);
|
||||
else
|
||||
newAcc = new HyperTextAccessible(content, document);
|
||||
@ -1074,13 +1071,15 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
// of some property that makes this object interesting
|
||||
// We don't do this for <body>, <html>, <window>, <dialog> etc. which
|
||||
// correspond to the doc accessible and will be created in any case
|
||||
if (!newAcc && content->Tag() != nsGkAtoms::body && content->GetParent() &&
|
||||
if (!newAcc && !content->IsHTMLElement(nsGkAtoms::body) &&
|
||||
content->GetParent() &&
|
||||
(roleMapEntry || MustBeAccessible(content, document) ||
|
||||
(isHTML && nsCoreUtils::HasClickListener(content)))) {
|
||||
(content->IsHTMLElement() &&
|
||||
nsCoreUtils::HasClickListener(content)))) {
|
||||
// This content is focusable or has an interesting dynamic content accessibility property.
|
||||
// If it's interesting we need it in the accessibility hierarchy so that events or
|
||||
// other accessibles can point to it, or so that it can hold a state, etc.
|
||||
if (isHTML) {
|
||||
if (content->IsHTMLElement()) {
|
||||
// Interesting HTML container which may have selectable text and/or embedded objects
|
||||
newAcc = new HyperTextAccessibleWrap(content, document);
|
||||
} else { // XUL, SVG, MathML etc.
|
||||
@ -1298,7 +1297,7 @@ nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent,
|
||||
// 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();
|
||||
if (parent && parent->IsXULElement() && parent->Tag() == nsGkAtoms::menu)
|
||||
if (parent && parent->IsXULElement(nsGkAtoms::menu))
|
||||
return nullptr;
|
||||
#endif
|
||||
|
||||
@ -1392,45 +1391,45 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
|
||||
}
|
||||
|
||||
// This method assumes we're in an HTML namespace.
|
||||
nsIAtom* tag = aContent->Tag();
|
||||
if (tag == nsGkAtoms::figcaption) {
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::figcaption)) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLFigcaptionAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::figure) {
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::figure)) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLFigureAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::legend) {
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::legend)) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLLegendAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::option) {
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::option)) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLSelectOptionAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::optgroup) {
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::optgroup)) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLSelectOptGroupAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::ul || tag == nsGkAtoms::ol ||
|
||||
tag == nsGkAtoms::dl) {
|
||||
if (aContent->IsAnyOfHTMLElements(nsGkAtoms::ul,
|
||||
nsGkAtoms::ol,
|
||||
nsGkAtoms::dl)) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLListAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::a) {
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::a)) {
|
||||
// Only some roles truly enjoy life as HTMLLinkAccessibles, for details
|
||||
// see closed bug 494807.
|
||||
nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aContent);
|
||||
@ -1451,13 +1450,13 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
|
||||
// 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) {
|
||||
if (aContent->IsAnyOfHTMLElements(nsGkAtoms::dt, nsGkAtoms::li)) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLLIAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::dd) {
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::dd)) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HyperTextAccessibleWrap(aContent, document);
|
||||
return accessible.forget();
|
||||
@ -1467,42 +1466,42 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::abbr ||
|
||||
tag == nsGkAtoms::acronym ||
|
||||
tag == nsGkAtoms::article ||
|
||||
tag == nsGkAtoms::aside ||
|
||||
tag == nsGkAtoms::blockquote ||
|
||||
tag == nsGkAtoms::form ||
|
||||
tag == nsGkAtoms::footer ||
|
||||
tag == nsGkAtoms::header ||
|
||||
tag == nsGkAtoms::h1 ||
|
||||
tag == nsGkAtoms::h2 ||
|
||||
tag == nsGkAtoms::h3 ||
|
||||
tag == nsGkAtoms::h4 ||
|
||||
tag == nsGkAtoms::h5 ||
|
||||
tag == nsGkAtoms::h6 ||
|
||||
tag == nsGkAtoms::nav ||
|
||||
tag == nsGkAtoms::q ||
|
||||
tag == nsGkAtoms::section ||
|
||||
tag == nsGkAtoms::time) {
|
||||
if (aContent->IsAnyOfHTMLElements(nsGkAtoms::abbr,
|
||||
nsGkAtoms::acronym,
|
||||
nsGkAtoms::article,
|
||||
nsGkAtoms::aside,
|
||||
nsGkAtoms::blockquote,
|
||||
nsGkAtoms::form,
|
||||
nsGkAtoms::footer,
|
||||
nsGkAtoms::header,
|
||||
nsGkAtoms::h1,
|
||||
nsGkAtoms::h2,
|
||||
nsGkAtoms::h3,
|
||||
nsGkAtoms::h4,
|
||||
nsGkAtoms::h5,
|
||||
nsGkAtoms::h6,
|
||||
nsGkAtoms::nav,
|
||||
nsGkAtoms::q,
|
||||
nsGkAtoms::section,
|
||||
nsGkAtoms::time)) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HyperTextAccessibleWrap(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::label) {
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::label)) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLLabelAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::output) {
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::output)) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLOutputAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::progress) {
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::progress)) {
|
||||
nsRefPtr<Accessible> accessible =
|
||||
new HTMLProgressMeterAccessible(aContent, document);
|
||||
return accessible.forget();
|
||||
@ -1620,7 +1619,7 @@ nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
|
||||
newAcc = new HTMLTextFieldAccessible(aContent, document);
|
||||
break;
|
||||
case eHyperTextType:
|
||||
if (aContent->Tag() != nsGkAtoms::dt && aContent->Tag() != nsGkAtoms::dd)
|
||||
if (!aContent->IsAnyOfHTMLElements(nsGkAtoms::dt, nsGkAtoms::dd))
|
||||
newAcc = new HyperTextAccessibleWrap(aContent, document);
|
||||
break;
|
||||
|
||||
|
@ -354,8 +354,7 @@ Accessible::VisibilityState()
|
||||
nsIFrame* parentFrame = curFrame->GetParent();
|
||||
nsDeckFrame* deckFrame = do_QueryFrame(parentFrame);
|
||||
if (deckFrame && deckFrame->GetSelectedBox() != curFrame) {
|
||||
if (deckFrame->GetContent()->IsXULElement() &&
|
||||
deckFrame->GetContent()->Tag() == nsGkAtoms::tabpanels)
|
||||
if (deckFrame->GetContent()->IsXULElement(nsGkAtoms::tabpanels))
|
||||
return states::OFFSCREEN;
|
||||
|
||||
NS_NOTREACHED("Children of not selected deck panel are not accessible.");
|
||||
@ -820,7 +819,7 @@ Accessible::XULElmName(DocAccessible* aDocument,
|
||||
nsIContent* parent =
|
||||
bindingParent? bindingParent->GetParent() : aElm->GetParent();
|
||||
while (parent) {
|
||||
if (parent->Tag() == nsGkAtoms::toolbaritem &&
|
||||
if (parent->IsXULElement(nsGkAtoms::toolbaritem) &&
|
||||
parent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aName)) {
|
||||
aName.CompressWhitespace();
|
||||
return;
|
||||
@ -1531,7 +1530,7 @@ Accessible::RelationByType(RelationType aType)
|
||||
case RelationType::LABEL_FOR: {
|
||||
Relation rel(new RelatedAccIterator(Document(), mContent,
|
||||
nsGkAtoms::aria_labelledby));
|
||||
if (mContent->Tag() == nsGkAtoms::label && mContent->IsXULElement())
|
||||
if (mContent->IsXULElement(nsGkAtoms::label))
|
||||
rel.AppendIter(new IDRefsIterator(mDoc, mContent, nsGkAtoms::control));
|
||||
|
||||
return rel;
|
||||
@ -1553,8 +1552,7 @@ Accessible::RelationByType(RelationType aType)
|
||||
// This affectively adds an optional control attribute to xul:description,
|
||||
// which only affects accessibility, by allowing the description to be
|
||||
// tied to a control.
|
||||
if (mContent->Tag() == nsGkAtoms::description &&
|
||||
mContent->IsXULElement())
|
||||
if (mContent->IsXULElement(nsGkAtoms::description))
|
||||
rel.AppendIter(new IDRefsIterator(mDoc, mContent,
|
||||
nsGkAtoms::control));
|
||||
|
||||
|
@ -565,8 +565,7 @@ public:
|
||||
|
||||
inline bool IsAbbreviation() const
|
||||
{
|
||||
return mContent->IsHTMLElement() &&
|
||||
(mContent->Tag() == nsGkAtoms::abbr || mContent->Tag() == nsGkAtoms::acronym);
|
||||
return mContent->IsAnyOfHTMLElements(nsGkAtoms::abbr, nsGkAtoms::acronym);
|
||||
}
|
||||
|
||||
bool IsApplication() const { return mType == eApplicationType; }
|
||||
|
@ -1500,15 +1500,13 @@ DocAccessible::AddDependentIDsFor(dom::Element* aRelProviderElm,
|
||||
continue;
|
||||
|
||||
if (relAttr == nsGkAtoms::_for) {
|
||||
if (!aRelProviderElm->IsHTMLElement() ||
|
||||
(aRelProviderElm->Tag() != nsGkAtoms::label &&
|
||||
aRelProviderElm->Tag() != nsGkAtoms::output))
|
||||
if (!aRelProviderElm->IsAnyOfHTMLElements(nsGkAtoms::label,
|
||||
nsGkAtoms::output))
|
||||
continue;
|
||||
|
||||
} else if (relAttr == nsGkAtoms::control) {
|
||||
if (!aRelProviderElm->IsXULElement() ||
|
||||
(aRelProviderElm->Tag() != nsGkAtoms::label &&
|
||||
aRelProviderElm->Tag() != nsGkAtoms::description))
|
||||
if (!aRelProviderElm->IsAnyOfXULElements(nsGkAtoms::label,
|
||||
nsGkAtoms::description))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -59,34 +59,34 @@ NS_IMPL_ISUPPORTS_INHERITED0(HyperTextAccessible, Accessible)
|
||||
role
|
||||
HyperTextAccessible::NativeRole()
|
||||
{
|
||||
nsIAtom *tag = mContent->Tag();
|
||||
|
||||
if (tag == nsGkAtoms::dd)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::dd))
|
||||
return roles::DEFINITION;
|
||||
|
||||
if (tag == nsGkAtoms::form)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::form))
|
||||
return roles::FORM;
|
||||
|
||||
if (tag == nsGkAtoms::blockquote || tag == nsGkAtoms::div ||
|
||||
tag == nsGkAtoms::section || tag == nsGkAtoms::nav)
|
||||
if (mContent->IsAnyOfHTMLElements(nsGkAtoms::blockquote,
|
||||
nsGkAtoms::div,
|
||||
nsGkAtoms::section,
|
||||
nsGkAtoms::nav))
|
||||
return roles::SECTION;
|
||||
|
||||
if (tag == nsGkAtoms::h1 || tag == nsGkAtoms::h2 ||
|
||||
tag == nsGkAtoms::h3 || tag == nsGkAtoms::h4 ||
|
||||
tag == nsGkAtoms::h5 || tag == nsGkAtoms::h6)
|
||||
if (mContent->IsAnyOfHTMLElements(nsGkAtoms::h1, nsGkAtoms::h2,
|
||||
nsGkAtoms::h3, nsGkAtoms::h4,
|
||||
nsGkAtoms::h5, nsGkAtoms::h6))
|
||||
return roles::HEADING;
|
||||
|
||||
if (tag == nsGkAtoms::article)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::article))
|
||||
return roles::DOCUMENT;
|
||||
|
||||
// Deal with html landmark elements
|
||||
if (tag == nsGkAtoms::header)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::header))
|
||||
return roles::HEADER;
|
||||
|
||||
if (tag == nsGkAtoms::footer)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::footer))
|
||||
return roles::FOOTER;
|
||||
|
||||
if (tag == nsGkAtoms::aside)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::aside))
|
||||
return roles::NOTE;
|
||||
|
||||
// Treat block frames as paragraphs
|
||||
@ -105,7 +105,7 @@ HyperTextAccessible::NativeState()
|
||||
if (mContent->AsElement()->State().HasState(NS_EVENT_STATE_MOZ_READWRITE)) {
|
||||
states |= states::EDITABLE;
|
||||
|
||||
} else if (mContent->Tag() == nsGkAtoms::article) {
|
||||
} else if (mContent->IsHTMLElement(nsGkAtoms::article)) {
|
||||
// We want <article> to behave like a document in terms of readonly state.
|
||||
states |= states::READONLY;
|
||||
}
|
||||
@ -900,18 +900,17 @@ HyperTextAccessible::DefaultTextAttributes()
|
||||
int32_t
|
||||
HyperTextAccessible::GetLevelInternal()
|
||||
{
|
||||
nsIAtom *tag = mContent->Tag();
|
||||
if (tag == nsGkAtoms::h1)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h1))
|
||||
return 1;
|
||||
if (tag == nsGkAtoms::h2)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h2))
|
||||
return 2;
|
||||
if (tag == nsGkAtoms::h3)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h3))
|
||||
return 3;
|
||||
if (tag == nsGkAtoms::h4)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h4))
|
||||
return 4;
|
||||
if (tag == nsGkAtoms::h5)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h5))
|
||||
return 5;
|
||||
if (tag == nsGkAtoms::h6)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::h6))
|
||||
return 6;
|
||||
|
||||
return AccessibleWrap::GetLevelInternal();
|
||||
@ -944,14 +943,13 @@ HyperTextAccessible::NativeAttributes()
|
||||
if (!HasOwnContent())
|
||||
return attributes.forget();
|
||||
|
||||
nsIAtom* tag = mContent->Tag();
|
||||
if (tag == nsGkAtoms::section) {
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::section)) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
|
||||
NS_LITERAL_STRING("region"));
|
||||
} else if (tag == nsGkAtoms::article) {
|
||||
} else if (mContent->IsHTMLElement(nsGkAtoms::article)) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
|
||||
NS_LITERAL_STRING("article"));
|
||||
} else if (tag == nsGkAtoms::time) {
|
||||
} else if (mContent->IsHTMLElement(nsGkAtoms::time)) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles,
|
||||
NS_LITERAL_STRING("time"));
|
||||
|
||||
@ -970,38 +968,42 @@ HyperTextAccessible::LandmarkRole() const
|
||||
{
|
||||
// For the html landmark elements we expose them like we do ARIA landmarks to
|
||||
// make AT navigation schemes "just work".
|
||||
nsIAtom* tag = mContent->Tag();
|
||||
if (tag == nsGkAtoms::nav)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::nav)) {
|
||||
return nsGkAtoms::navigation;
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::header || tag == nsGkAtoms::footer) {
|
||||
if (mContent->IsAnyOfHTMLElements(nsGkAtoms::header,
|
||||
nsGkAtoms::footer)) {
|
||||
// Only map header and footer if they are not descendants of an article
|
||||
// or section tag.
|
||||
nsIContent* parent = mContent->GetParent();
|
||||
while (parent) {
|
||||
if (parent->Tag() == nsGkAtoms::article ||
|
||||
parent->Tag() == nsGkAtoms::section)
|
||||
if (parent->IsAnyOfHTMLElements(nsGkAtoms::article, nsGkAtoms::section)) {
|
||||
break;
|
||||
}
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
|
||||
// No article or section elements found.
|
||||
if (!parent) {
|
||||
if (tag == nsGkAtoms::header)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::header)) {
|
||||
return nsGkAtoms::banner;
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::footer) {
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::footer)) {
|
||||
return nsGkAtoms::contentinfo;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::aside)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::aside)) {
|
||||
return nsGkAtoms::complementary;
|
||||
}
|
||||
|
||||
if (tag == nsGkAtoms::main)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::main)) {
|
||||
return nsGkAtoms::main;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -92,8 +92,8 @@ RootAccessible::NativeRole()
|
||||
{
|
||||
// If it's a <dialog> or <wizard>, use roles::DIALOG instead
|
||||
dom::Element* rootElm = mDocumentNode->GetRootElement();
|
||||
if (rootElm && (rootElm->Tag() == nsGkAtoms::dialog ||
|
||||
rootElm->Tag() == nsGkAtoms::wizard))
|
||||
if (rootElm && rootElm->IsAnyOfXULElements(nsGkAtoms::dialog,
|
||||
nsGkAtoms::wizard))
|
||||
return roles::DIALOG;
|
||||
|
||||
return DocAccessibleWrap::NativeRole();
|
||||
|
@ -250,7 +250,7 @@ HTMLButtonAccessible::NativeName(nsString& aName)
|
||||
// type="submit"/"reset"/"image" elements.
|
||||
|
||||
ENameValueFlag nameFlag = Accessible::NativeName(aName);
|
||||
if (!aName.IsEmpty() || mContent->Tag() != nsGkAtoms::input ||
|
||||
if (!aName.IsEmpty() || !mContent->IsHTMLElement(nsGkAtoms::input) ||
|
||||
!mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::image, eCaseMatters))
|
||||
return nameFlag;
|
||||
|
@ -26,7 +26,7 @@ NS_IMPL_ISUPPORTS_INHERITED0(HTMLListAccessible, HyperTextAccessible)
|
||||
role
|
||||
HTMLListAccessible::NativeRole()
|
||||
{
|
||||
if (mContent->Tag() == nsGkAtoms::dl)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::dl))
|
||||
return roles::DEFINITION_LIST;
|
||||
|
||||
return roles::LIST;
|
||||
@ -69,7 +69,7 @@ HTMLLIAccessible::Shutdown()
|
||||
role
|
||||
HTMLLIAccessible::NativeRole()
|
||||
{
|
||||
if (mContent->Tag() == nsGkAtoms::dt)
|
||||
if (mContent->IsHTMLElement(nsGkAtoms::dt))
|
||||
return roles::TERM;
|
||||
|
||||
return roles::LISTITEM;
|
||||
|
@ -130,9 +130,8 @@ HTMLSelectListAccessible::CacheChildren()
|
||||
continue;
|
||||
}
|
||||
|
||||
nsIAtom* tag = childContent->Tag();
|
||||
if (tag == nsGkAtoms::option ||
|
||||
tag == nsGkAtoms::optgroup) {
|
||||
if (childContent->IsAnyOfHTMLElements(nsGkAtoms::option,
|
||||
nsGkAtoms::optgroup)) {
|
||||
|
||||
// Get an accessible for option or optgroup and cache it.
|
||||
nsRefPtr<Accessible> accessible =
|
||||
|
@ -929,7 +929,7 @@ HTMLTableAccessible::IsProbablyLayoutTable()
|
||||
RETURN_LAYOUT_ANSWER(false, "Has role attribute, weak role, and role is table");
|
||||
}
|
||||
|
||||
if (mContent->Tag() != nsGkAtoms::table)
|
||||
if (!mContent->IsHTMLElement(nsGkAtoms::table))
|
||||
RETURN_LAYOUT_ANSWER(true, "table built by CSS display:table style");
|
||||
|
||||
// Check if datatable attribute has "0" value.
|
||||
@ -954,18 +954,18 @@ HTMLTableAccessible::IsProbablyLayoutTable()
|
||||
if (!childElm->IsHTMLElement())
|
||||
continue;
|
||||
|
||||
if (childElm->Tag() == nsGkAtoms::col ||
|
||||
childElm->Tag() == nsGkAtoms::colgroup ||
|
||||
childElm->Tag() == nsGkAtoms::tfoot ||
|
||||
childElm->Tag() == nsGkAtoms::thead) {
|
||||
if (childElm->IsAnyOfHTMLElements(nsGkAtoms::col,
|
||||
nsGkAtoms::colgroup,
|
||||
nsGkAtoms::tfoot,
|
||||
nsGkAtoms::thead)) {
|
||||
RETURN_LAYOUT_ANSWER(false,
|
||||
"Has col, colgroup, tfoot or thead -- legitimate table structures");
|
||||
}
|
||||
|
||||
if (childElm->Tag() == nsGkAtoms::tbody) {
|
||||
if (childElm->IsHTMLElement(nsGkAtoms::tbody)) {
|
||||
for (nsIContent* rowElm = childElm->GetFirstChild(); rowElm;
|
||||
rowElm = rowElm->GetNextSibling()) {
|
||||
if (rowElm->IsHTMLElement() && rowElm->Tag() == nsGkAtoms::tr) {
|
||||
if (rowElm->IsHTMLElement(nsGkAtoms::tr)) {
|
||||
for (nsIContent* cellElm = rowElm->GetFirstChild(); cellElm;
|
||||
cellElm = cellElm->GetNextSibling()) {
|
||||
if (cellElm->IsHTMLElement()) {
|
||||
|
@ -1221,7 +1221,7 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
|
||||
nsAutoCString id;
|
||||
nsIContent* cnt = accessible->GetContent();
|
||||
if (cnt) {
|
||||
cnt->Tag()->ToString(tag);
|
||||
cnt->NodeInfo()->NameAtom()->ToString(tag);
|
||||
nsIAtom* aid = cnt->GetID();
|
||||
if (aid)
|
||||
aid->ToUTF8String(id);
|
||||
|
@ -92,7 +92,7 @@ XULLabelAccessible::RelationByType(RelationType aType)
|
||||
if (aType == RelationType::LABEL_FOR) {
|
||||
// Caption is the label for groupbox
|
||||
nsIContent* parent = mContent->GetFlattenedTreeParent();
|
||||
if (parent && parent->Tag() == nsGkAtoms::caption) {
|
||||
if (parent && parent->IsXULElement(nsGkAtoms::caption)) {
|
||||
Accessible* parent = Parent();
|
||||
if (parent && parent->Role() == roles::GROUPING)
|
||||
rel.AppendTarget(parent);
|
||||
|
@ -182,7 +182,7 @@ XULButtonAccessible::IsAcceptableChild(Accessible* aPossibleChild) const
|
||||
// Button type="menu-button" contains a real button. Get an accessible
|
||||
// for it. Ignore dropmarker button which is placed as a last child.
|
||||
if (role != roles::PUSHBUTTON ||
|
||||
aPossibleChild->GetContent()->Tag() == nsGkAtoms::dropMarker)
|
||||
aPossibleChild->GetContent()->IsXULElement(nsGkAtoms::dropMarker))
|
||||
return false;
|
||||
|
||||
return mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
@ -569,9 +569,10 @@ bool
|
||||
XULToolbarButtonAccessible::IsSeparator(Accessible* aAccessible)
|
||||
{
|
||||
nsIContent* content = aAccessible->GetContent();
|
||||
return content && ((content->Tag() == nsGkAtoms::toolbarseparator) ||
|
||||
(content->Tag() == nsGkAtoms::toolbarspacer) ||
|
||||
(content->Tag() == nsGkAtoms::toolbarspring)); }
|
||||
return content && content->IsAnyOfXULElements(nsGkAtoms::toolbarseparator,
|
||||
nsGkAtoms::toolbarspacer,
|
||||
nsGkAtoms::toolbarspring);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user