Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1260277 - remove empty CacheChildren's, r=marcoz
Browse files Browse the repository at this point in the history
  • Loading branch information
asurkov committed Apr 1, 2016
1 parent e291083 commit cd72c69
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 69 deletions.
4 changes: 3 additions & 1 deletion accessible/generic/Accessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2593,7 +2593,9 @@ Accessible::EnsureChildren()

// State is embedded children until text leaf accessible is appended.
SetChildrenFlag(eEmbeddedChildren); // Prevent reentry
CacheChildren();
if (KidsFromDOM()) {
CacheChildren();
}
}

Accessible*
Expand Down
13 changes: 10 additions & 3 deletions accessible/generic/Accessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,13 @@ class Accessible : public nsISupports
* Return true if the accessible doesn't allow accessible children from XBL
* anonymous subtree.
*/
bool NoXBLKids() { return mStateFlags & eNoXBLKids; }
bool NoXBLKids() const { return mStateFlags & eNoXBLKids; }

/**
* Return true if the accessible allows accessible children from subtree of
* a DOM element of this accessible.
*/
bool KidsFromDOM() const { return !(mStateFlags & eNoKidsFromDOM); }

/**
* Return true if this accessible has a parent whose name depends on this
Expand Down Expand Up @@ -1032,8 +1038,9 @@ class Accessible : public nsISupports
eSurvivingInUpdate = 1 << 8, // parent drops children to recollect them
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

eLastStateFlag = eNoXBLKids
eLastStateFlag = eNoKidsFromDOM
};

/**
Expand Down Expand Up @@ -1149,7 +1156,7 @@ class Accessible : public nsISupports
int32_t mIndexInParent;

static const uint8_t kChildrenFlagsBits = 2;
static const uint8_t kStateFlagsBits = 11;
static const uint8_t kStateFlagsBits = 12;
static const uint8_t kContextFlagsBits = 3;
static const uint8_t kTypeBits = 6;
static const uint8_t kGenericTypesBits = 15;
Expand Down
10 changes: 1 addition & 9 deletions accessible/generic/BaseAccessibles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ LeafAccessible::
LeafAccessible(nsIContent* aContent, DocAccessible* aDoc) :
AccessibleWrap(aContent, aDoc)
{
mStateFlags |= eNoKidsFromDOM;
}

NS_IMPL_ISUPPORTS_INHERITED0(LeafAccessible, Accessible)
Expand Down Expand Up @@ -60,15 +61,6 @@ LeafAccessible::IsAcceptableChild(nsIContent* aEl) const
return false;
}

////////////////////////////////////////////////////////////////////////////////
// LeafAccessible: Accessible private

void
LeafAccessible::CacheChildren()
{
// No children for leaf accessible.
}


////////////////////////////////////////////////////////////////////////////////
// LinkableAccessible
Expand Down
3 changes: 0 additions & 3 deletions accessible/generic/BaseAccessibles.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ class LeafAccessible : public AccessibleWrap

protected:
virtual ~LeafAccessible() {}

// Accessible
virtual void CacheChildren() override;
};

/**
Expand Down
3 changes: 2 additions & 1 deletion accessible/generic/DocAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2272,8 +2272,9 @@ DocAccessible::CacheChildrenInSubtree(Accessible* aRoot,
Accessible* child = aRoot->ContentChildAt(idx);
NS_ASSERTION(child, "Illicit tree change while tree is created!");
// Don't cross document boundaries.
if (child && child->IsContent())
if (child && child->IsContent()) {
CacheChildrenInSubtree(child, aFocusedAcc);
}
}

// Fire document load complete on ARIA documents.
Expand Down
7 changes: 1 addition & 6 deletions accessible/generic/TextLeafAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ TextLeafAccessible::
LinkableAccessible(aContent, aDoc)
{
mType = eTextLeafType;
mStateFlags |= eNoKidsFromDOM;
}

TextLeafAccessible::~TextLeafAccessible()
Expand Down Expand Up @@ -50,9 +51,3 @@ TextLeafAccessible::Name(nsString& aName)
aName = mText;
return eNameOK;
}

void
TextLeafAccessible::CacheChildren()
{
// No children for text accessible.
}
4 changes: 0 additions & 4 deletions accessible/generic/TextLeafAccessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ class TextLeafAccessible : public LinkableAccessible
void SetText(const nsAString& aText) { mText = aText; }
const nsString& Text() const { return mText; }

protected:
// Accessible
virtual void CacheChildren() override;

protected:
nsString mText;
};
Expand Down
6 changes: 1 addition & 5 deletions accessible/html/HTMLSelectAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ HTMLComboboxAccessible::
{
mType = eHTMLComboboxType;
mGenericTypes |= eCombobox;
mStateFlags |= eNoKidsFromDOM;

nsIComboboxControlFrame* comboFrame = do_QueryFrame(GetFrame());
if (comboFrame) {
Expand Down Expand Up @@ -369,11 +370,6 @@ HTMLComboboxAccessible::RemoveChild(Accessible* aChild)
return false;
}

void
HTMLComboboxAccessible::CacheChildren()
{
}

void
HTMLComboboxAccessible::Shutdown()
{
Expand Down
3 changes: 0 additions & 3 deletions accessible/html/HTMLSelectAccessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,6 @@ class HTMLComboboxAccessible final : public AccessibleWrap
virtual void SetCurrentItem(Accessible* aItem) override;

protected:
// Accessible
virtual void CacheChildren() override;

/**
* Return selected option.
*/
Expand Down
11 changes: 2 additions & 9 deletions accessible/windows/msaa/HTMLWin32ObjectAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ HTMLWin32ObjectOwnerAccessible::
DocAccessible* aDoc, void* aHwnd) :
AccessibleWrap(aContent, aDoc), mHwnd(aHwnd)
{
mStateFlags |= eNoKidsFromDOM;

// Our only child is a HTMLWin32ObjectAccessible object.
if (mHwnd) {
mNativeAccessible = new HTMLWin32ObjectAccessible(mHwnd, aDoc);
Expand Down Expand Up @@ -50,15 +52,6 @@ HTMLWin32ObjectOwnerAccessible::NativelyUnavailable() const
return !mHwnd;
}

////////////////////////////////////////////////////////////////////////////////
// HTMLWin32ObjectOwnerAccessible: Accessible protected implementation

void
HTMLWin32ObjectOwnerAccessible::CacheChildren()
{
}


////////////////////////////////////////////////////////////////////////////////
// HTMLWin32ObjectAccessible
////////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 0 additions & 4 deletions accessible/windows/msaa/HTMLWin32ObjectAccessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ class HTMLWin32ObjectOwnerAccessible : public AccessibleWrap
virtual bool NativelyUnavailable() const;

protected:

// Accessible
virtual void CacheChildren();

void* mHwnd;
RefPtr<Accessible> mNativeAccessible;
};
Expand Down
9 changes: 1 addition & 8 deletions accessible/xul/XULTreeAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,7 @@ XULTreeItemAccessible::
nsITreeView* aTreeView, int32_t aRow) :
XULTreeItemAccessibleBase(aContent, aDoc, aParent, aTree, aTreeView, aRow)
{
mStateFlags |= eNoKidsFromDOM;
mColumn = nsCoreUtils::GetFirstSensibleColumn(mTree);
GetCellName(mColumn, mCachedName);
}
Expand Down Expand Up @@ -1143,14 +1144,6 @@ XULTreeItemAccessible::RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx)
}
}

