diff options
Diffstat (limited to 'accessible/basetypes')
-rw-r--r-- | accessible/basetypes/Accessible.cpp | 22 | ||||
-rw-r--r-- | accessible/basetypes/Accessible.h | 5 |
2 files changed, 18 insertions, 9 deletions
diff --git a/accessible/basetypes/Accessible.cpp b/accessible/basetypes/Accessible.cpp index 05c8270483..de9740dd18 100644 --- a/accessible/basetypes/Accessible.cpp +++ b/accessible/basetypes/Accessible.cpp @@ -468,7 +468,7 @@ void Accessible::DebugPrint(const char* aPrefix, } else { desc.AssignLiteral("[null]"); } -# if defined(ANDROID) +# if defined(ANDROID) || defined(MOZ_WIDGET_UIKIT) printf_stderr("%s %s\n", aPrefix, desc.get()); # else printf("%s %s\n", aPrefix, desc.get()); @@ -539,17 +539,13 @@ nsStaticAtom* Accessible::LandmarkRole() const { } if (tagName == nsGkAtoms::section) { - nsAutoString name; - Name(name); - if (!name.IsEmpty()) { + if (!NameIsEmpty()) { return nsGkAtoms::region; } } if (tagName == nsGkAtoms::form) { - nsAutoString name; - Name(name); - if (!name.IsEmpty()) { + if (!NameIsEmpty()) { return nsGkAtoms::form; } } @@ -567,8 +563,10 @@ nsStaticAtom* Accessible::LandmarkRole() const { nsStaticAtom* Accessible::ComputedARIARole() const { const nsRoleMapEntry* roleMap = ARIARoleMap(); if (roleMap && roleMap->roleAtom != nsGkAtoms::_empty && - // region has its own Gecko role and it needs to be handled specially. + // region and form have their own Gecko roles and need to be handled + // specially. roleMap->roleAtom != nsGkAtoms::region && + roleMap->roleAtom != nsGkAtoms::form && (roleMap->roleRule == kUseNativeRole || roleMap->IsOfType(eLandmark) || roleMap->roleAtom == nsGkAtoms::alertdialog || roleMap->roleAtom == nsGkAtoms::feed || @@ -596,7 +594,7 @@ nsStaticAtom* Accessible::ComputedARIARole() const { } // Role from native markup or layout. #define ROLE(_geckoRole, stringRole, ariaRole, atkRole, macRole, macSubrole, \ - msaaRole, ia2Role, androidClass, nameRule) \ + msaaRole, ia2Role, androidClass, iosIsElement, nameRule) \ case roles::_geckoRole: \ return ariaRole; switch (geckoRole) { @@ -651,6 +649,12 @@ void Accessible::ApplyImplicitState(uint64_t& aState) const { } } +bool Accessible::NameIsEmpty() const { + nsAutoString name; + Name(name); + return name.IsEmpty(); +} + //////////////////////////////////////////////////////////////////////////////// // KeyBinding class diff --git a/accessible/basetypes/Accessible.h b/accessible/basetypes/Accessible.h index 9b2e38e94d..77ac0bb4fc 100644 --- a/accessible/basetypes/Accessible.h +++ b/accessible/basetypes/Accessible.h @@ -253,6 +253,11 @@ class Accessible { virtual ENameValueFlag Name(nsString& aName) const = 0; /* + * Return true if the accessible name is empty. + */ + bool NameIsEmpty() const; + + /* * Get the description of this accessible. */ virtual void Description(nsString& aDescription) const = 0; |