summaryrefslogtreecommitdiffstats
path: root/accessible/generic
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /accessible/generic
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessible/generic')
-rw-r--r--accessible/generic/LocalAccessible.cpp44
-rw-r--r--accessible/generic/LocalAccessible.h2
2 files changed, 31 insertions, 15 deletions
diff --git a/accessible/generic/LocalAccessible.cpp b/accessible/generic/LocalAccessible.cpp
index aaf0337a1a..b01b758945 100644
--- a/accessible/generic/LocalAccessible.cpp
+++ b/accessible/generic/LocalAccessible.cpp
@@ -14,6 +14,7 @@
#include "mozilla/a11y/AccAttributes.h"
#include "mozilla/a11y/DocAccessibleChild.h"
#include "mozilla/a11y/Platform.h"
+#include "mozilla/FocusModel.h"
#include "nsAccUtils.h"
#include "nsAccessibilityService.h"
#include "ApplicationAccessible.h"
@@ -127,7 +128,6 @@ ENameValueFlag LocalAccessible::Name(nsString& aName) const {
if (!aName.IsEmpty()) return eNameOK;
ENameValueFlag nameFlag = NativeName(aName);
- nsCoreUtils::TrimNonBreakingSpaces(aName);
if (!aName.IsEmpty()) return nameFlag;
// In the end get the name from tooltip.
@@ -408,6 +408,7 @@ uint64_t LocalAccessible::NativeInteractiveState() const {
if (NativelyUnavailable()) return states::UNAVAILABLE;
nsIFrame* frame = GetFrame();
+ auto flags = IsFocusableFlags(0);
// If we're caching this remote document in the parent process, we
// need to cache focusability irrespective of visibility. Otherwise,
// if this document is invisible when it first loads, we'll cache that
@@ -418,13 +419,12 @@ uint64_t LocalAccessible::NativeInteractiveState() const {
// Although ignoring visibility means IsFocusable will return true for
// visibility: hidden, etc., this isn't a problem because we don't include
// those hidden elements in the a11y tree anyway.
- const bool ignoreVisibility = mDoc->IPCDoc();
- if (frame && frame->IsFocusable(
- /* aWithMouse */ false,
- /* aCheckVisibility */ !ignoreVisibility)) {
+ if (mDoc->IPCDoc()) {
+ flags |= IsFocusableFlags::IgnoreVisibility;
+ }
+ if (frame && frame->IsFocusable(flags)) {
return states::FOCUSABLE;
}
-
return 0;
}
@@ -689,7 +689,8 @@ nsRect LocalAccessible::RelativeBounds(nsIFrame** aBoundingFrame) const {
if (frame && mContent) {
*aBoundingFrame = nsLayoutUtils::GetContainingBlockForClientRect(frame);
nsRect unionRect = nsLayoutUtils::GetAllInFlowRectsUnion(
- frame, *aBoundingFrame, nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
+ frame, *aBoundingFrame,
+ nsLayoutUtils::GetAllInFlowRectsFlag::AccountForTransforms);
if (unionRect.IsEmpty()) {
// If we end up with a 0x0 rect from above (or one with negative
@@ -1625,6 +1626,14 @@ void LocalAccessible::ApplyARIAState(uint64_t* aState) const {
*aState |= aria::UniversalStatesFor(element);
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
+ if (!roleMapEntry && IsHTMLTableCell() && Role() == roles::GRID_CELL) {
+ // This is a <td> inside a role="grid", so it gets an implicit role of
+ // GRID_CELL in ARIATransformRole. However, because it's implicit, we
+ // don't have a role map entry, and without that, we can't apply ARIA states
+ // below. Therefore, we get the role map entry here.
+ roleMapEntry = aria::GetRoleMap(nsGkAtoms::gridcell);
+ MOZ_ASSERT(roleMapEntry, "Should have role map entry for gridcell");
+ }
if (roleMapEntry) {
// We only force the readonly bit off if we have a real mapping for the aria
// role. This preserves the ability for screen readers to use readonly
@@ -3794,14 +3803,12 @@ already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
} else if (aUpdateType == CacheUpdateType::Update) {
fields->SetAttribute(CacheKey::DOMNodeID, DeleteEntry());
}
- if (auto* el = dom::Element::FromNodeOrNull(mContent)) {
- nsAutoString className;
- el->GetClassName(className);
- if (!className.IsEmpty()) {
- fields->SetAttribute(CacheKey::DOMNodeClass, std::move(className));
- } else if (aUpdateType == CacheUpdateType::Update) {
- fields->SetAttribute(CacheKey::DOMNodeClass, DeleteEntry());
- }
+ nsString className;
+ DOMNodeClass(className);
+ if (!className.IsEmpty()) {
+ fields->SetAttribute(CacheKey::DOMNodeClass, std::move(className));
+ } else if (aUpdateType == CacheUpdateType::Update) {
+ fields->SetAttribute(CacheKey::DOMNodeClass, DeleteEntry());
}
}
@@ -4272,6 +4279,13 @@ void LocalAccessible::DOMNodeID(nsString& aID) const {
}
}
+void LocalAccessible::DOMNodeClass(nsString& aClass) const {
+ aClass.Truncate();
+ if (auto* el = dom::Element::FromNodeOrNull(mContent)) {
+ el->GetClassName(aClass);
+ }
+}
+
void LocalAccessible::LiveRegionAttributes(nsAString* aLive,
nsAString* aRelevant,
Maybe<bool>* aAtomic,
diff --git a/accessible/generic/LocalAccessible.h b/accessible/generic/LocalAccessible.h
index 51c4cc9424..eb684b9291 100644
--- a/accessible/generic/LocalAccessible.h
+++ b/accessible/generic/LocalAccessible.h
@@ -736,6 +736,8 @@ class LocalAccessible : public nsISupports, public Accessible {
virtual void DOMNodeID(nsString& aID) const override;
+ virtual void DOMNodeClass(nsString& aClass) const override;
+
virtual void LiveRegionAttributes(nsAString* aLive, nsAString* aRelevant,
Maybe<bool>* aAtomic,
nsAString* aBusy) const override;