bug 673403 - check return of GetParent() and rename to Parent() r=surkov

This commit is contained in:
Trevor Saunders
2011-07-23 01:38:33 -07:00
parent 39bdd11fe5
commit d6e71fe9f3
25 changed files with 138 additions and 123 deletions

View File

@@ -826,21 +826,20 @@ getAttributesCB(AtkObject *aAtkObj)
AtkObject *
getParentCB(AtkObject *aAtkObj)
{
if (!aAtkObj->accessible_parent) {
nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap) {
return nsnull;
}
if (!aAtkObj->accessible_parent) {
nsAccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
if (!accWrap)
return nsnull;
nsAccessible* accParent = accWrap->GetParent();
if (!accParent)
return nsnull;
nsAccessible* accParent = accWrap->Parent();
if (!accParent)
return nsnull;
AtkObject *parent = nsAccessibleWrap::GetAtkObject(accParent);
if (parent)
atk_object_set_parent(aAtkObj, parent);
}
return aAtkObj->accessible_parent;
AtkObject* parent = nsAccessibleWrap::GetAtkObject(accParent);
if (parent)
atk_object_set_parent(aAtkObj, parent);
}
return aAtkObj->accessible_parent;
}
gint
@@ -893,10 +892,9 @@ getIndexInParentCB(AtkObject *aAtkObj)
return -1;
}
nsAccessible *parent = accWrap->GetParent();
if (!parent) {
nsAccessible* parent = accWrap->Parent();
if (!parent)
return -1; // No parent
}
return parent->GetIndexOfEmbeddedChild(accWrap);
}

View File

@@ -123,7 +123,7 @@ getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
if (!keyBinding.IsEmpty()) {
keyBinding.AppendToString(keyBindingsStr, KeyBinding::eAtkFormat);
nsAccessible* parent = acc->GetParent();
nsAccessible* parent = acc->Parent();
PRUint32 role = parent ? parent->Role() : 0;
if (role == nsIAccessibleRole::ROLE_PARENT_MENUITEM ||
role == nsIAccessibleRole::ROLE_MENUITEM ||
@@ -141,7 +141,7 @@ getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
keysInHierarchyStr.Insert(str, 0);
}
} while ((parent = parent->GetParent()) &&
} while ((parent = parent->Parent()) &&
parent->Role() != nsIAccessibleRole::ROLE_MENUBAR);
keyBindingsStr.Append(';');

View File

@@ -312,7 +312,7 @@ AccHideEvent::
AccHideEvent(nsAccessible* aTarget, nsINode* aTargetNode) :
AccMutationEvent(::nsIAccessibleEvent::EVENT_HIDE, aTarget, aTargetNode)
{
mParent = mAccessible->GetParent();
mParent = mAccessible->Parent();
mNextSibling = mAccessible->NextSibling();
mPrevSibling = mAccessible->PrevSibling();
}

View File

