mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 04:41:11 +00:00
Bug 1882909: Remove unnecessary uses of const_cast from accessibility module, r=morgan
This revision removes all removable instances of const_cast from the accessibility module. Name() was previously non-const, but is now const. Same for ActionWalk(). Differential Revision: https://phabricator.services.mozilla.com/D203207
This commit is contained in:
parent
05452e1329
commit
13906c252f
@ -120,8 +120,7 @@ const LocalAccessible* LinkableAccessible::ActionWalk(bool* aIsLink,
|
||||
}
|
||||
|
||||
KeyBinding LinkableAccessible::AccessKey() const {
|
||||
if (const LocalAccessible* actionAcc =
|
||||
const_cast<LinkableAccessible*>(this)->ActionWalk()) {
|
||||
if (const LocalAccessible* actionAcc = ActionWalk()) {
|
||||
return actionAcc->AccessKey();
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,5 @@ role HTMLHeaderOrFooterAccessible::NativeRole() const {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user