Skip to content

Commit

Permalink
Backed out 4 changesets (bug 1787284) for causing failures on browser…
Browse files Browse the repository at this point in the history
…_caching_relations.js. CLOSED TREE

Backed out changeset fe4a5fa0fa27 (bug 1787284)
Backed out changeset 54e0b1365f89 (bug 1787284)
Backed out changeset c6db418af190 (bug 1787284)
Backed out changeset fda6706bb580 (bug 1787284)
  • Loading branch information
ncsoregi committed Oct 20, 2022
1 parent 766fb17 commit 34701ee
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 218 deletions.
26 changes: 0 additions & 26 deletions accessible/base/Pivot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,29 +634,3 @@ uint16_t LocalAccInSameDocRule::Match(Accessible* aAcc) {
}
return nsIAccessibleTraversalRule::FILTER_MATCH;
}

// Radio Button Name Rule

PivotRadioNameRule::PivotRadioNameRule(const nsString& aName) : mName(aName) {}

uint16_t PivotRadioNameRule::Match(Accessible* aAcc) {
uint16_t result = nsIAccessibleTraversalRule::FILTER_IGNORE;
RemoteAccessible* remote = aAcc->AsRemote();
if (!remote || !StaticPrefs::accessibility_cache_enabled_AtStartup()) {
// We need the cache to be able to fetch the name attribute below.
return result;
}

if (nsAccUtils::MustPrune(aAcc)) {
result |= nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE;
}

if (remote->IsHTMLRadioButton()) {
nsString currName = remote->GetCachedHTMLRadioNameAttribute();
if (!currName.IsEmpty() && mName.Equals(currName)) {
result |= nsIAccessibleTraversalRule::FILTER_MATCH;
}
}

return result;
}
14 changes: 0 additions & 14 deletions accessible/base/Pivot.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,6 @@ class LocalAccInSameDocRule : public PivotRule {
virtual uint16_t Match(Accessible* aAcc) override;
};

/**
* This rule matches remote radio button accessibles with the given name
* attribute. It assumes the cache is enabled.
*/
class PivotRadioNameRule : public PivotRule {
public:
explicit PivotRadioNameRule(const nsString& aName);

virtual uint16_t Match(Accessible* aAcc) override;

protected:
const nsString& mName;
};

} // namespace a11y
} // namespace mozilla

Expand Down
2 changes: 0 additions & 2 deletions accessible/basetypes/Accessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,6 @@ class Accessible {

bool IsHTMLOptGroup() const { return mType == eHTMLOptGroupType; }

bool IsHTMLRadioButton() const { return mType == eHTMLRadioButtonType; }

bool IsHTMLTable() const { return mType == eHTMLTableType; }
bool IsHTMLTableRow() const { return mType == eHTMLTableRowType; }

Expand Down
15 changes: 0 additions & 15 deletions accessible/generic/LocalAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3595,21 +3595,6 @@ already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
}