@@ -43,7 +43,7 @@ AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
mPosInSet(0), mSetSize(0), mParent(nsnull)
{
MOZ_COUNT_CTOR(AccGroupInfo);
nsAccessible* parent = aItem->GetParent();
nsAccessible* parent = aItem->Parent();
if (!parent)
return;

View File

@@ -374,8 +374,8 @@ NotificationController::CoalesceEvents()
return;
}
} else if (tailEvent->mEventType == nsIAccessibleEvent::EVENT_SHOW) {
if (thisEvent->mAccessible->GetParent() ==
tailEvent->mAccessible->GetParent()) {
if (thisEvent->mAccessible->Parent() ==
tailEvent->mAccessible->Parent()) {
tailEvent->mEventRule = thisEvent->mEventRule;
// Coalesce text change events for show events.

View File

@@ -69,11 +69,9 @@ void
TextUpdater::DoUpdate(const nsAString& aNewText, const nsAString& aOldText,
PRUint32 aSkipStart)
{
nsAccessible* parent = mTextLeaf->GetParent();
if (!parent) {
NS_ERROR("No parent for text leaf!");
nsAccessible* parent = mTextLeaf->Parent();
if (!parent)
return;
}
mHyperText = parent->AsHyperText();
if (!mHyperText) {

View File

@@ -830,7 +830,7 @@ nsARIAGridAccessible::SetARIASelected(nsAccessible *aAccessible,
if (role == nsIAccessibleRole::ROLE_GRID_CELL ||
role == nsIAccessibleRole::ROLE_ROWHEADER ||
role == nsIAccessibleRole::ROLE_COLUMNHEADER) {
nsAccessible *row = aAccessible->GetParent();
nsAccessible* row = aAccessible->Parent();
if (row && row->Role() == nsIAccessibleRole::ROLE_ROW &&
nsAccUtils::IsARIASelected(row)) {
@@ -949,11 +949,11 @@ nsARIAGridCellAccessible::GetTable(nsIAccessibleTable **aTable)
NS_ENSURE_ARG_POINTER(aTable);
*aTable = nsnull;
nsAccessible* thisRow = GetParent();
nsAccessible* thisRow = Parent();
if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
nsAccessible* table = thisRow->GetParent();
nsAccessible* table = thisRow->Parent();
if (!table)
return NS_OK;
@@ -975,7 +975,7 @@ nsARIAGridCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible* row = GetParent();
nsAccessible* row = Parent();
if (!row)
return NS_OK;
@@ -1003,11 +1003,11 @@ nsARIAGridCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible* row = GetParent();
nsAccessible* row = Parent();
if (!row)
return NS_OK;
nsAccessible* table = row->GetParent();
nsAccessible* table = row->Parent();
if (!table)
return NS_OK;
@@ -1096,7 +1096,7 @@ nsARIAGridCellAccessible::IsSelected(PRBool *aIsSelected)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible *row = GetParent();
nsAccessible* row = Parent();
if (!row || row->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
@@ -1120,7 +1120,7 @@ nsARIAGridCellAccessible::ApplyARIAState(PRUint64* aState)
return;
// Check aria-selected="true" on the row.
nsAccessible* row = GetParent();
nsAccessible* row = Parent();
if (!row || row->Role() != nsIAccessibleRole::ROLE_ROW)
return;
@@ -1144,7 +1144,7 @@ nsARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttrib
// Expose "table-cell-index" attribute.
nsAccessible* thisRow = GetParent();
nsAccessible* thisRow = Parent();
if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
@@ -1162,7 +1162,7 @@ nsARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttrib
colCount++;
}
nsAccessible* table = thisRow->GetParent();
nsAccessible* table = thisRow->Parent();
if (!table)
return NS_OK;

View File

@@ -108,7 +108,7 @@ nsAccUtils::GetDefaultLevel(nsAccessible *aAccessible)
return 1;
if (role == nsIAccessibleRole::ROLE_ROW) {
nsAccessible *parent = aAccessible->GetParent();
nsAccessible* parent = aAccessible->Parent();
if (parent && parent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE) {
// It is a row inside flatten treegrid. Group level is always 1 until it
// is overriden by aria-level attribute.
@@ -338,7 +338,7 @@ nsAccUtils::GetAncestorWithRole(nsAccessible *aDescendant, PRUint32 aRole)
{
nsAccessible *document = aDescendant->GetDocAccessible();
nsAccessible *parent = aDescendant;
while ((parent = parent->GetParent())) {
while ((parent = parent->Parent())) {
PRUint32 testRole = parent->Role();
if (testRole == aRole)
return parent;
@@ -359,7 +359,7 @@ nsAccUtils::GetSelectableContainer(nsAccessible* aAccessible, PRUint64 aState)
return nsnull;
nsAccessible* parent = aAccessible;
while ((parent = parent->GetParent()) && !parent->IsSelect()) {
while ((parent = parent->Parent()) && !parent->IsSelect()) {
if (Role(parent) == nsIAccessibleRole::ROLE_PANE)
return nsnull;
}
@@ -420,7 +420,7 @@ nsAccUtils::GetTextAccessibleFromSelection(nsISelection* aSelection)
if (textAcc)
return textAcc;
} while (accessible = accessible->GetParent());
} while (accessible = accessible->Parent());
NS_NOTREACHED("We must reach document accessible implementing nsIAccessibleText!");
return nsnull;

View File

@@ -421,8 +421,10 @@ NS_IMETHODIMP
nsAccessible::GetParent(nsIAccessible **aParent)
{
NS_ENSURE_ARG_POINTER(aParent);
if (IsDefunct())
return NS_ERROR_FAILURE;
NS_IF_ADDREF(*aParent = GetParent());
NS_IF_ADDREF(*aParent = Parent());
return *aParent ? NS_OK : NS_ERROR_FAILURE;
}
@@ -729,7 +731,7 @@ nsAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
}
else if (gLastFocusedNode) {
focusedChild = GetAccService()->GetAccessible(gLastFocusedNode);
if (focusedChild && focusedChild->GetParent() != this)
if (focusedChild && focusedChild->Parent() != this)
focusedChild = nsnull;
}
@@ -819,7 +821,7 @@ nsAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
// ensure obtained accessible is a child of this accessible.
nsAccessible* child = accessible;
while (true) {
nsAccessible* parent = child->GetParent();
nsAccessible* parent = child->Parent();
if (!parent) {
// Reached the top of the hierarchy. These bounds were inside an
// accessible that is not a descendant of this one.
@@ -2140,9 +2142,8 @@ nsAccessible::GetRelationByType(PRUint32 aRelationType,
nsIView *view = frame->GetViewExternal();
if (view) {
nsIScrollableFrame *scrollFrame = do_QueryFrame(frame);
if (scrollFrame || view->GetWidget() || !frame->GetParent()) {
return nsRelUtils::AddTarget(aRelationType, aRelation, GetParent());
}
if (scrollFrame || view->GetWidget() || !frame->GetParent())
return nsRelUtils::AddTarget(aRelationType, aRelation, Parent());
}
}
@@ -2615,7 +2616,7 @@ nsAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
if (frame->GetType() == nsAccessibilityAtoms::brFrame) {
aText += kForcedNewLineChar;
} else if (nsAccUtils::MustPrune(GetParent())) {
} else if (nsAccUtils::MustPrune(Parent())) {
// Expose the embedded object accessible as imaginary embedded object
// character if its parent hypertext accessible doesn't expose children to
// AT.
@@ -3257,16 +3258,18 @@ nsAccessible::GetLevelInternal()
{
PRInt32 level = nsAccUtils::GetDefaultLevel(this);
PRUint32 role = Role();
nsAccessible* parent = GetParent();
if (!IsBoundToParent())
return level;
PRUint32 role = Role();
if (role == nsIAccessibleRole::ROLE_OUTLINEITEM) {
// Always expose 'level' attribute for 'outlineitem' accessible. The number
// of nested 'grouping' accessibles containing 'outlineitem' accessible is
// its level.
level = 1;
while (parent) {
nsAccessible* parent = this;
while ((parent = parent->Parent())) {
PRUint32 parentRole = parent->Role();
if (parentRole == nsIAccessibleRole::ROLE_OUTLINE)
@@ -3274,7 +3277,6 @@ nsAccessible::GetLevelInternal()
if (parentRole == nsIAccessibleRole::ROLE_GROUPING)
++ level;
parent = parent->GetParent();
}
} else if (role == nsIAccessibleRole::ROLE_LISTITEM) {
@@ -3285,8 +3287,8 @@ nsAccessible::GetLevelInternal()
// Calculate 'level' attribute based on number of parent listitems.
level = 0;
while (parent) {
nsAccessible* parent = this;
while ((parent = parent->Parent())) {
PRUint32 parentRole = parent->Role();
if (parentRole == nsIAccessibleRole::ROLE_LISTITEM)
@@ -3294,23 +3296,20 @@ nsAccessible::GetLevelInternal()
else if (parentRole != nsIAccessibleRole::ROLE_LIST)
break;
parent = parent->GetParent();
}
if (level == 0) {
// If this listitem is on top of nested lists then expose 'level'
// attribute.
nsAccessible* parent(GetParent());
parent = Parent();
PRInt32 siblingCount = parent->GetChildCount();
for (PRInt32 siblingIdx = 0; siblingIdx < siblingCount; siblingIdx++) {
nsAccessible* sibling = parent->GetChildAt(siblingIdx);
nsCOMPtr<nsIAccessible> siblingChild;
sibling->GetLastChild(getter_AddRefs(siblingChild));
if (nsAccUtils::Role(siblingChild) == nsIAccessibleRole::ROLE_LIST) {
level = 1;
break;
}
nsAccessible* siblingChild = sibling->LastChild();
if (siblingChild &&
siblingChild->Role() == nsIAccessibleRole::ROLE_LIST)
return 1;
}
} else {
++ level; // level is 1-index based

View File

@@ -279,7 +279,7 @@ public:
/**
* Return parent accessible.
*/
nsAccessible* GetParent() const { return mParent; }
nsAccessible* Parent() const { return mParent; }
/**
* Return child accessible at the given index.
@@ -307,12 +307,20 @@ public:
PRBool HasChildren() { return !!GetChildAt(0); }
/**
* Return next/previous sibling of the accessible.
* Return first/last/next/previous sibling of the accessible.
*/
inline nsAccessible* NextSibling() const
{ return GetSiblingAtOffset(1); }
inline nsAccessible* PrevSibling() const
{ return GetSiblingAtOffset(-1); }
inline nsAccessible* FirstChild()
{ return GetChildCount() != 0 ? GetChildAt(0) : nsnull; }
inline nsAccessible* LastChild()
{
PRUint32 childCount = GetChildCount();
return childCount != 0 ? GetChildAt(childCount - 1) : nsnull;
}
/**
* Return embedded accessible children count.

View File

@@ -234,8 +234,8 @@ nsLinkableAccessible::BindToParent(nsAccessible* aParent,
// on non accessible node in parent chain but this node is skipped when tree
// is traversed.
nsAccessible* walkUpAcc = this;
while ((walkUpAcc = walkUpAcc->GetParent()) && !walkUpAcc->IsDoc()) {
if (walkUpAcc && walkUpAcc->Role() == nsIAccessibleRole::ROLE_LINK &&
while ((walkUpAcc = walkUpAcc->Parent()) && !walkUpAcc->IsDoc()) {
if (walkUpAcc->Role() == nsIAccessibleRole::ROLE_LINK &&
walkUpAcc->State() & states::LINKED) {
mIsLink = PR_TRUE;
mActionAcc = walkUpAcc;

View File

@@ -581,7 +581,7 @@ nsDocAccessible::GetAccessible(nsINode* aNode) const
// It will assert if not all the children were created
// when they were first cached, and no invalidation
// ever corrected parent accessible's child cache.
nsAccessible* parent(accessible->GetParent());
nsAccessible* parent = accessible->Parent();
if (parent)
parent->TestChildCache(accessible);
#endif
@@ -1487,8 +1487,8 @@ nsDocAccessible::NotifyOfInitialUpdate()
// a problem then consider to keep event processing per tab document.
if (!IsRoot()) {
nsRefPtr<AccEvent> reorderEvent =
new AccEvent(nsIAccessibleEvent::EVENT_REORDER, GetParent(),
eAutoDetect, AccEvent::eCoalesceFromSameSubtree);
new AccEvent(nsIAccessibleEvent::EVENT_REORDER, Parent(), eAutoDetect,
AccEvent::eCoalesceFromSameSubtree);
ParentDocument()->FireDelayedAccessibleEvent(reorderEvent);
}
}
@@ -1817,7 +1817,7 @@ nsDocAccessible::UpdateTree(nsAccessible* aContainer, nsIContent* aChildNode,
if (ancestor == this)
break;
ancestor = ancestor->GetParent();
ancestor = ancestor->Parent();
}
}
@@ -1902,7 +1902,7 @@ nsDocAccessible::UpdateTreeInternal(nsAccessible* aChild, bool aIsInsert)
// The accessible parent may differ from container accessible if
// the parent doesn't have own DOM node like list accessible for HTML
// selects.
nsAccessible* parent = aChild->GetParent();
nsAccessible* parent = aChild->Parent();
NS_ASSERTION(parent, "No accessible parent?!");
if (parent)
parent->RemoveChild(aChild);

View File

@@ -699,14 +699,14 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
// is active.
return;
} else {
nsAccessible *containerAccessible = accessible->GetParent();
if (!containerAccessible)
nsAccessible* container = accessible->Parent();
if (!container)
return;
// It is not top level menuitem
// Only fire focus event if it is not inside collapsed popup
// and not a listitem of a combo box
if (containerAccessible->State() & states::COLLAPSED) {
nsAccessible *containerParent = containerAccessible->GetParent();
if (container->State() & states::COLLAPSED) {
nsAccessible* containerParent = container->Parent();
if (!containerParent)
return;
if (containerParent->Role() != nsIAccessibleRole::ROLE_COMBOBOX) {
@@ -796,7 +796,7 @@ nsRootAccessible::GetContentDocShell(nsIDocShellTreeItem *aStart)
// If ancestor chain of accessibles is not completely visible,
// don't use this one. This happens for example if it's inside
// a background tab (tabbed browsing)
nsAccessible *parent = accDoc->GetParent();
nsAccessible* parent = accDoc->Parent();
while (parent) {
if (parent->State() & states::INVISIBLE)
return nsnull;
@@ -804,7 +804,7 @@ nsRootAccessible::GetContentDocShell(nsIDocShellTreeItem *aStart)
if (parent == this)
break; // Don't check past original root accessible we started with
parent = parent->GetParent();
parent = parent->Parent();
}
NS_ADDREF(aStart);
@@ -878,7 +878,7 @@ nsRootAccessible::HandlePopupShownEvent(nsAccessible* aAccessible)
if (role == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
// Fire expanded state change event for comboboxes and autocompeletes.
nsAccessible* combobox = aAccessible->GetParent();
nsAccessible* combobox = aAccessible->Parent();
if (!combobox)
return;
@@ -914,7 +914,7 @@ nsRootAccessible::HandlePopupHidingEvent(nsINode* aNode,
aAccessible->Role() != nsIAccessibleRole::ROLE_COMBOBOX_LIST)
return;
nsAccessible* combobox = aAccessible->GetParent();
nsAccessible* combobox = aAccessible->Parent();
if (!combobox)
return;

View File

@@ -407,8 +407,9 @@ nsHTMLTextFieldAccessible::GetNameInternal(nsAString& aName)
// This means we're part of another control, so use parent accessible for name.
// This ensures that a textbox inside of a XUL widget gets
// an accessible name.
nsAccessible* parent = GetParent();
parent->GetName(aName);
nsAccessible* parent = Parent();
if (parent)
parent->GetName(aName);
}
if (!aName.IsEmpty())
@@ -452,7 +453,7 @@ nsHTMLTextFieldAccessible::NativeState()
state |= states::PROTECTED;
}
else {
nsAccessible* parent = GetParent();
nsAccessible* parent = Parent();
if (parent && parent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
state |= states::HASPOPUP;
}
@@ -650,7 +651,7 @@ nsHTMLLegendAccessible::GetRelationByType(PRUint32 aRelationType,
if (aRelationType == nsIAccessibleRelation::RELATION_LABEL_FOR) {
// Look for groupbox parent
nsAccessible* groupbox = GetParent();
nsAccessible* groupbox = Parent();
if (groupbox && groupbox->Role() == nsIAccessibleRole::ROLE_GROUPING) {
// XXX: if group box exposes more than one relation of the given type

View File

@@ -300,7 +300,7 @@ nsHTMLSelectOptionAccessible::NativeState()
// visibility implementation unless they get reimplemented in layout
state &= ~states::OFFSCREEN;
// <select> is not collapsed: compare bounds to calculate OFFSCREEN
nsAccessible* listAcc = GetParent();
nsAccessible* listAcc = Parent();
if (listAcc) {
PRInt32 optionX, optionY, optionWidth, optionHeight;
PRInt32 listX, listY, listWidth, listHeight;
@@ -382,8 +382,9 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::DoAction(PRUint8 index)
if (!newHTMLOption)
return NS_ERROR_FAILURE;
// Clear old selection
nsAccessible* parent = GetParent();
NS_ASSERTION(parent, "No parent!");
nsAccessible* parent = Parent();
if (!parent)
return NS_OK;
nsCOMPtr<nsIContent> oldHTMLOptionContent =
GetFocusedOption(parent->GetContent());
@@ -891,7 +892,7 @@ void nsHTMLComboboxListAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBo
{
*aBoundingFrame = nsnull;
nsAccessible* comboAcc = GetParent();
nsAccessible* comboAcc = Parent();
if (!comboAcc)
return;

View File

@@ -266,7 +266,7 @@ already_AddRefed<nsIAccessibleTable>
nsHTMLTableCellAccessible::GetTableAccessible()
{
nsAccessible* parent = this;
while ((parent = parent->GetParent())) {
while ((parent = parent->Parent())) {
PRUint32 role = parent->Role();
if (role == nsIAccessibleRole::ROLE_TABLE ||
role == nsIAccessibleRole::ROLE_TREE_TABLE) {
@@ -1528,8 +1528,9 @@ nsHTMLCaptionAccessible::GetRelationByType(PRUint32 aRelationType,
aRelation);
NS_ENSURE_SUCCESS(rv, rv);
if (aRelationType == nsIAccessibleRelation::RELATION_LABEL_FOR)
return nsRelUtils::AddTarget(aRelationType, aRelation, GetParent());
if (aRelationType == nsIAccessibleRelation::RELATION_LABEL_FOR) {
return nsRelUtils::AddTarget(aRelationType, aRelation, Parent());
}
return NS_OK;
}

View File

@@ -621,9 +621,9 @@ nsHyperTextAccessible::DOMPointToHypertextOffset(nsINode *aNode,
}
// From the descendant, go up and get the immediate child of this hypertext
nsAccessible *childAccAtOffset = nsnull;
nsAccessible* childAccAtOffset = nsnull;
while (descendantAcc) {
nsAccessible *parentAcc = descendantAcc->GetParent();
nsAccessible* parentAcc = descendantAcc->Parent();
if (parentAcc == this) {
childAccAtOffset = descendantAcc;
break;

View File

@@ -285,7 +285,7 @@ nsAccessibleWrap::GetUnignoredChildren(nsTArray<nsRefPtr<nsAccessibleWrap> > &aC
already_AddRefed<nsIAccessible>
nsAccessibleWrap::GetUnignoredParent()
{
nsAccessibleWrap *parentWrap = static_cast<nsAccessibleWrap*>(GetParent());
nsAccessibleWrap* parentWrap = static_cast<nsAccessibleWrap*>(Parent());
if (!parentWrap)
return nsnull;
@@ -313,12 +313,12 @@ nsAccessibleWrap::AncestorIsFlat()
// look the same on all platforms, we still let the C++ objects be created
// though.
nsAccessible* parent(GetParent());
nsAccessible* parent = Parent();
while (parent) {
if (nsAccUtils::MustPrune(parent))
return PR_TRUE;
parent = parent->GetParent();
parent = parent->Parent();
}
// no parent was flat
return PR_FALSE;

View File

@@ -214,7 +214,7 @@ __try {
}
}
nsAccessible* xpParentAcc = GetParent();
nsAccessible* xpParentAcc = Parent();
if (!xpParentAcc) {
if (IsApplication())
return S_OK;
@@ -374,7 +374,7 @@ __try {
// a ROLE_OUTLINEITEM for consistency and compatibility.
// We need this because ARIA has a role of "row" for both grid and treegrid
if (xpRole == nsIAccessibleRole::ROLE_ROW) {
nsAccessible* xpParent = GetParent();
nsAccessible* xpParent = Parent();
if (xpParent && xpParent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE)
msaaRole = ROLE_SYSTEM_OUTLINEITEM;
}
@@ -1160,7 +1160,7 @@ __try {
// Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call
// the IA2 role a ROLE_OUTLINEITEM.
if (xpRole == nsIAccessibleRole::ROLE_ROW) {
nsAccessible* xpParent = GetParent();
nsAccessible* xpParent = Parent();
if (xpParent && xpParent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE)
*aRole = ROLE_SYSTEM_OUTLINEITEM;
}
@@ -1768,12 +1768,12 @@ nsAccessibleWrap::GetXPAccessibleFor(const VARIANT& aVarChild)
// Check whether the accessible for the given ID is a child of ARIA
// document.
nsAccessible* parent = child ? child->GetParent() : nsnull;
nsAccessible* parent = child ? child->Parent() : nsnull;
while (parent && parent != document) {
if (parent == this)
return child;
parent = parent->GetParent();
parent = parent->Parent();
}
}

View File

@@ -573,8 +573,9 @@ nsXULToolbarButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
PRInt32 setSize = 0;
PRInt32 posInSet = 0;
nsAccessible* parent(GetParent());
NS_ENSURE_TRUE(parent,);
nsAccessible* parent = Parent();
if (!parent)
return;
PRInt32 childCount = parent->GetChildCount();
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {

View File

@@ -998,11 +998,11 @@ nsXULListCellAccessible::GetTable(nsIAccessibleTable **aTable)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible* thisRow = GetParent();
nsAccessible* thisRow = Parent();
if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
nsAccessible* table = thisRow->GetParent();
nsAccessible* table = thisRow->Parent();
if (!table || table->Role() != nsIAccessibleRole::ROLE_TABLE)
return NS_OK;
@@ -1019,7 +1019,7 @@ nsXULListCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible* row = GetParent();
nsAccessible* row = Parent();
if (!row)
return NS_OK;
@@ -1048,11 +1048,11 @@ nsXULListCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsAccessible* row = GetParent();
nsAccessible* row = Parent();
if (!row)
return NS_OK;
nsAccessible* table = row->GetParent();
nsAccessible* table = row->Parent();
if (!table)
return NS_OK;

View File

@@ -332,8 +332,8 @@ nsXULMenuitemAccessible::NativeState()
// Is collapsed?
PRBool isCollapsed = PR_FALSE;
nsAccessible* parentAcc = GetParent();
if (parentAcc->State() & states::INVISIBLE)
nsAccessible* parent = Parent();
if (parent && parent->State() & states::INVISIBLE)
isCollapsed = PR_TRUE;
if (isSelected) {
@@ -342,11 +342,12 @@ nsXULMenuitemAccessible::NativeState()
// Selected and collapsed?
if (isCollapsed) {
// Set selected option offscreen/invisible according to combobox state
nsAccessible* grandParentAcc = parentAcc->GetParent();
NS_ENSURE_TRUE(grandParentAcc, state);
NS_ASSERTION(grandParentAcc->Role() == nsIAccessibleRole::ROLE_COMBOBOX,
nsAccessible* grandParent = parent->Parent();
if (!grandParent)
return state;
NS_ASSERTION(grandParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX,
"grandparent of combobox listitem is not combobox");
PRUint64 grandParentState = grandParentAcc->State();
PRUint64 grandParentState = grandParent->State();
state &= ~(states::OFFSCREEN | states::INVISIBLE);
state |= (grandParentState & states::OFFSCREEN) |
(grandParentState & states::INVISIBLE) |
@@ -404,7 +405,7 @@ nsXULMenuitemAccessible::AccessKey() const
PRUint32 modifierKey = 0;
nsAccessible* parentAcc = GetParent();
nsAccessible* parentAcc = Parent();
if (parentAcc) {
if (parentAcc->NativeRole() == nsIAccessibleRole::ROLE_MENUBAR) {
// If top level menu item, add Alt+ or whatever modifier text to string
@@ -639,8 +640,9 @@ nsXULMenupopupAccessible::NativeState()
PRBool isActive = mContent->HasAttr(kNameSpaceID_None,
nsAccessibilityAtoms::menuactive);
if (!isActive) {
nsAccessible* parent(GetParent());
NS_ENSURE_TRUE(parent, state);
nsAccessible* parent = Parent();
if (!parent)
return state;
nsIContent *parentContent = parnet->GetContent();
NS_ENSURE_TRUE(parentContent, state);
@@ -685,7 +687,7 @@ nsXULMenupopupAccessible::NativeRole()
if (role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
// Some widgets like the search bar have several popups, owned by buttons.
nsAccessible* grandParent = mParent->GetParent();
nsAccessible* grandParent = mParent->Parent();
if (grandParent &&
grandParent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
return nsIAccessibleRole::ROLE_COMBOBOX_LIST;

View File

@@ -98,7 +98,7 @@ nsXULTextAccessible::GetRelationByType(PRUint32 aRelationType,
// Caption is the label for groupbox
nsIContent *parent = mContent->GetParent();
if (parent && parent->Tag() == nsAccessibilityAtoms::caption) {
nsAccessible* parent = GetParent();
nsAccessible* parent = Parent();
if (parent && parent->Role() == nsIAccessibleRole::ROLE_GROUPING)
return nsRelUtils::AddTarget(aRelationType, aRelation, parent);
}

View File

@@ -1225,7 +1225,7 @@ nsXULTreeColumnsAccessible::GetSiblingAtOffset(PRInt32 aOffset,
PRInt32 rowCount = 0;
treeView->GetRowCount(&rowCount);
if (rowCount > 0 && aOffset <= rowCount) {
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(GetParent());
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(Parent());
if (treeAcc)
return treeAcc->GetTreeItemAccessible(aOffset - 1);

View File

@@ -1016,7 +1016,10 @@ nsXULTreeGridCellAccessible::GetTable(nsIAccessibleTable **aTable)
if (IsDefunct())
return NS_OK;
CallQueryInterface(mParent->GetParent(), aTable);
nsAccessible* grandParent = mParent->Parent();
if (grandParent)
CallQueryInterface(grandParent, aTable);
return NS_OK;
}
@@ -1171,9 +1174,12 @@ nsXULTreeGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAtt
return NS_ERROR_FAILURE;
// "table-cell-index" attribute
nsCOMPtr<nsIAccessible> accessible;
mParent->GetParent(getter_AddRefs(accessible));
nsCOMPtr<nsIAccessibleTable> tableAccessible = do_QueryInterface(accessible);
nsAccessible* grandParent = mParent->Parent();
if (!grandParent)
return NS_OK;
nsCOMPtr<nsIAccessibleTable> tableAccessible =
do_QueryInterface(static_cast<nsIAccessible*>(grandParent));
// XXX - temp fix for crash bug 516047
if (!tableAccessible)
@@ -1308,7 +1314,7 @@ nsXULTreeGridCellAccessible::GetSiblingAtOffset(PRInt32 aOffset,
if (!columnAtOffset)
return nsnull;
nsRefPtr<nsXULTreeItemAccessibleBase> rowAcc = do_QueryObject(GetParent());
nsRefPtr<nsXULTreeItemAccessibleBase> rowAcc = do_QueryObject(Parent());
return rowAcc->GetCellAccessible(columnAtOffset);
}