Bug 1250878 - add acceptable child check for HTML select, r=marcoz

This commit is contained in:
Alexander Surkov 2016-02-26 10:25:36 -05:00
parent 0654192ddc
commit 286451f90a
2 changed files with 4 additions and 30 deletions

View File

@ -114,35 +114,12 @@ HTMLSelectListAccessible::SetCurrentItem(Accessible* aItem)
true);
}
////////////////////////////////////////////////////////////////////////////////
// HTMLSelectListAccessible: Accessible protected
void
HTMLSelectListAccessible::CacheChildren()
bool
HTMLSelectListAccessible::IsAcceptableChild(nsIContent* aEl) const
{
// Cache accessibles for <optgroup> and <option> DOM decendents as children,
// as well as the accessibles for them. Avoid whitespace text nodes. We want
// to count all the <optgroup>s and <option>s as children because we want
// a flat tree under the Select List.
for (nsIContent* childContent = mContent->GetFirstChild(); childContent;
childContent = childContent->GetNextSibling()) {
if (!childContent->IsHTMLElement()) {
continue;
}
if (childContent->IsAnyOfHTMLElements(nsGkAtoms::option,
nsGkAtoms::optgroup)) {
// Get an accessible for option or optgroup and cache it.
RefPtr<Accessible> accessible =
GetAccService()->GetOrCreateAccessible(childContent, this);
if (accessible)
AppendChild(accessible);
}
}
return aEl->IsAnyOfHTMLElements(nsGkAtoms::option, nsGkAtoms::optgroup);
}
////////////////////////////////////////////////////////////////////////////////
// HTMLSelectOptionAccessible
////////////////////////////////////////////////////////////////////////////////

View File

@ -51,10 +51,7 @@ public:
virtual Accessible* CurrentItem() override;
virtual void SetCurrentItem(Accessible* aItem) override;
protected:
// Accessible
virtual void CacheChildren() override;
virtual bool IsAcceptableChild(nsIContent* aEl) const override;
};
/*