////////////////////////////////////////////////////////////////////////////////
// XULTreeItemAccessible: Accessible protected implementation

void
XULTreeItemAccessible::CacheChildren()
{
}


////////////////////////////////////////////////////////////////////////////////
// XULTreeColumAccessible
Expand Down
3 changes: 0 additions & 3 deletions accessible/xul/XULTreeAccessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ class XULTreeItemAccessible : public XULTreeItemAccessibleBase
protected:
virtual ~XULTreeItemAccessible();

// Accessible
virtual void CacheChildren() override;

// XULTreeItemAccessible
nsCOMPtr<nsITreeColumn> mColumn;
nsString mCachedName;
Expand Down
8 changes: 1 addition & 7 deletions accessible/xul/XULTreeGridAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ XULTreeGridRowAccessible::
mAccessibleCache(kDefaultTreeCacheLength)
{
mGenericTypes |= eTableRow;
mStateFlags |= eNoKidsFromDOM;
}

XULTreeGridRowAccessible::~XULTreeGridRowAccessible()
Expand Down Expand Up @@ -409,13 +410,6 @@ XULTreeGridRowAccessible::RowInvalidated(int32_t aStartColIdx,

}

////////////////////////////////////////////////////////////////////////////////
// XULTreeGridRowAccessible: Accessible protected implementation

void
XULTreeGridRowAccessible::CacheChildren()
{
}

////////////////////////////////////////////////////////////////////////////////
// XULTreeGridCellAccessible
Expand Down
3 changes: 0 additions & 3 deletions accessible/xul/XULTreeGridAccessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ class XULTreeGridRowAccessible final : public XULTreeItemAccessibleBase
protected:
virtual ~XULTreeGridRowAccessible();

// Accessible
virtual void CacheChildren() override;

// XULTreeItemAccessibleBase
mutable nsRefPtrHashtable<nsPtrHashKey<const void>, XULTreeGridCellAccessible>
mAccessibleCache;
Expand Down

0 comments on commit cd72c69

Please sign in to comment.