bug 1219528 - add ProxyAccessible::{Next,Prev}Sibling() and ProxyAccessible::{First,Last}Child() r=davidb

This commit is contained in:
Trevor Saunders 2015-10-27 15:27:21 -04:00
parent 5c2750f5a6
commit e9c2a868bb

View File

@ -46,6 +46,21 @@ public:
uint32_t ChildrenCount() const { return mChildren.Length(); }
ProxyAccessible* ChildAt(uint32_t aIdx) const { return mChildren[aIdx]; }
ProxyAccessible* FirstChild() const
{ return mChildren.Length() ? mChildren[0] : nullptr; }
ProxyAccessible* LastChild() const
{ return mChildren.Length() ? mChildren[mChildren.Length() - 1] : nullptr; }
ProxyAccessible* PrevSibling() const
{
size_t idx = IndexInParent();
return idx > 0 ? Parent()->mChildren[idx - 1] : nullptr;
}
ProxyAccessible* NextSibling() const
{
size_t idx = IndexInParent();
return idx < Parent()->mChildren.Length() ? Parent()->mChildren[idx + 1]
: nullptr;
}
// XXX evaluate if this is fast enough.
size_t IndexInParent() const { return Parent()->mChildren.IndexOf(this); }