summaryrefslogtreecommitdiffstats
path: root/accessible/html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /accessible/html
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz
firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessible/html')
-rw-r--r--accessible/html/HTMLElementAccessibles.cpp33
-rw-r--r--accessible/html/HTMLElementAccessibles.h17
-rw-r--r--accessible/html/HTMLFormControlAccessible.cpp6
-rw-r--r--accessible/html/HTMLLinkAccessible.cpp11
-rw-r--r--accessible/html/HTMLLinkAccessible.h2
-rw-r--r--accessible/html/moz.build4
6 files changed, 66 insertions, 7 deletions
diff --git a/accessible/html/HTMLElementAccessibles.cpp b/accessible/html/HTMLElementAccessibles.cpp
index e01de31ff2..135f997358 100644
--- a/accessible/html/HTMLElementAccessibles.cpp
+++ b/accessible/html/HTMLElementAccessibles.cpp
@@ -221,11 +221,38 @@ role HTMLHeaderOrFooterAccessible::NativeRole() const {
}
////////////////////////////////////////////////////////////////////////////////
+// HTMLAsideAccessible
+////////////////////////////////////////////////////////////////////////////////
+
+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;
+}
+
+////////////////////////////////////////////////////////////////////////////////
// HTMLSectionAccessible
////////////////////////////////////////////////////////////////////////////////
role HTMLSectionAccessible::NativeRole() const {
- nsAutoString name;
- const_cast<HTMLSectionAccessible*>(this)->Name(name);
- return name.IsEmpty() ? roles::SECTION : roles::REGION;
+ return NameIsEmpty() ? roles::SECTION : roles::REGION;
}
diff --git a/accessible/html/HTMLElementAccessibles.h b/accessible/html/HTMLElementAccessibles.h
index 5a3ec6cef8..520a38342c 100644
--- a/accessible/html/HTMLElementAccessibles.h
+++ b/accessible/html/HTMLElementAccessibles.h
@@ -136,6 +136,23 @@ class HTMLHeaderOrFooterAccessible : public HyperTextAccessible {
};
/**
+ * Used for aside elements.
+ */
+class HTMLAsideAccessible : public HyperTextAccessible {
+ public:
+ HTMLAsideAccessible(nsIContent* aContent, DocAccessible* aDoc)
+ : HyperTextAccessible(aContent, aDoc) {}
+
+ NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLAsideAccessible, HyperTextAccessible)
+
+ // LocalAccessible
+ virtual a11y::role NativeRole() const override;
+
+ protected:
+ virtual ~HTMLAsideAccessible() = default;
+};
+
+/**
* Used for HTML section element.
*/
class HTMLSectionAccessible : public HyperTextAccessible {
diff --git a/accessible/html/HTMLFormControlAccessible.cpp b/accessible/html/HTMLFormControlAccessible.cpp
index 95d6fed7b3..5974cc2f7c 100644
--- a/accessible/html/HTMLFormControlAccessible.cpp
+++ b/accessible/html/HTMLFormControlAccessible.cpp
@@ -35,9 +35,7 @@ using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
role HTMLFormAccessible::NativeRole() const {
- nsAutoString name;
- const_cast<HTMLFormAccessible*>(this)->Name(name);
- return name.IsEmpty() ? roles::FORM : roles::FORM_LANDMARK;
+ return NameIsEmpty() ? roles::FORM : roles::FORM_LANDMARK;
}
void HTMLFormAccessible::DOMAttributeChanged(int32_t aNameSpaceID,
@@ -293,7 +291,7 @@ already_AddRefed<AccAttributes> HTMLTextFieldAccessible::NativeAttributes() {
nsString placeholderText;
if (mContent->AsElement()->GetAttr(nsGkAtoms::placeholder, placeholderText)) {
nsAutoString name;
- const_cast<HTMLTextFieldAccessible*>(this)->Name(name);
+ Name(name);
if (!name.Equals(placeholderText)) {
attributes->SetAttribute(nsGkAtoms::placeholder,
std::move(placeholderText));
diff --git a/accessible/html/HTMLLinkAccessible.cpp b/accessible/html/HTMLLinkAccessible.cpp
index b3549996fc..89c5d8d51d 100644
--- a/accessible/html/HTMLLinkAccessible.cpp
+++ b/accessible/html/HTMLLinkAccessible.cpp
@@ -112,6 +112,17 @@ void HTMLLinkAccessible::DOMAttributeChanged(int32_t aNameSpaceID,
}
}
+ENameValueFlag HTMLLinkAccessible::NativeName(nsString& aName) const {
+ if (mContent->IsSVGElement()) {
+ mContent->AsElement()->GetAttr(kNameSpaceID_XLink, nsGkAtoms::title, aName);
+ if (!aName.IsEmpty()) {
+ return eNameOK;
+ }
+ }
+
+ return HyperTextAccessible::NativeName(aName);
+}
+
////////////////////////////////////////////////////////////////////////////////
// HyperLinkAccessible
diff --git a/accessible/html/HTMLLinkAccessible.h b/accessible/html/HTMLLinkAccessible.h
index de5f903a3d..888df2f06c 100644
--- a/accessible/html/HTMLLinkAccessible.h
+++ b/accessible/html/HTMLLinkAccessible.h
@@ -46,6 +46,8 @@ class HTMLLinkAccessible : public HyperTextAccessible {
const nsAttrValue* aOldValue,
uint64_t aOldState) override;
+ virtual ENameValueFlag NativeName(nsString& aName) const override;
+
enum { eAction_Jump = 0 };
};
diff --git a/accessible/html/moz.build b/accessible/html/moz.build
index 3a246373da..73b7737987 100644
--- a/accessible/html/moz.build
+++ b/accessible/html/moz.build
@@ -42,6 +42,10 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
LOCAL_INCLUDES += [
"/accessible/android",
]
+elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit":
+ LOCAL_INCLUDES += [
+ "/accessible/ios",
+ ]
else:
LOCAL_INCLUDES += [
"/accessible/other",