/* -*- 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/. */
HTMLSummaryAccessible* summaryAccessible = nullptr; for (uint32_t i = 0; i < details->ChildCount(); i++) { // Iterate through the children of our details accessible to locate main // summary. This iteration includes the anonymous summary if the details // element was not explicitly created with one.
LocalAccessible* child = details->LocalChildAt(i); auto* summary =
mozilla::dom::HTMLSummaryElement::FromNodeOrNull(child->GetContent()); if (summary && summary->IsMainSummary()) {
summaryAccessible = static_cast<HTMLSummaryAccessible*>(child); break;
}
}
role HTMLHeaderOrFooterAccessible::NativeRole() const { // Only map header and footer if they are direct descendants of the body tag. // If other sectioning or sectioning root elements, they become sections.
nsIContent* parent = mContent->GetParent(); while (parent) { if (parent->IsAnyOfHTMLElements(
nsGkAtoms::article, nsGkAtoms::aside, nsGkAtoms::nav,
nsGkAtoms::section, nsGkAtoms::main, nsGkAtoms::blockquote,
nsGkAtoms::details, nsGkAtoms::dialog, nsGkAtoms::fieldset,
nsGkAtoms::figure, nsGkAtoms::td)) { break;
}
parent = parent->GetParent();
}
// No sectioning or sectioning root elements found. if (!parent) { return roles::LANDMARK;
}
role HTMLAsideAccessible::NativeRole() const { // Per the HTML-AAM spec, there are two cases for aside elements: // 1. scoped to body or main elements -> 'complementary' role // 2. scoped to sectioning content elements // -> if the element has an accessible name, 'complementary' role // -> otherwise, 'generic' role // To implement this, walk ancestors until we find a sectioning content // element, or a body/main element, then take actions based on the rules // above.
nsIContent* parent = mContent->GetParent(); while (parent) { if (parent->IsAnyOfHTMLElements(nsGkAtoms::article, nsGkAtoms::aside,
nsGkAtoms::nav, nsGkAtoms::section)) { return !NameIsEmpty() ? roles::LANDMARK : roles::SECTION;
} if (parent->IsAnyOfHTMLElements(nsGkAtoms::main, nsGkAtoms::body)) { return roles::LANDMARK;
}
parent = parent->GetParent();
}
// Fall back to landmark, though we always expect to find a body element. return roles::LANDMARK;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.