mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-23 19:09:49 +00:00
Bug 1261165 - remove Accessible::ChildrenFlags, r=yzen
This commit is contained in:
parent
68c2287471
commit
167cbebba2
@ -107,7 +107,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(Accessible, LastRelease())
|
||||
|
||||
Accessible::Accessible(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
mContent(aContent), mDoc(aDoc),
|
||||
mParent(nullptr), mIndexInParent(-1), mChildrenFlags(eChildrenUninitialized),
|
||||
mParent(nullptr), mIndexInParent(-1),
|
||||
mStateFlags(0), mContextFlags(0), mType(0), mGenericTypes(0),
|
||||
mRoleMapEntry(nullptr)
|
||||
{
|
||||
@ -2074,8 +2074,9 @@ Accessible::InsertChildAt(uint32_t aIndex, Accessible* aChild)
|
||||
MOZ_ASSERT(mStateFlags & eKidsMutating, "Illicit children change");
|
||||
}
|
||||
|
||||
if (!nsAccUtils::IsEmbeddedObject(aChild))
|
||||
SetChildrenFlag(eMixedChildren);
|
||||
if (!nsAccUtils::IsEmbeddedObject(aChild)) {
|
||||
mStateFlags |= eHasTextKids;
|
||||
}
|
||||
|
||||
aChild->BindToParent(this, aIndex);
|
||||
return true;
|
||||
@ -2180,7 +2181,7 @@ Accessible::IndexInParent() const
|
||||
uint32_t
|
||||
Accessible::EmbeddedChildCount()
|
||||
{
|
||||
if (IsChildrenFlag(eMixedChildren)) {
|
||||
if (mStateFlags & eHasTextKids) {
|
||||
if (!mEmbeddedObjCollector)
|
||||
mEmbeddedObjCollector = new EmbeddedObjCollector(this);
|
||||
return mEmbeddedObjCollector->Count();
|
||||
@ -2192,7 +2193,7 @@ Accessible::EmbeddedChildCount()
|
||||
Accessible*
|
||||
Accessible::GetEmbeddedChildAt(uint32_t aIndex)
|
||||
{
|
||||
if (IsChildrenFlag(eMixedChildren)) {
|
||||
if (mStateFlags & eHasTextKids) {
|
||||
if (!mEmbeddedObjCollector)
|
||||
mEmbeddedObjCollector = new EmbeddedObjCollector(this);
|
||||
return mEmbeddedObjCollector ?
|
||||
@ -2205,7 +2206,7 @@ Accessible::GetEmbeddedChildAt(uint32_t aIndex)
|
||||
int32_t
|
||||
Accessible::GetIndexOfEmbeddedChild(Accessible* aChild)
|
||||
{
|
||||
if (IsChildrenFlag(eMixedChildren)) {
|
||||
if (mStateFlags & eHasTextKids) {
|
||||
if (!mEmbeddedObjCollector)
|
||||
mEmbeddedObjCollector = new EmbeddedObjCollector(this);
|
||||
return mEmbeddedObjCollector ?
|
||||
@ -2524,8 +2525,6 @@ Accessible::TestChildCache(Accessible* aCachedChild) const
|
||||
#ifdef DEBUG
|
||||
int32_t childCount = mChildren.Length();
|
||||
if (childCount == 0) {
|
||||
NS_ASSERTION(IsChildrenFlag(eChildrenUninitialized),
|
||||
"No children but initialized!");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2709,8 +2708,6 @@ Accessible::GetLevelInternal()
|
||||
void
|
||||
Accessible::StaticAsserts() const
|
||||
{
|
||||
static_assert(eLastChildrenFlag <= (1 << kChildrenFlagsBits) - 1,
|
||||
"Accessible::mChildrenFlags was oversized by eLastChildrenFlag!");
|
||||
static_assert(eLastStateFlag <= (1 << kStateFlagsBits) - 1,
|
||||
"Accessible::mStateFlags was oversized by eLastStateFlag!");
|
||||
static_assert(eLastAccType <= (1 << kTypeBits) - 1,
|
||||
|
@ -469,12 +469,6 @@ public:
|
||||
Accessible* ContentChildAt(uint32_t aIndex) const
|
||||
{ return mChildren.ElementAt(aIndex); }
|
||||
|
||||
/**
|
||||
* Return true if children were initialized.
|
||||
*/
|
||||
inline bool AreChildrenCached() const
|
||||
{ return !IsChildrenFlag(eChildrenUninitialized); }
|
||||
|
||||
/**
|
||||
* Return true if the accessible is attached to tree.
|
||||
*/
|
||||
@ -990,31 +984,8 @@ protected:
|
||||
virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
|
||||
nsresult *aError = nullptr) const;
|
||||
|
||||
/**
|
||||
* Flags used to describe the state and type of children.
|
||||
*/
|
||||
enum ChildrenFlags {
|
||||
eChildrenUninitialized = 0, // children aren't initialized
|
||||
eMixedChildren = 1 << 0, // text leaf children are presented
|
||||
eEmbeddedChildren = 1 << 1, // all children are embedded objects
|
||||
|
||||
eLastChildrenFlag = eEmbeddedChildren
|
||||
};
|
||||
|
||||
/**
|
||||
* Return true if the children flag is set.
|
||||
*/
|
||||
bool IsChildrenFlag(ChildrenFlags aFlag) const
|
||||
{ return static_cast<ChildrenFlags>(mChildrenFlags) == aFlag; }
|
||||
|
||||
/**
|
||||
* Set children flag.
|
||||
*/
|
||||
void SetChildrenFlag(ChildrenFlags aFlag) { mChildrenFlags = aFlag; }
|
||||
|
||||
/**
|
||||
* Flags used to describe the state of this accessible.
|
||||
* @note keep these flags in sync with ChildrenFlags
|
||||
*/
|
||||
enum StateFlags {
|
||||
eIsDefunct = 1 << 0, // accessible is defunct
|
||||
@ -1029,6 +1000,7 @@ protected:
|
||||
eRelocated = 1 << 9, // accessible was moved in tree
|
||||
eNoXBLKids = 1 << 10, // accessible don't allows XBL children
|
||||
eNoKidsFromDOM = 1 << 11, // accessible doesn't allow children from DOM
|
||||
eHasTextKids = 1 << 12, // accessible have a text leaf in children
|
||||
|
||||
eLastStateFlag = eNoKidsFromDOM
|
||||
};
|
||||
@ -1129,16 +1101,14 @@ protected:
|
||||
nsTArray<RefPtr<Accessible> > mChildren;
|
||||
int32_t mIndexInParent;
|
||||
|
||||
static const uint8_t kChildrenFlagsBits = 2;
|
||||
static const uint8_t kStateFlagsBits = 12;
|
||||
static const uint8_t kStateFlagsBits = 13;
|
||||
static const uint8_t kContextFlagsBits = 3;
|
||||
static const uint8_t kTypeBits = 6;
|
||||
static const uint8_t kGenericTypesBits = 15;
|
||||
|
||||
/**
|
||||
* Keep in sync with ChildrenFlags, StateFlags, ContextFlags, and AccTypes.
|
||||
* Keep in sync with StateFlags, ContextFlags, and AccTypes.
|
||||
*/
|
||||
uint32_t mChildrenFlags : kChildrenFlagsBits;
|
||||
uint32_t mStateFlags : kStateFlagsBits;
|
||||
uint32_t mContextFlags : kContextFlagsBits;
|
||||
uint32_t mType : kTypeBits;
|
||||
|
@ -678,11 +678,11 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
AccessibleWrap* accWrap = [self getGeckoAccessible];
|
||||
if (mChildren || (accWrap && !accWrap->AreChildrenCached()))
|
||||
if (mChildren)
|
||||
return mChildren;
|
||||
|
||||
// get the array of children.
|
||||
AccessibleWrap* accWrap = [self getGeckoAccessible];
|
||||
if (accWrap) {
|
||||
AutoTArray<Accessible*, 10> childrenArray;
|
||||
accWrap->GetUnignoredChildren(&childrenArray);
|
||||
|
Loading…
x
Reference in New Issue
Block a user