diff --git a/accessible/basetypes/Accessible.cpp b/accessible/basetypes/Accessible.cpp index 1d7b23b85a76..567056444a65 100644 --- a/accessible/basetypes/Accessible.cpp +++ b/accessible/basetypes/Accessible.cpp @@ -363,16 +363,6 @@ void Accessible::GetPositionAndSetSize(int32_t* aPosInSet, int32_t* aSetSize) { } } -bool Accessible::IsSearchbox() const { - const nsRoleMapEntry* roleMapEntry = ARIARoleMap(); - if ((roleMapEntry && roleMapEntry->Is(nsGkAtoms::searchbox)) || - InputType() == nsGkAtoms::search) { - return true; - } - - return false; -} - #ifdef A11Y_LOG void Accessible::DebugDescription(nsCString& aDesc) const { aDesc.Truncate(); diff --git a/accessible/basetypes/Accessible.h b/accessible/basetypes/Accessible.h index 59210538c1fb..1dc769da738a 100644 --- a/accessible/basetypes/Accessible.h +++ b/accessible/basetypes/Accessible.h @@ -366,11 +366,6 @@ class Accessible { */ virtual nsAtom* TagName() const = 0; - /** - * Return input `type` attribute - */ - virtual nsAtom* InputType() const = 0; - /** * Return a landmark role if applied. */ @@ -563,8 +558,6 @@ class Accessible { bool IsDateTimeField() const { return mType == eHTMLDateTimeFieldType; } - virtual bool IsSearchbox() const; - virtual bool HasNumericValue() const = 0; // Remote/Local types diff --git a/accessible/generic/LocalAccessible-inl.h b/accessible/generic/LocalAccessible-inl.h index 39287dbbc4cf..4692b85186c0 100644 --- a/accessible/generic/LocalAccessible-inl.h +++ b/accessible/generic/LocalAccessible-inl.h @@ -43,6 +43,14 @@ inline void LocalAccessible::SetRoleMapEntry( mRoleMapEntryIndex = aria::GetIndexFromRoleMap(aRoleMapEntry); } +inline bool LocalAccessible::IsSearchbox() const { + const nsRoleMapEntry* roleMapEntry = ARIARoleMap(); + return (roleMapEntry && roleMapEntry->Is(nsGkAtoms::searchbox)) || + (mContent->IsHTMLElement(nsGkAtoms::input) && + mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, + nsGkAtoms::search, eCaseMatters)); +} + inline bool LocalAccessible::NativeHasNumericValue() const { return mGenericTypes & eNumericValue; } diff --git a/accessible/generic/LocalAccessible.cpp b/accessible/generic/LocalAccessible.cpp index 75b4e27d4127..301e5b25b372 100644 --- a/accessible/generic/LocalAccessible.cpp +++ b/accessible/generic/LocalAccessible.cpp @@ -3891,19 +3891,6 @@ nsAtom* LocalAccessible::TagName() const { : nullptr; } -nsAtom* LocalAccessible::InputType() const { - if (!IsTextField() && !IsDateTimeField()) { - return nullptr; - } - - dom::Element* el = mContent->AsElement(); - if (const nsAttrValue* attr = el->GetParsedAttr(nsGkAtoms::type)) { - return attr->GetAtomValue(); - } - - return nullptr; -} - already_AddRefed LocalAccessible::DisplayStyle() const { if (dom::Element* elm = Elm()) { if (elm->IsHTMLElement(nsGkAtoms::area)) { diff --git a/accessible/generic/LocalAccessible.h b/accessible/generic/LocalAccessible.h index 3f83ad94aec8..0f77c068a42e 100644 --- a/accessible/generic/LocalAccessible.h +++ b/accessible/generic/LocalAccessible.h @@ -469,6 +469,8 @@ class LocalAccessible : public nsISupports, public Accessible { a11y::RootAccessible* AsRoot(); + bool IsSearchbox() const; + virtual TableAccessible* AsTable() { return nullptr; } virtual TableCellAccessible* AsTableCell() { return nullptr; } @@ -766,8 +768,6 @@ class LocalAccessible : public nsISupports, public Accessible { virtual nsAtom* TagName() const override; - virtual nsAtom* InputType() const override; - virtual already_AddRefed DisplayStyle() const override; virtual float Opacity() const override; diff --git a/accessible/ipc/RemoteAccessibleBase.cpp b/accessible/ipc/RemoteAccessibleBase.cpp index 9185ae035d20..1077cac19368 100644 --- a/accessible/ipc/RemoteAccessibleBase.cpp +++ b/accessible/ipc/RemoteAccessibleBase.cpp @@ -1429,18 +1429,6 @@ nsAtom* RemoteAccessibleBase::TagName() const { return nullptr; } -template -nsAtom* RemoteAccessibleBase::InputType() const { - if (mCachedFields) { - if (auto inputType = mCachedFields->GetAttribute>( - nsGkAtoms::textInputType)) { - return *inputType; - } - } - - return nullptr; -} - template already_AddRefed RemoteAccessibleBase::DisplayStyle() const { if (mCachedFields) { diff --git a/accessible/ipc/RemoteAccessibleBase.h b/accessible/ipc/RemoteAccessibleBase.h index 436581fcc5c9..9a51a86828f5 100644 --- a/accessible/ipc/RemoteAccessibleBase.h +++ b/accessible/ipc/RemoteAccessibleBase.h @@ -202,8 +202,6 @@ class RemoteAccessibleBase : public Accessible, public HyperTextAccessibleBase { virtual nsAtom* TagName() const override; - virtual nsAtom* InputType() const override; - virtual already_AddRefed DisplayStyle() const override; virtual float Opacity() const override; diff --git a/accessible/ipc/RemoteAccessibleShared.h b/accessible/ipc/RemoteAccessibleShared.h index c94936fa2d40..6eaa2e879e9b 100644 --- a/accessible/ipc/RemoteAccessibleShared.h +++ b/accessible/ipc/RemoteAccessibleShared.h @@ -50,6 +50,8 @@ virtual already_AddRefed Attributes() override; virtual Relation RelationByType(RelationType aType) const override; +bool IsSearchbox() const; + virtual mozilla::a11y::GroupPos GroupPosition() override; void ScrollToPoint(uint32_t aScrollType, int32_t aX, int32_t aY); diff --git a/accessible/ipc/other/RemoteAccessible.cpp b/accessible/ipc/other/RemoteAccessible.cpp index a88e34961331..361ba7b76439 100644 --- a/accessible/ipc/other/RemoteAccessible.cpp +++ b/accessible/ipc/other/RemoteAccessible.cpp @@ -118,10 +118,6 @@ void RemoteAccessible::Relations( } bool RemoteAccessible::IsSearchbox() const { - if (StaticPrefs::accessibility_cache_enabled_AtStartup()) { - return RemoteAccessibleBase::IsSearchbox(); - } - bool retVal = false; Unused << mDoc->SendIsSearchbox(mID, &retVal); return retVal; diff --git a/accessible/ipc/other/RemoteAccessible.h b/accessible/ipc/other/RemoteAccessible.h index 78020265c1e6..3f6e17be2b70 100644 --- a/accessible/ipc/other/RemoteAccessible.h +++ b/accessible/ipc/other/RemoteAccessible.h @@ -75,8 +75,6 @@ class RemoteAccessible : public RemoteAccessibleBase { virtual nsAtom* LandmarkRole() const override; - virtual bool IsSearchbox() const override; - virtual int32_t SelectionCount() override; using RemoteAccessibleBase::SelectionBoundsAt; diff --git a/accessible/mac/mozTextAccessible.mm b/accessible/mac/mozTextAccessible.mm index 3fb09fcd6677..9dbdc8e7b8cf 100644 --- a/accessible/mac/mozTextAccessible.mm +++ b/accessible/mac/mozTextAccessible.mm @@ -125,8 +125,12 @@ inline NSString* ToNSString(id aValue) { return NSAccessibilitySecureTextFieldSubrole; } - if (mRole == roles::ENTRY && mGeckoAccessible->IsSearchbox()) { - return @"AXSearchField"; + if (mRole == roles::ENTRY) { + LocalAccessible* acc = mGeckoAccessible->AsLocal(); + RemoteAccessible* proxy = mGeckoAccessible->AsRemote(); + if ((acc && acc->IsSearchbox()) || (proxy && proxy->IsSearchbox())) { + return @"AXSearchField"; + } } return nil;