if (aCacheDomain & CacheDomain::Relations && mContent) {
if (IsHTMLRadioButton()) {
// HTML radio buttons with the same name should be grouped
// and returned together when their MEMBER_OF relation is
// requested. We cache the name attribute, if it exists, here.
nsString name;
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
if (!name.IsEmpty()) {
fields->SetAttribute(nsGkAtoms::radioLabel, std::move(name));
} else if (aUpdateType != CacheUpdateType::Initial) {
// It's possible we used to have a name and it's since been
// removed. Send a delete entry.
fields->SetAttribute(nsGkAtoms::radioLabel, DeleteEntry());
}
}

for (auto const& data : kRelationTypeAtoms) {
nsTArray<uint64_t> ids;
nsStaticAtom* const relAtom = data.mAtom;
Expand Down
11 changes: 0 additions & 11 deletions accessible/html/HTMLFormControlAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "HTMLFormControlAccessible.h"

#include "CacheConstants.h"
#include "DocAccessible-inl.h"
#include "LocalAccessible-inl.h"
#include "nsAccUtils.h"
Expand Down Expand Up @@ -91,16 +90,6 @@ void HTMLRadioButtonAccessible::GetPositionAndSetSize(int32_t* aPosInSet,
Unused << ComputeGroupAttributes(aPosInSet, aSetSize);
}

void HTMLRadioButtonAccessible::DOMAttributeChanged(
int32_t aNameSpaceID, nsAtom* aAttribute, int32_t aModType,
const nsAttrValue* aOldValue, uint64_t aOldState) {
if (aAttribute == nsGkAtoms::name) {
// If our name changed, it's possible our MEMBER_OF relation
// also changed. Push a cache update for Relations.
mDoc->QueueCacheUpdate(this, CacheDomain::Relations);
}
}

Relation HTMLRadioButtonAccessible::ComputeGroupAttributes(
int32_t* aPosInSet, int32_t* aSetSize) const {
Relation rel = Relation();
Expand Down
7 changes: 0 additions & 7 deletions accessible/html/HTMLFormControlAccessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "FormControlAccessible.h"
#include "HyperTextAccessibleWrap.h"
#include "mozilla/a11y/AccTypes.h"
#include "mozilla/dom/Element.h"
#include "AccAttributes.h"
#include "nsAccUtils.h"
Expand All @@ -28,7 +27,6 @@ class HTMLRadioButtonAccessible : public RadioButtonAccessible {
// Ignore "RadioStateChange" DOM event in lieu of document observer
// state change notification.
mStateFlags |= eIgnoreDOMUIEvent;
mType = eHTMLRadioButtonType;
}

// LocalAccessible
Expand All @@ -39,11 +37,6 @@ class HTMLRadioButtonAccessible : public RadioButtonAccessible {
virtual void GetPositionAndSetSize(int32_t* aPosInSet,
int32_t* aSetSize) override;

virtual void DOMAttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType,
const nsAttrValue* aOldValue,
uint64_t aOldState) override;

private:
Relation ComputeGroupAttributes(int32_t* aPosInSet, int32_t* aSetSize) const;
};
Expand Down
67 changes: 0 additions & 67 deletions accessible/ipc/RemoteAccessibleBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,60 +724,6 @@ Relation RemoteAccessibleBase<Derived>::RelationByType(
return Relation();
}

if (aType == RelationType::MEMBER_OF) {
Relation rel = Relation();
// HTML radio buttons with cached names should be grouped.
if (IsHTMLRadioButton()) {
auto maybeName =
mCachedFields->GetAttribute<nsString>(nsGkAtoms::radioLabel);
if (!maybeName) {
return rel;
}

RemoteAccessible* ancestor = RemoteParent();
while (ancestor && ancestor->Role() != roles::FORM && ancestor != mDoc) {
ancestor = ancestor->RemoteParent();
}
Pivot p = Pivot(ancestor);
PivotRadioNameRule rule(*maybeName);
Accessible* match = p.Next(ancestor, rule);
while (match) {
rel.AppendTarget(match->AsRemote());
match = p.Next(match, rule);
}
return rel;
}

if (IsARIARole(nsGkAtoms::radio)) {
// ARIA radio buttons should be grouped by their radio group
// parent, if one exists.
RemoteAccessible* currParent = RemoteParent();
while (currParent && currParent->Role() != roles::RADIO_GROUP) {
currParent = currParent->RemoteParent();
}

if (currParent && currParent->Role() == roles::RADIO_GROUP) {
// If we found a radiogroup parent, search for all
// roles::RADIOBUTTON children and add them to our relation.
// This search will include the radio button this method
// was called from, which is expected.
Pivot p = Pivot(currParent);
PivotRoleRule rule(roles::RADIOBUTTON);
Accessible* match = p.Next(currParent, rule);
while (match) {
MOZ_ASSERT(match->IsRemote(),
"We should only be traversing the remote tree.");
rel.AppendTarget(match->AsRemote());
match = p.Next(match, rule);
}
}
}
// By webkit's standard, aria radio buttons do not get grouped
// if they lack a group parent, so we return an empty
// relation here if the above check fails.
return rel;
}

Relation rel;
if (!mCachedFields) {
return rel;
Expand Down Expand Up @@ -1028,19 +974,6 @@ RemoteAccessibleBase<Derived>::GetCachedARIAAttributes() const {
return nullptr;
}

template <class Derived>
nsString RemoteAccessibleBase<Derived>::GetCachedHTMLRadioNameAttribute()
const {
if (mCachedFields) {
if (auto maybeName =
mCachedFields->GetAttribute<nsString>(nsGkAtoms::radioLabel)) {
return *maybeName;
}
}

return nsString();
}

template <class Derived>
uint64_t RemoteAccessibleBase<Derived>::State() {
uint64_t state = 0;
Expand Down
2 changes: 0 additions & 2 deletions accessible/ipc/RemoteAccessibleBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,6 @@ class RemoteAccessibleBase : public Accessible, public HyperTextAccessibleBase {
RefPtr<const AccAttributes> GetCachedTextAttributes();
RefPtr<const AccAttributes> GetCachedARIAAttributes() const;

nsString GetCachedHTMLRadioNameAttribute() const;

virtual HyperTextAccessibleBase* AsHyperTextBase() override {
return IsHyperText() ? static_cast<HyperTextAccessibleBase*>(this)
: nullptr;
Expand Down
74 changes: 0 additions & 74 deletions accessible/tests/browser/e10s/browser_caching_relations.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,77 +445,3 @@ addAccessibleTask(
},
{ topLevel: isCacheEnabled, chrome: true }
);

/**
* Test MEMBER_OF relation caching on HTML radio buttons
*/
addAccessibleTask(
`
<input type="radio" id="r1">I have no name<br>
<input type="radio" id="r2">I also have no name<br>
<input type="radio" id="r3" name="n">I have a name<br>
<input type="radio" id="r4" name="a">I have a different name<br>
<fieldset role="radiogroup">
<input type="radio" id="r5" name="n">I have an already used name
and am in a different part of the tree
<input type="radio" id="r6" name="r">I have a different name but am
in the same group
</fieldset>`,
async function(browser, accDoc) {
const r1 = findAccessibleChildByID(accDoc, "r1");
const r2 = findAccessibleChildByID(accDoc, "r2");
const r3 = findAccessibleChildByID(accDoc, "r3");
const r4 = findAccessibleChildByID(accDoc, "r4");
const r5 = findAccessibleChildByID(accDoc, "r5");
const r6 = findAccessibleChildByID(accDoc, "r6");

await testCachedRelation(r1, RELATION_MEMBER_OF, null);
await testCachedRelation(r2, RELATION_MEMBER_OF, null);
await testCachedRelation(r3, RELATION_MEMBER_OF, [r3, r5]);
await testCachedRelation(r4, RELATION_MEMBER_OF, r4);
await testCachedRelation(r5, RELATION_MEMBER_OF, [r3, r5]);
await testCachedRelation(r6, RELATION_MEMBER_OF, r6);

await invokeContentTask(browser, [], () => {
content.document.getElementById("r5").name = "a";
});

await testCachedRelation(r3, RELATION_MEMBER_OF, r3);
await testCachedRelation(r4, RELATION_MEMBER_OF, [r5, r4]);
await testCachedRelation(r5, RELATION_MEMBER_OF, [r5, r4]);
},
{ chrome: true, iframe: true, remoteIframe: true }
);

/*
* Test MEMBER_OF relation caching on aria radio buttons
*/
addAccessibleTask(
`
<div role="radio" id="r1">I have no radio group</div><br>
<fieldset role="radiogroup">
<div role="radio" id="r2">hello</div><br>
<div role="radio" id="r3">world</div><br>
</fieldset>`,
async function(browser, accDoc) {
const r1 = findAccessibleChildByID(accDoc, "r1");
const r2 = findAccessibleChildByID(accDoc, "r2");
let r3 = findAccessibleChildByID(accDoc, "r3");

await testCachedRelation(r1, RELATION_MEMBER_OF, null);
await testCachedRelation(r2, RELATION_MEMBER_OF, [r2, r3]);
await testCachedRelation(r3, RELATION_MEMBER_OF, [r2, r3]);
const r = waitForEvent(EVENT_REORDER);
await invokeContentTask(browser, [], () => {
let innerRadio = content.document.getElementById("r3");
content.document.body.appendChild(innerRadio);
});
await r;

r3 = findAccessibleChildByID(accDoc, "r3");
await testCachedRelation(r1, RELATION_MEMBER_OF, null);
await testCachedRelation(r2, RELATION_MEMBER_OF, r2);
await testCachedRelation(r3, RELATION_MEMBER_OF, null);
},
{ chrome: true, iframe: true, remoteIframe: true }
);

0 comments on commit 34701ee

Please sign in to comment.