Backed out changeset d6af78936bdb (bug 1826851) for causing assertion failures on dom/base/nsAttrValueInlines.h. CLOSED TREE

This commit is contained in:
Cosmin Sabou 2023-04-12 02:15:21 +03:00
parent c3abd85095
commit 89ecf0ab85
11 changed files with 18 additions and 54 deletions

View File

@ -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();

View File

@ -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

View File

@ -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;
}

View File

@ -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<nsAtom> LocalAccessible::DisplayStyle() const {
if (dom::Element* elm = Elm()) {
if (elm->IsHTMLElement(nsGkAtoms::area)) {

View File

@ -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<nsAtom> DisplayStyle() const override;
virtual float Opacity() const override;

View File

@ -1429,18 +1429,6 @@ nsAtom* RemoteAccessibleBase<Derived>::TagName() const {
return nullptr;
}
template <class Derived>
nsAtom* RemoteAccessibleBase<Derived>::InputType() const {
if (mCachedFields) {
if (auto inputType = mCachedFields->GetAttribute<RefPtr<nsAtom>>(
nsGkAtoms::textInputType)) {
return *inputType;
}
}
return nullptr;
}
template <class Derived>
already_AddRefed<nsAtom> RemoteAccessibleBase<Derived>::DisplayStyle() const {
if (mCachedFields) {

View File

@ -202,8 +202,6 @@ class RemoteAccessibleBase : public Accessible, public HyperTextAccessibleBase {
virtual nsAtom* TagName() const override;
virtual nsAtom* InputType() const override;
virtual already_AddRefed<nsAtom> DisplayStyle() const override;
virtual float Opacity() const override;

View File

@ -50,6 +50,8 @@ virtual already_AddRefed<AccAttributes> 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);

View File

@ -118,10 +118,6 @@ void RemoteAccessible::Relations(
}
bool RemoteAccessible::IsSearchbox() const {
if (StaticPrefs::accessibility_cache_enabled_AtStartup()) {
return RemoteAccessibleBase<RemoteAccessible>::IsSearchbox();
}
bool retVal = false;
Unused << mDoc->SendIsSearchbox(mID, &retVal);
return retVal;

View File

@ -75,8 +75,6 @@ class RemoteAccessible : public RemoteAccessibleBase<RemoteAccessible> {
virtual nsAtom* LandmarkRole() const override;
virtual bool IsSearchbox() const override;
virtual int32_t SelectionCount() override;
using RemoteAccessibleBase<RemoteAccessible>::SelectionBoundsAt;

View File

@ -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;