Bug 737724 - make IsDefunct() inline, r=surkov, f=tbsaunde

This commit is contained in:
Mark Capella 2012-03-29 00:59:01 +09:00
parent 0fcbfbb474
commit 7ae0ec4b19
13 changed files with 150 additions and 110 deletions

View File

@ -116,12 +116,6 @@ void nsAccessNode::LastRelease()
////////////////////////////////////////////////////////////////////////////////
// nsAccessNode public
bool
nsAccessNode::IsDefunct() const
{
return !mContent;
}
bool
nsAccessNode::Init()
{
@ -218,7 +212,7 @@ void nsAccessNode::ShutdownXPAccessibility()
// nsAccessNode protected
nsPresContext* nsAccessNode::GetPresContext()
{
if (IsDefunct())
if (!mDoc)
return nsnull;
nsIPresShell* presShell(mDoc->PresShell());
@ -262,7 +256,7 @@ nsAccessNode::IsPrimaryForNode() const
void
nsAccessNode::ScrollTo(PRUint32 aScrollType)
{
if (IsDefunct())
if (!mDoc)
return;
nsIPresShell* shell = mDoc->PresShell();
@ -288,7 +282,7 @@ nsAccessNode::Language(nsAString& aLanguage)
{
aLanguage.Truncate();
if (IsDefunct())
if (!mDoc)
return;
nsCoreUtils::GetLanguageFor(mContent, nsnull, aLanguage);

View File

@ -105,11 +105,6 @@ public:
*/
virtual void Shutdown();
/**
* Returns true when the accessible is defunct.
*/
virtual bool IsDefunct() const;
/**
* Return frame for the given access node object.
*/

View File

@ -2519,8 +2519,10 @@ nsAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
void
nsAccessible::Shutdown()
{
// Invalidate the child count and pointers to other accessibles, also make
// sure none of its children point to this parent
// Mark the accessible as defunct, invalidate the child count and pointers to
// other accessibles, also make sure none of its children point to this parent
mFlags |= eIsDefunct;
InvalidateChildren();
if (mParent)
mParent->RemoveChild(this);

View File

@ -643,6 +643,11 @@ public:
*/
static void TranslateString(const nsAString& aKey, nsAString& aStringOut);
/**
* Return true if the accessible is defunct.
*/
bool IsDefunct() const { return mFlags & eIsDefunct; }
protected:
//////////////////////////////////////////////////////////////////////////////
@ -687,25 +692,33 @@ protected:
{ mFlags = (mFlags & ~kChildrenFlagsMask) | aFlag; }
/**
* Flags describing the accessible itself.
* Flags used to describe the state of this accessible.
* @note keep these flags in sync with ChildrenFlags
*/
enum StateFlags {
eIsDefunct = 1 << 2 // accessible is defunct
};
/**
* Flags describing the type of this accessible.
* @note keep these flags in sync with ChildrenFlags and StateFlags
*/
enum AccessibleTypes {
eApplicationAccessible = 1 << 2,
eAutoCompleteAccessible = 1 << 3,
eAutoCompletePopupAccessible = 1 << 4,
eComboboxAccessible = 1 << 5,
eDocAccessible = 1 << 6,
eHyperTextAccessible = 1 << 7,
eHTMLFileInputAccessible = 1 << 8,
eHTMLListItemAccessible = 1 << 9,
eImageAccessible = 1 << 10,
eImageMapAccessible = 1 << 11,
eListControlAccessible = 1 << 12,
eMenuButtonAccessible = 1 << 13,
eMenuPopupAccessible = 1 << 14,
eRootAccessible = 1 << 15,
eTextLeafAccessible = 1 << 16
eApplicationAccessible = 1 << 3,
eAutoCompleteAccessible = 1 << 4,
eAutoCompletePopupAccessible = 1 << 5,
eComboboxAccessible = 1 << 6,
eDocAccessible = 1 << 7,
eHyperTextAccessible = 1 << 8,
eHTMLFileInputAccessible = 1 << 9,
eHTMLListItemAccessible = 1 << 10,
eImageAccessible = 1 << 11,
eImageMapAccessible = 1 << 12,
eListControlAccessible = 1 << 13,
eMenuButtonAccessible = 1 << 14,
eMenuPopupAccessible = 1 << 15,
eRootAccessible = 1 << 16,
eTextLeafAccessible = 1 << 17
};
//////////////////////////////////////////////////////////////////////////////

View File

@ -309,12 +309,6 @@ nsApplicationAccessible::GetPlatformVersion(nsAString& aVersion)
////////////////////////////////////////////////////////////////////////////////
// nsAccessNode public methods
bool
nsApplicationAccessible::IsDefunct() const
{
return nsAccessibilityService::IsShutdown();
}
bool
nsApplicationAccessible::Init()
{

View File

@ -98,7 +98,6 @@ public:
NS_DECL_NSIACCESSIBLEAPPLICATION
// nsAccessNode
virtual bool IsDefunct() const;
virtual bool Init();
virtual void Shutdown();
virtual bool IsPrimaryForNode() const;

View File

@ -693,12 +693,6 @@ nsDocAccessible::GetFrame() const
return root;
}
bool
nsDocAccessible::IsDefunct() const
{
return nsHyperTextAccessibleWrap::IsDefunct() || !mDocument;
}
// nsDocAccessible protected member
void nsDocAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aRelativeFrame)
{

View File

@ -116,7 +116,6 @@ public:
virtual bool Init();
virtual void Shutdown();
virtual nsIFrame* GetFrame() const;
virtual bool IsDefunct() const;
virtual nsINode* GetNode() const { return mDocument; }
virtual nsIDocument* GetDocumentNode() const { return mDocument; }

View File

@ -215,10 +215,11 @@ __try{
*aNodeName = nsnull;
*aNodeValue = nsnull;
if (IsDefunct())
nsINode* node = GetNode();
if (!node)
return E_FAIL;
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(GetNode()));
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(node));
PRUint16 nodeType = 0;
DOMNode->GetNodeType(&nodeType);
@ -244,7 +245,7 @@ __try{
// data nodes in their internal object model.
*aUniqueID = - NS_PTR_TO_INT32(UniqueID());
*aNumChildren = GetNode()->GetChildCount();
*aNumChildren = node->GetChildCount();
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return S_OK;
@ -262,7 +263,7 @@ STDMETHODIMP nsAccessNodeWrap::get_attributes(
__try{
*aNumAttribs = 0;
if (IsDefunct() || IsDocumentNode())
if (!mContent || IsDocumentNode())
return E_FAIL;
PRUint32 numAttribs = mContent->GetAttrCount();
@ -293,7 +294,7 @@ STDMETHODIMP nsAccessNodeWrap::get_attributesForNames(
/* [length_is][size_is][retval] */ BSTR __RPC_FAR *aAttribValues)
{
__try {
if (IsDefunct() || !IsElement())
if (!mContent || !IsElement())
return E_FAIL;
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(mContent));
@ -335,7 +336,7 @@ STDMETHODIMP nsAccessNodeWrap::get_computedStyle(
__try{
*aNumStyleProperties = 0;
if (IsDefunct() || IsDocumentNode())
if (!mContent || IsDocumentNode())
return E_FAIL;
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl =
@ -370,7 +371,7 @@ STDMETHODIMP nsAccessNodeWrap::get_computedStyleForProperties(
/* [length_is][size_is][out] */ BSTR __RPC_FAR *aStyleValues)
{
__try {
if (IsDefunct() || IsDocumentNode())
if (!mContent || IsDocumentNode())
return E_FAIL;
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl =
@ -442,10 +443,11 @@ nsAccessNodeWrap::MakeAccessNode(nsINode *aNode)
STDMETHODIMP nsAccessNodeWrap::get_parentNode(ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
{
__try {
if (IsDefunct())
nsINode* node = GetNode();
if (!node)
return E_FAIL;
*aNode = MakeAccessNode(GetNode()->GetNodeParent());
*aNode = MakeAccessNode(node->GetNodeParent());
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
@ -455,10 +457,11 @@ __try {
STDMETHODIMP nsAccessNodeWrap::get_firstChild(ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
{
__try {
if (IsDefunct())
nsINode* node = GetNode();
if (!node)
return E_FAIL;
*aNode = MakeAccessNode(GetNode()->GetFirstChild());
*aNode = MakeAccessNode(node->GetFirstChild());
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
@ -468,10 +471,11 @@ __try {
STDMETHODIMP nsAccessNodeWrap::get_lastChild(ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
{
__try {
if (IsDefunct())
nsINode* node = GetNode();
if (!node)
return E_FAIL;
*aNode = MakeAccessNode(GetNode()->GetLastChild());
*aNode = MakeAccessNode(node->GetLastChild());
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
@ -481,10 +485,11 @@ __try {
STDMETHODIMP nsAccessNodeWrap::get_previousSibling(ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
{
__try {
if (IsDefunct())
nsINode* node = GetNode();
if (!node)
return E_FAIL;
*aNode = MakeAccessNode(GetNode()->GetPreviousSibling());
*aNode = MakeAccessNode(node->GetPreviousSibling());
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
@ -494,10 +499,11 @@ __try {
STDMETHODIMP nsAccessNodeWrap::get_nextSibling(ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
{
__try {
if (IsDefunct())
nsINode* node = GetNode();
if (!node)
return E_FAIL;
*aNode = MakeAccessNode(GetNode()->GetNextSibling());
*aNode = MakeAccessNode(node->GetNextSibling());
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
@ -511,10 +517,11 @@ nsAccessNodeWrap::get_childAt(unsigned aChildIndex,
__try {
*aNode = nsnull;
if (IsDefunct())
nsINode* node = GetNode();
if (!node)
return E_FAIL;
*aNode = MakeAccessNode(GetNode()->GetChildAt(aChildIndex));
*aNode = MakeAccessNode(node->GetChildAt(aChildIndex));
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }

View File

@ -124,6 +124,9 @@ nsXULTreeAccessible::NativeState()
state |= states::READONLY;
// multiselectable state.
if (!mTreeView)
return state;
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
NS_ENSURE_TRUE(selection, state);
@ -145,7 +148,7 @@ nsXULTreeAccessible::GetValue(nsAString& aValue)
aValue.Truncate();
if (IsDefunct())
if (IsDefunct() || !mTreeView)
return NS_ERROR_FAILURE;
nsCOMPtr<nsITreeSelection> selection;
@ -173,12 +176,6 @@ nsXULTreeAccessible::GetValue(nsAString& aValue)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeAccessible: nsAccessNode implementation
bool
nsXULTreeAccessible::IsDefunct() const
{
return nsAccessibleWrap::IsDefunct() || !mTree || !mTreeView;
}
void
nsXULTreeAccessible::Shutdown()
{
@ -270,6 +267,9 @@ nsXULTreeAccessible::IsSelect()
nsAccessible*
nsXULTreeAccessible::CurrentItem()
{
if (!mTreeView)
return nsnull;
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
if (selection) {
@ -291,6 +291,9 @@ nsXULTreeAccessible::SetCurrentItem(nsAccessible* aItem)
already_AddRefed<nsIArray>
nsXULTreeAccessible::SelectedItems()
{
if (!mTreeView)
return nsnull;
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
if (!selection)
@ -321,6 +324,9 @@ nsXULTreeAccessible::SelectedItems()
PRUint32
nsXULTreeAccessible::SelectedItemCount()
{
if (!mTreeView)
return 0;
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
if (selection) {
@ -335,6 +341,9 @@ nsXULTreeAccessible::SelectedItemCount()
bool
nsXULTreeAccessible::AddItemToSelection(PRUint32 aIndex)
{
if (!mTreeView)
return false;
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
if (selection) {
@ -351,6 +360,9 @@ nsXULTreeAccessible::AddItemToSelection(PRUint32 aIndex)
bool
nsXULTreeAccessible::RemoveItemFromSelection(PRUint32 aIndex)
{
if (!mTreeView)
return false;
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
if (selection) {
@ -367,6 +379,9 @@ nsXULTreeAccessible::RemoveItemFromSelection(PRUint32 aIndex)
bool
nsXULTreeAccessible::IsItemSelected(PRUint32 aIndex)
{
if (!mTreeView)
return false;
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
if (selection) {
@ -380,6 +395,9 @@ nsXULTreeAccessible::IsItemSelected(PRUint32 aIndex)
bool
nsXULTreeAccessible::UnselectAll()
{
if (!mTreeView)
return false;
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
if (!selection)
@ -392,6 +410,9 @@ nsXULTreeAccessible::UnselectAll()
nsAccessible*
nsXULTreeAccessible::GetSelectedItem(PRUint32 aIndex)
{
if (!mTreeView)
return nsnull;
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
if (!selection)
@ -418,6 +439,9 @@ bool
nsXULTreeAccessible::SelectAll()
{
// see if we are multiple select if so set ourselves as such
if (!mTreeView)
return false;
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
if (selection) {
@ -453,8 +477,8 @@ nsXULTreeAccessible::GetChildCount()
{
// tree's children count is row count + treecols count.
PRInt32 childCount = nsAccessible::GetChildCount();
if (childCount == -1)
return -1;
if (childCount == -1 || !mTreeView)
return childCount;
PRInt32 rowCount = 0;
mTreeView->GetRowCount(&rowCount);
@ -536,7 +560,7 @@ nsXULTreeAccessible::ContainerWidget() const
nsAccessible*
nsXULTreeAccessible::GetTreeItemAccessible(PRInt32 aRow)
{
if (aRow < 0 || IsDefunct())
if (aRow < 0 || IsDefunct() || !mTreeView)
return nsnull;
PRInt32 rowCount = 0;
@ -793,7 +817,7 @@ nsXULTreeItemAccessibleBase::GetBounds(PRInt32 *aX, PRInt32 *aY,
NS_IMETHODIMP
nsXULTreeItemAccessibleBase::SetSelected(bool aSelect)
{
if (IsDefunct())
if (IsDefunct() || !mTreeView)
return NS_ERROR_FAILURE;
nsCOMPtr<nsITreeSelection> selection;
@ -811,7 +835,7 @@ nsXULTreeItemAccessibleBase::SetSelected(bool aSelect)
NS_IMETHODIMP
nsXULTreeItemAccessibleBase::TakeFocus()
{
if (IsDefunct())
if (IsDefunct() || !mTreeView)
return NS_ERROR_FAILURE;
nsCOMPtr<nsITreeSelection> selection;
@ -826,10 +850,13 @@ nsXULTreeItemAccessibleBase::TakeFocus()
Relation
nsXULTreeItemAccessibleBase::RelationByType(PRUint32 aType)
{
if (!mTreeView)
return Relation();
if (aType != nsIAccessibleRelation::RELATION_NODE_CHILD_OF)
return Relation();
PRInt32 parentIndex;
PRInt32 parentIndex = -1;
if (!NS_SUCCEEDED(mTreeView->GetParentIndex(mRow, &parentIndex)))
return Relation();
@ -890,12 +917,6 @@ nsXULTreeItemAccessibleBase::DoAction(PRUint8 aIndex)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeItemAccessibleBase: nsAccessNode implementation
bool
nsXULTreeItemAccessibleBase::IsDefunct() const
{
return nsAccessibleWrap::IsDefunct() || !mTree || !mTreeView || mRow < 0;
}
void
nsXULTreeItemAccessibleBase::Shutdown()
{
@ -930,7 +951,7 @@ nsXULTreeItemAccessibleBase::GroupPosition(PRInt32 *aGroupLevel,
NS_ENSURE_ARG_POINTER(aPositionInGroup);
*aPositionInGroup = 0;
if (IsDefunct())
if (IsDefunct() || !mTreeView)
return NS_ERROR_FAILURE;
PRInt32 level;
@ -978,6 +999,9 @@ nsXULTreeItemAccessibleBase::GroupPosition(PRInt32 *aGroupLevel,
PRUint64
nsXULTreeItemAccessibleBase::NativeState()
{
if (!mTreeView)
return states::DEFUNCT;
// focusable and selectable states
PRUint64 state = states::FOCUSABLE | states::SELECTABLE;
@ -1075,6 +1099,9 @@ nsXULTreeItemAccessibleBase::GetSiblingAtOffset(PRInt32 aOffset,
bool
nsXULTreeItemAccessibleBase::IsExpandable()
{
if (!mTreeView)
return false;
bool isContainer = false;
mTreeView->IsContainer(mRow, &isContainer);
if (isContainer) {
@ -1100,6 +1127,9 @@ void
nsXULTreeItemAccessibleBase::GetCellName(nsITreeColumn* aColumn,
nsAString& aName)
{
if (!mTreeView)
return;
mTreeView->GetCellText(mRow, aColumn, aName);
// If there is still no name try the cell value:
@ -1164,12 +1194,6 @@ nsXULTreeItemAccessible::GetName(nsAString& aName)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeItemAccessible: nsAccessNode implementation
bool
nsXULTreeItemAccessible::IsDefunct() const
{
return nsXULTreeItemAccessibleBase::IsDefunct() || !mColumn;
}
bool
nsXULTreeItemAccessible::Init()
{

View File

@ -78,7 +78,6 @@ public:
NS_IMETHOD GetValue(nsAString& aValue);
// nsAccessNode
virtual bool IsDefunct() const;
virtual void Shutdown();
// nsAccessible
@ -204,7 +203,6 @@ public:
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsAccessNode
virtual bool IsDefunct() const;
virtual void Shutdown();
virtual bool IsPrimaryForNode() const;
@ -287,7 +285,6 @@ public:
NS_IMETHOD GetName(nsAString& aName);
// nsAccessNode
virtual bool IsDefunct() const;
virtual bool Init();
virtual void Shutdown();

View File

@ -93,15 +93,18 @@ nsXULTreeGridAccessible::GetColumnCount(PRInt32 *aColumnCount)
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetRowCount(PRInt32 *arowCount)
nsXULTreeGridAccessible::GetRowCount(PRInt32* aRowCount)
{
NS_ENSURE_ARG_POINTER(arowCount);
*arowCount = nsnull;
NS_ENSURE_ARG_POINTER(aRowCount);
*aRowCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
return mTreeView->GetRowCount(arowCount);
if (!mTreeView)
return NS_OK;
return mTreeView->GetRowCount(aRowCount);
}
NS_IMETHODIMP
@ -176,6 +179,9 @@ nsXULTreeGridAccessible::GetSelectedCells(nsIArray **aCells)
NS_ENSURE_ARG_POINTER(aCells);
*aCells = nsnull;
if (!mTreeView)
return NS_OK;
nsCOMPtr<nsIMutableArray> selCells = do_CreateInstance(NS_ARRAY_CONTRACTID);
NS_ENSURE_TRUE(selCells, NS_ERROR_FAILURE);
@ -220,6 +226,9 @@ nsXULTreeGridAccessible::GetSelectedCellIndices(PRUint32 *aCellsCount,
NS_ENSURE_ARG_POINTER(aCells);
*aCells = nsnull;
if (!mTreeView)
return NS_OK;
PRInt32 selectedrowCount = 0;
nsresult rv = GetSelectionCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
@ -309,6 +318,9 @@ nsXULTreeGridAccessible::GetSelectedRowIndices(PRUint32 *arowCount,
if (IsDefunct())
return NS_ERROR_FAILURE;
if (!mTreeView)
return NS_OK;
PRInt32 selectedrowCount = 0;
nsresult rv = GetSelectionCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
@ -515,6 +527,9 @@ nsXULTreeGridAccessible::IsRowSelected(PRInt32 aRowIndex, bool *aIsSelected)
if (IsDefunct())
return NS_ERROR_FAILURE;
if (!mTreeView)
return NS_ERROR_INVALID_ARG;
nsCOMPtr<nsITreeSelection> selection;
nsresult rv = mTreeView->GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(rv, rv);
@ -532,6 +547,9 @@ nsXULTreeGridAccessible::IsCellSelected(PRInt32 aRowIndex, PRInt32 aColumnIndex,
NS_IMETHODIMP
nsXULTreeGridAccessible::SelectRow(PRInt32 aRowIndex)
{
if (!mTreeView)
return NS_ERROR_INVALID_ARG;
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
NS_ENSURE_STATE(selection);
@ -548,6 +566,9 @@ nsXULTreeGridAccessible::SelectColumn(PRInt32 aColumnIndex)
NS_IMETHODIMP
nsXULTreeGridAccessible::UnselectRow(PRInt32 aRowIndex)
{
if (!mTreeView)
return NS_ERROR_INVALID_ARG;
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
NS_ENSURE_STATE(selection);
@ -854,7 +875,7 @@ nsXULTreeGridCellAccessible::GetName(nsAString& aName)
{
aName.Truncate();
if (IsDefunct())
if (IsDefunct() || !mTreeView)
return NS_ERROR_FAILURE;
mTreeView->GetCellText(mRow, mColumn, aName);
@ -936,7 +957,7 @@ nsXULTreeGridCellAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
if (aIndex != eAction_Click)
return NS_ERROR_INVALID_ARG;
if (IsDefunct())
if (IsDefunct() || !mTreeView)
return NS_ERROR_FAILURE;
bool isCycler = false;
@ -1103,7 +1124,7 @@ nsXULTreeGridCellAccessible::IsSelected(bool *aIsSelected)
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = false;
if (IsDefunct())
if (IsDefunct() || !mTreeView)
return NS_ERROR_FAILURE;
nsCOMPtr<nsITreeSelection> selection;
@ -1116,17 +1137,10 @@ nsXULTreeGridCellAccessible::IsSelected(bool *aIsSelected)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridCellAccessible: nsAccessNode implementation
bool
nsXULTreeGridCellAccessible::IsDefunct() const
{
return nsLeafAccessible::IsDefunct() || !mParent || !mTree || !mTreeView ||
!mColumn;
}
bool
nsXULTreeGridCellAccessible::Init()
{
if (!nsLeafAccessible::Init())
if (!nsLeafAccessible::Init() || !mTreeView)
return false;
PRInt16 type;
@ -1196,6 +1210,9 @@ nsXULTreeGridCellAccessible::NativeRole()
PRUint64
nsXULTreeGridCellAccessible::NativeState()
{
if (!mTreeView)
return states::DEFUNCT;
// selectable/selected state
PRUint64 states = states::SELECTABLE;
@ -1255,6 +1272,9 @@ nsXULTreeGridCellAccessible::GetColumnIndex() const
void
nsXULTreeGridCellAccessible::CellInvalidated()
{
if (!mTreeView)
return;
nsAutoString textEquiv;
PRInt16 type;
@ -1326,6 +1346,9 @@ nsXULTreeGridCellAccessible::DispatchClickEvent(nsIContent *aContent,
bool
nsXULTreeGridCellAccessible::IsEditable() const
{
if (!mTreeView)
return false;
// XXX: logic corresponds to tree.xml, it's preferable to have interface
// method to check it.
bool isEditable = false;

View File

@ -161,7 +161,6 @@ public:
NS_DECL_NSIACCESSIBLETABLECELL
// nsAccessNode
virtual bool IsDefunct() const;
virtual bool Init();
virtual bool IsPrimaryForNode() const;