Bug 1692523 - P1: Prefix local heirarchy functions with 'Local'. r=Jamie

Parent -> LocalParent
GetChildAt -> LocalChildAt
FirstChild -> LocalFirstChild
LastChild -> LocalLastChild
NextSibling -> LocalNextSibling
PrevSibling -> LocalPrevSibling

Differential Revision: https://phabricator.services.mozilla.com/D105034
This commit is contained in:
Eitan Isaacson 2021-02-16 20:05:10 +00:00
parent daf94640ae
commit 8c842a59e3
69 changed files with 351 additions and 318 deletions

View File

@ -367,7 +367,7 @@ void AccessibleWrap::NavigateText(int32_t aGranularity, int32_t aStartOffset,
}
if (newAnchor && (start != aStartOffset || end != aEndOffset)) {
if (IsTextLeaf() && newAnchor == Parent()) {
if (IsTextLeaf() && newAnchor == LocalParent()) {
// For paragraphs, divs, spans, etc., we put a11y focus on the text leaf
// node instead of the HyperTextAccessible. However, Pivot will always
// return a HyperTextAccessible. Android doesn't support text navigation
@ -856,7 +856,7 @@ mozilla::java::GeckoBundle::LocalRef AccessibleWrap::ToBundle(
auto childCount = ChildCount();
nsTArray<int32_t> children(childCount);
for (uint32_t i = 0; i < childCount; i++) {
auto child = static_cast<AccessibleWrap*>(GetChildAt(i));
auto child = static_cast<AccessibleWrap*>(LocalChildAt(i));
children.AppendElement(child->VirtualViewID());
}
@ -914,7 +914,7 @@ bool AccessibleWrap::HandleLiveRegionEvent(AccEvent* aEvent) {
if (atomic.EqualsIgnoreCase("true")) {
Accessible* atomicAncestor = nullptr;
for (Accessible* parent = announcementTarget; parent;
parent = parent->Parent()) {
parent = parent->LocalParent()) {
dom::Element* element = parent->Elm();
if (element &&
element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_atomic,

View File

@ -90,7 +90,7 @@ class AccessibleWrap : public Accessible {
private:
virtual AccessibleWrap* WrapperParent() {
return static_cast<AccessibleWrap*>(Parent());
return static_cast<AccessibleWrap*>(LocalParent());
}
virtual bool WrapperRangeInfo(double* aCurVal, double* aMinVal,

View File

@ -115,8 +115,8 @@ void DocAccessibleWrap::CacheViewportCallback(nsITimer* aTimer,
continue;
}
for (Accessible* acc = visibleAcc; acc && acc != docAcc->Parent();
acc = acc->Parent()) {
for (Accessible* acc = visibleAcc; acc && acc != docAcc->LocalParent();
acc = acc->LocalParent()) {
if (inViewAccs.Contains(acc->UniqueID())) {
break;
}
@ -222,8 +222,8 @@ void DocAccessibleWrap::CacheFocusPath(AccessibleWrap* aAccessible) {
if (IPCAccessibilityActive()) {
DocAccessibleChild* ipcDoc = IPCDoc();
nsTArray<BatchData> cacheData;
for (AccessibleWrap* acc = aAccessible; acc && acc != this->Parent();
acc = static_cast<AccessibleWrap*>(acc->Parent())) {
for (AccessibleWrap* acc = aAccessible; acc && acc != this->LocalParent();
acc = static_cast<AccessibleWrap*>(acc->LocalParent())) {
nsAutoString name;
acc->Name(name);
nsAutoString textValue;
@ -247,8 +247,8 @@ void DocAccessibleWrap::CacheFocusPath(AccessibleWrap* aAccessible) {
} else if (RefPtr<SessionAccessibility> sessionAcc =
SessionAccessibility::GetInstanceFor(this)) {
nsTArray<AccessibleWrap*> accessibles;
for (AccessibleWrap* acc = aAccessible; acc && acc != this->Parent();
acc = static_cast<AccessibleWrap*>(acc->Parent())) {
for (AccessibleWrap* acc = aAccessible; acc && acc != this->LocalParent();
acc = static_cast<AccessibleWrap*>(acc->LocalParent())) {
accessibles.AppendElement(acc);
mFocusPath.Put(acc->UniqueID(), RefPtr{acc});
}

View File

@ -62,8 +62,8 @@ uint32_t ProxyAccessibleWrap::ChildCount() const {
return Proxy()->ChildrenCount();
}
Accessible* ProxyAccessibleWrap::GetChildAt(uint32_t aIndex) const {
ProxyAccessible* child = Proxy()->ChildAt(aIndex);
ProxyAccessible* child = Proxy()->ChildAt(aIndex);
Accessible* ProxyAccessibleWrap::LocalChildAt(uint32_t aIndex) const {
return child ? WrapperFor(child) : nullptr;
}

View File

@ -33,7 +33,7 @@ class ProxyAccessibleWrap : public AccessibleWrap {
virtual uint32_t ChildCount() const override;
virtual Accessible* GetChildAt(uint32_t aIndex) const override;
virtual Accessible* LocalChildAt(uint32_t aIndex) const override;
virtual ENameValueFlag Name(nsString& aName) const override;

View File

@ -79,14 +79,14 @@ bool TraversalRule::IsSingleLineage(Accessible* aAccessible) {
case 0:
return true;
case 1:
child = child->FirstChild();
child = child->LocalFirstChild();
break;
case 2:
if (Accessible* bullet =
child->Parent()->IsHTMLListItem()
? child->Parent()->AsHTMLListItem()->Bullet()
child->LocalParent()->IsHTMLListItem()
? child->LocalParent()->AsHTMLListItem()->Bullet()
: nullptr) {
child = bullet->NextSibling();
child = bullet->LocalNextSibling();
} else {
return false;
}
@ -100,14 +100,14 @@ bool TraversalRule::IsSingleLineage(Accessible* aAccessible) {
}
bool TraversalRule::IsListItemBullet(const Accessible* aAccessible) {
Accessible* parent = aAccessible->Parent();
Accessible* parent = aAccessible->LocalParent();
return parent && parent->IsHTMLListItem() &&
parent->AsHTMLListItem()->Bullet() == aAccessible;
}
bool TraversalRule::IsFlatSubtree(const Accessible* aAccessible) {
for (auto child = aAccessible->FirstChild(); child;
child = child->NextSibling()) {
for (auto child = aAccessible->LocalFirstChild(); child;
child = child->LocalNextSibling()) {
roles::Role role = child->Role();
if (role == roles::TEXT_LEAF || role == roles::STATICTEXT) {
continue;

View File

@ -812,7 +812,7 @@ gint getIndexInParentCB(AtkObject* aAtkObj) {
return -1;
}
Accessible* parent = accWrap->Parent();
Accessible* parent = accWrap->LocalParent();
if (!parent) return -1; // No parent
return parent->GetIndexOfEmbeddedChild(accWrap);
@ -1221,7 +1221,8 @@ nsresult AccessibleWrap::HandleAccEvent(AccEvent* aEvent) {
case nsIAccessibleEvent::EVENT_SHOW: {
AccMutationEvent* event = downcast_accEvent(aEvent);
Accessible* parentAcc = event ? event->Parent() : accessible->Parent();
Accessible* parentAcc =
event ? event->LocalParent() : accessible->LocalParent();
AtkObject* parent = AccessibleWrap::GetAtkObject(parentAcc);
NS_ENSURE_STATE(parent);
auto obj = reinterpret_cast<MaiAtkObject*>(atkObj);
@ -1238,7 +1239,8 @@ nsresult AccessibleWrap::HandleAccEvent(AccEvent* aEvent) {
}
AccMutationEvent* event = downcast_accEvent(aEvent);
Accessible* parentAcc = event ? event->Parent() : accessible->Parent();
Accessible* parentAcc =
event ? event->LocalParent() : accessible->LocalParent();
AtkObject* parent = AccessibleWrap::GetAtkObject(parentAcc);
NS_ENSURE_STATE(parent);
auto obj = reinterpret_cast<MaiAtkObject*>(atkObj);
@ -1485,7 +1487,7 @@ void AccessibleWrap::GetKeyBinding(Accessible* aAccessible,
if (!keyBinding.IsEmpty()) {
keyBinding.AppendToString(keyBindingsStr, KeyBinding::eAtkFormat);
Accessible* parent = aAccessible->Parent();
Accessible* parent = aAccessible->LocalParent();
roles::Role role = parent ? parent->Role() : roles::NOTHING;
if (role == roles::PARENT_MENUITEM || role == roles::MENUITEM ||
role == roles::RADIO_MENU_ITEM || role == roles::CHECK_MENU_ITEM) {
@ -1501,7 +1503,8 @@ void AccessibleWrap::GetKeyBinding(Accessible* aAccessible,
keysInHierarchyStr.Insert(str, 0);
}
} while ((parent = parent->Parent()) && parent->Role() != roles::MENUBAR);
} while ((parent = parent->LocalParent()) &&
parent->Role() != roles::MENUBAR);
keyBindingsStr.Append(';');
keyBindingsStr.Append(keysInHierarchyStr);

View File

@ -104,8 +104,8 @@ AccTextChangeEvent::AccTextChangeEvent(Accessible* aAccessible, int32_t aStart,
AccHideEvent::AccHideEvent(Accessible* aTarget, bool aNeedsShutdown)
: AccMutationEvent(::nsIAccessibleEvent::EVENT_HIDE, aTarget),
mNeedsShutdown(aNeedsShutdown) {
mNextSibling = mAccessible->NextSibling();
mPrevSibling = mAccessible->PrevSibling();
mNextSibling = mAccessible->LocalNextSibling();
mPrevSibling = mAccessible->LocalPrevSibling();
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -243,7 +243,7 @@ class AccMutationEvent : public AccTreeMutationEvent {
: AccTreeMutationEvent(aEventType, aTarget) {
// Don't coalesce these since they are coalesced by reorder event. Coalesce
// contained text change events.
mParent = mAccessible->Parent();
mParent = mAccessible->LocalParent();
}
virtual ~AccMutationEvent() {}
@ -257,7 +257,7 @@ class AccMutationEvent : public AccTreeMutationEvent {
bool IsShow() const { return mEventType == nsIAccessibleEvent::EVENT_SHOW; }
bool IsHide() const { return mEventType == nsIAccessibleEvent::EVENT_HIDE; }
Accessible* Parent() const { return mParent; }
Accessible* LocalParent() const { return mParent; }
protected:
nsCOMPtr<nsINode> mNode;

View File

@ -20,7 +20,7 @@ AccGroupInfo::AccGroupInfo(const Accessible* aItem, role aRole)
void AccGroupInfo::Update() {
mParent = nullptr;
Accessible* parent = mItem->Parent();
Accessible* parent = mItem->LocalParent();
if (!parent) return;
int32_t indexInParent = mItem->IndexInParent();
@ -36,7 +36,7 @@ void AccGroupInfo::Update() {
// Compute position in set.
mPosInSet = 1;
for (int32_t idx = indexInParent - 1; idx >= 0; idx--) {
Accessible* sibling = parent->GetChildAt(idx);
Accessible* sibling = parent->LocalChildAt(idx);
roles::Role siblingRole = sibling->Role();
// If the sibling is separator then the group is ended.
@ -82,7 +82,7 @@ void AccGroupInfo::Update() {
mSetSize = mPosInSet;
for (uint32_t idx = indexInParent + 1; idx < siblingCount; idx++) {
Accessible* sibling = parent->GetChildAt(idx);
Accessible* sibling = parent->LocalChildAt(idx);
roles::Role siblingRole = sibling->Role();
@ -131,7 +131,7 @@ void AccGroupInfo::Update() {
// the previous tree item of the group is a conceptual parent of the tree
// item.
if (mRole == roles::OUTLINEITEM) {
Accessible* parentPrevSibling = parent->PrevSibling();
Accessible* parentPrevSibling = parent->LocalPrevSibling();
if (parentPrevSibling && parentPrevSibling->Role() == mRole) {
mParent = parentPrevSibling;
return;
@ -142,7 +142,7 @@ void AccGroupInfo::Update() {
// the parent of the item will be a group and containing item of the group is
// a conceptual parent of the item.
if (mRole == roles::LISTITEM || mRole == roles::OUTLINEITEM) {
Accessible* grandParent = parent->Parent();
Accessible* grandParent = parent->LocalParent();
if (grandParent && grandParent->Role() == mRole) mParent = grandParent;
}
}
@ -151,10 +151,10 @@ Accessible* AccGroupInfo::FirstItemOf(const Accessible* aContainer) {
// ARIA tree can be arranged by ARIA groups case #1 (previous sibling of a
// group is a parent) or by aria-level.
a11y::role containerRole = aContainer->Role();
Accessible* item = aContainer->NextSibling();
Accessible* item = aContainer->LocalNextSibling();
if (item) {
if (containerRole == roles::OUTLINEITEM && item->Role() == roles::GROUPING)
item = item->FirstChild();
item = item->LocalFirstChild();
if (item) {
AccGroupInfo* itemGroupInfo = item->GetGroupInfo();
@ -165,13 +165,13 @@ Accessible* AccGroupInfo::FirstItemOf(const Accessible* aContainer) {
// ARIA list and tree can be arranged by ARIA groups case #2 (group is
// a child of an item).
item = aContainer->LastChild();
item = aContainer->LocalLastChild();
if (!item) return nullptr;
if (item->Role() == roles::GROUPING &&
(containerRole == roles::LISTITEM ||
containerRole == roles::OUTLINEITEM)) {
item = item->FirstChild();
item = item->LocalFirstChild();
if (item) {
AccGroupInfo* itemGroupInfo = item->GetGroupInfo();
if (itemGroupInfo && itemGroupInfo->ConceptualParent() == aContainer)
@ -180,7 +180,7 @@ Accessible* AccGroupInfo::FirstItemOf(const Accessible* aContainer) {
}
// Otherwise, it can be a direct child if the container is a list or tree.
item = aContainer->FirstChild();
item = aContainer->LocalFirstChild();
if (ShouldReportRelations(item->Role(), containerRole)) return item;
return nullptr;
@ -231,10 +231,10 @@ uint32_t AccGroupInfo::TotalItemCount(Accessible* aContainer,
case roles::PAGETABLIST: {
Accessible* childItem = AccGroupInfo::FirstItemOf(aContainer);
if (!childItem) {
childItem = aContainer->FirstChild();
childItem = aContainer->LocalFirstChild();
if (childItem && childItem->IsTextLeaf()) {
// First child can be a text leaf, check its sibling for an item.
childItem = childItem->NextSibling();
childItem = childItem->LocalNextSibling();
}
}
@ -261,10 +261,10 @@ Accessible* AccGroupInfo::NextItemTo(Accessible* aItem) {
// If the item in middle of the group then search next item in siblings.
if (groupInfo->PosInSet() >= groupInfo->SetSize()) return nullptr;
Accessible* parent = aItem->Parent();
Accessible* parent = aItem->LocalParent();
uint32_t childCount = parent->ChildCount();
for (uint32_t idx = aItem->IndexInParent() + 1; idx < childCount; idx++) {
Accessible* nextItem = parent->GetChildAt(idx);
Accessible* nextItem = parent->LocalChildAt(idx);
AccGroupInfo* nextGroupInfo = nextItem->GetGroupInfo();
if (nextGroupInfo &&
nextGroupInfo->ConceptualParent() == groupInfo->ConceptualParent()) {

View File

@ -35,7 +35,7 @@ AccIterator::~AccIterator() {
Accessible* AccIterator::Next() {
while (mState) {
Accessible* child = mState->mParent->GetChildAt(mState->mIndex++);
Accessible* child = mState->mParent->LocalChildAt(mState->mIndex++);
if (!child) {
IteratorState* tmp = mState;
mState = mState->mParentState;
@ -136,7 +136,7 @@ Accessible* HTMLLabelIterator::Next() {
// Go up tree to get a name of ancestor label if there is one (an ancestor
// <label> implicitly points to us). Don't go up farther than form or
// document.
Accessible* walkUp = mAcc->Parent();
Accessible* walkUp = mAcc->LocalParent();
while (walkUp && !walkUp->IsDoc()) {
nsIContent* walkUpEl = walkUp->GetContent();
if (IsLabel(walkUp) &&
@ -147,7 +147,7 @@ Accessible* HTMLLabelIterator::Next() {
if (walkUpEl->IsHTMLElement(nsGkAtoms::form)) break;
walkUp = walkUp->Parent();
walkUp = walkUp->LocalParent();
}
return nullptr;

View File

@ -35,7 +35,7 @@ int32_t AccessibleOrProxy::IndexInParent() const {
AccessibleOrProxy AccessibleOrProxy::Parent() const {
if (IsAccessible()) {
return AsAccessible()->Parent();
return AsAccessible()->LocalParent();
}
ProxyAccessible* proxy = AsProxy();

View File

@ -80,7 +80,7 @@ class AccessibleOrProxy {
return childDoc;
}
return AsAccessible()->GetChildAt(aIdx);
return AsAccessible()->LocalChildAt(aIdx);
}
/**
@ -96,7 +96,7 @@ class AccessibleOrProxy {
return childDoc;
}
return AsAccessible()->FirstChild();
return AsAccessible()->LocalFirstChild();
}
/**
@ -112,7 +112,7 @@ class AccessibleOrProxy {
return childDoc;
}
return AsAccessible()->LastChild();
return AsAccessible()->LocalLastChild();
}
/**
@ -123,7 +123,7 @@ class AccessibleOrProxy {
return AsProxy()->NextSibling();
}
return AsAccessible()->NextSibling();
return AsAccessible()->LocalNextSibling();
}
/**
@ -134,7 +134,7 @@ class AccessibleOrProxy {
return AsProxy()->PrevSibling();
}
return AsAccessible()->PrevSibling();
return AsAccessible()->LocalPrevSibling();
}
role Role() const {

View File

@ -23,7 +23,7 @@ Accessible* EmbeddedObjCollector::GetAccessibleAt(uint32_t aIndex) {
Accessible* EmbeddedObjCollector::EnsureNGetObject(uint32_t aIndex) {
uint32_t childCount = mRoot->ChildCount();
while (mRootChildIdx < childCount) {
Accessible* child = mRoot->GetChildAt(mRootChildIdx++);
Accessible* child = mRoot->LocalChildAt(mRootChildIdx++);
if (child->IsText()) continue;
AppendObject(child);
@ -36,7 +36,7 @@ Accessible* EmbeddedObjCollector::EnsureNGetObject(uint32_t aIndex) {
int32_t EmbeddedObjCollector::EnsureNGetIndex(Accessible* aAccessible) {
uint32_t childCount = mRoot->ChildCount();
while (mRootChildIdx < childCount) {
Accessible* child = mRoot->GetChildAt(mRootChildIdx++);
Accessible* child = mRoot->LocalChildAt(mRootChildIdx++);
if (child->IsText()) continue;
AppendObject(child);

View File

@ -63,7 +63,7 @@ bool EventQueue::PushNameOrDescriptionChange(Accessible* aTarget) {
// Only continue traversing up the tree if it's possible that the parent
// Accessible's name (or an Accessible being labelled by this Accessible or
// an ancestor) can depend on this Accessible's name.
Accessible* parent = aTarget->Parent();
Accessible* parent = aTarget->LocalParent();
while (parent &&
nsTextEquivUtils::HasNameRule(parent, eNameFromSubtreeIfReqRule)) {
// Test possible name dependent parent.
@ -98,7 +98,7 @@ bool EventQueue::PushNameOrDescriptionChange(Accessible* aTarget) {
}
}
parent = parent->Parent();
parent = parent->LocalParent();
}
return pushed;
}

View File

@ -55,7 +55,7 @@ TreeMutation::~TreeMutation() {
}
void TreeMutation::AfterInsertion(Accessible* aChild) {
MOZ_ASSERT(aChild->Parent() == mParent);
MOZ_ASSERT(aChild->LocalParent() == mParent);
if (static_cast<uint32_t>(aChild->mIndexInParent) < mStartIdx) {
mStartIdx = aChild->mIndexInParent + 1;
@ -72,7 +72,7 @@ void TreeMutation::AfterInsertion(Accessible* aChild) {
}
void TreeMutation::BeforeRemoval(Accessible* aChild, bool aNoShutdown) {
MOZ_ASSERT(aChild->Parent() == mParent);
MOZ_ASSERT(aChild->LocalParent() == mParent);
if (static_cast<uint32_t>(aChild->mIndexInParent) < mStartIdx) {
mStartIdx = aChild->mIndexInParent;
@ -267,7 +267,7 @@ EventTree* EventTree::FindOrInsert(Accessible* aContainer) {
}
// We got a match.
if (parent->Parent() == node->mContainer) {
if (parent->LocalParent() == node->mContainer) {
// Reject the node if it's contained by a show/hide event target
uint32_t evCount = node->mDependentEvents.Length();
for (uint32_t idx = 0; idx < evCount; idx++) {
@ -295,7 +295,7 @@ EventTree* EventTree::FindOrInsert(Accessible* aContainer) {
return node->FindOrInsert(aContainer);
}
parent = parent->Parent();
parent = parent->LocalParent();
MOZ_ASSERT(parent, "Wrong tree");
}
@ -306,8 +306,8 @@ EventTree* EventTree::FindOrInsert(Accessible* aContainer) {
// otherwise ignore the current node, but not its show and hide events
Accessible* curParent = node->mContainer;
while (curParent && !curParent->IsDoc()) {
if (curParent->Parent() != aContainer) {
curParent = curParent->Parent();
if (curParent->LocalParent() != aContainer) {
curParent = curParent->LocalParent();
continue;
}
@ -330,8 +330,8 @@ EventTree* EventTree::FindOrInsert(Accessible* aContainer) {
while (node) {
Accessible* curParent = node->mContainer;
while (curParent && !curParent->IsDoc()) {
if (curParent->Parent() != aContainer) {
curParent = curParent->Parent();
if (curParent->LocalParent() != aContainer) {
curParent = curParent->LocalParent();
continue;
}
@ -526,7 +526,7 @@ void EventTree::Mutated(AccMutationEvent* aEv) {
*node = std::move((*node)->mNext);
break;
}
cntr = cntr->Parent();
cntr = cntr->LocalParent();
}
if (cntr == aEv->mAccessible) {
continue;

View File

@ -68,7 +68,7 @@ bool FocusManager::IsFocusWithin(const Accessible* aContainer) const {
while (child) {
if (child == aContainer) return true;
child = child->Parent();
child = child->LocalParent();
}
return false;
}
@ -82,19 +82,19 @@ FocusManager::FocusDisposition FocusManager::IsInOrContainsFocus(
if (focus == aAccessible) return eFocused;
// If contains the focus.
Accessible* child = focus->Parent();
Accessible* child = focus->LocalParent();
while (child) {
if (child == aAccessible) return eContainsFocus;
child = child->Parent();
child = child->LocalParent();
}
// If contained by focus.
child = aAccessible->Parent();
child = aAccessible->LocalParent();
while (child) {
if (child == focus) return eContainedByFocus;
child = child->Parent();
child = child->LocalParent();
}
return eNone;
@ -286,8 +286,8 @@ void FocusManager::ProcessFocusEvent(AccEvent* aEvent) {
if (target->IsARIARole(nsGkAtoms::menuitem)) {
// The focus was moved into menu.
Accessible* ARIAMenubar = nullptr;
for (Accessible* parent = target->Parent(); parent;
parent = parent->Parent()) {
for (Accessible* parent = target->LocalParent(); parent;
parent = parent->LocalParent()) {
if (parent->IsARIARole(nsGkAtoms::menubar)) {
ARIAMenubar = parent;
break;

View File

@ -661,7 +661,7 @@ void logging::TreeInfo(const char* aMsg, uint32_t aExtraFlags,
MsgBegin("TREE", "%s; doc: %p", aMsg, aParent->Document());
AccessibleInfo("container", aParent);
for (uint32_t idx = 0; idx < aParent->ChildCount(); idx++) {
AccessibleInfo("child", aParent->GetChildAt(idx));
AccessibleInfo("child", aParent->LocalChildAt(idx));
}
MsgEnd();
}
@ -678,9 +678,9 @@ void logging::Tree(const char* aTitle, const char* aMsgText, Accessible* aRoot,
aPrefixFunc ? aPrefixFunc(aGetTreePrefixData, root) : "";
printf("%s", NS_ConvertUTF16toUTF8(level).get());
logging::AccessibleInfo(prefix, root);
if (root->FirstChild() && !root->FirstChild()->IsDoc()) {
if (root->LocalFirstChild() && !root->LocalFirstChild()->IsDoc()) {
level.AppendLiteral(u" ");
root = root->FirstChild();
root = root->LocalFirstChild();
continue;
}
int32_t idxInParent = root != aRoot && root->mParent
@ -692,7 +692,7 @@ void logging::Tree(const char* aTitle, const char* aMsgText, Accessible* aRoot,
root = root->mParent->mChildren.ElementAt(idxInParent + 1);
continue;
}
while (root != aRoot && (root = root->Parent())) {
while (root != aRoot && (root = root->LocalParent())) {
level.Cut(0, 2);
int32_t idxInParent = !root->IsDoc() && root->mParent
? root->mParent->mChildren.IndexOf(root)

View File

@ -531,8 +531,9 @@ MARKUPMAP(
// native HTML table row class doesn't work. Refer to
// CreateAccessibleByFrameType dual logic.
Accessible* table = aContext->IsTable() ? aContext : nullptr;
if (!table && aContext->Parent() && aContext->Parent()->IsTable()) {
table = aContext->Parent();
if (!table && aContext->LocalParent() &&
aContext->LocalParent()->IsTable()) {
table = aContext->LocalParent();
}
if (table) {
nsIContent* parentContent = aElement->GetParent();

View File

@ -171,7 +171,7 @@ bool NotificationController::QueueMutationEvent(AccTreeMutationEvent* aEvent) {
// existing one to the end of the queue if the container already has a
// reorder event.
Accessible* target = aEvent->GetAccessible();
Accessible* container = aEvent->GetAccessible()->Parent();
Accessible* container = aEvent->GetAccessible()->LocalParent();
RefPtr<AccReorderEvent> reorder;
if (!container->ReorderEventTarget()) {
reorder = new AccReorderEvent(container);
@ -228,7 +228,7 @@ bool NotificationController::QueueMutationEvent(AccTreeMutationEvent* aEvent) {
mutEvent->IsHide()) {
AccHideEvent* prevHide = downcast_accEvent(prevEvent);
AccTextChangeEvent* prevTextChange = prevHide->mTextChangeEvent;
if (prevTextChange && prevHide->Parent() == mutEvent->Parent()) {
if (prevTextChange && prevHide->LocalParent() == mutEvent->LocalParent()) {
if (prevHide->mNextSibling == target) {
target->AppendTextTo(prevTextChange->mModifiedText);
prevHide->mTextChangeEvent.swap(mutEvent->mTextChangeEvent);
@ -248,7 +248,7 @@ bool NotificationController::QueueMutationEvent(AccTreeMutationEvent* aEvent) {
prevEvent->GetEventType() == nsIAccessibleEvent::EVENT_SHOW) {
AccShowEvent* prevShow = downcast_accEvent(prevEvent);
AccTextChangeEvent* prevTextChange = prevShow->mTextChangeEvent;
if (prevTextChange && prevShow->Parent() == target->Parent()) {
if (prevTextChange && prevShow->LocalParent() == target->LocalParent()) {
int32_t index = target->IndexInParent();
int32_t prevIndex = prevShow->GetAccessible()->IndexInParent();
if (prevIndex + 1 == index) {
@ -329,7 +329,7 @@ void NotificationController::CoalesceMutationEvents() {
break;
}
Accessible* parent = acc->Parent();
Accessible* parent = acc->LocalParent();
if (parent->ReorderEventTarget()) {
AccReorderEvent* reorder = downcast_accEvent(
mMutationMap.GetEvent(parent, EventMap::ReorderEvent));
@ -370,7 +370,7 @@ void NotificationController::CoalesceMutationEvents() {
acc = parent;
}
} else if (eventType == nsIAccessibleEvent::EVENT_SHOW) {
Accessible* parent = event->GetAccessible()->Parent();
Accessible* parent = event->GetAccessible()->LocalParent();
while (parent) {
if (parent->IsDoc()) {
break;
@ -383,14 +383,14 @@ void NotificationController::CoalesceMutationEvents() {
break;
}
parent = parent->Parent();
parent = parent->LocalParent();
}
} else {
MOZ_ASSERT(eventType == nsIAccessibleEvent::EVENT_HIDE,
"mutation event list has an invalid event");
AccHideEvent* hideEvent = downcast_accEvent(event);
Accessible* parent = hideEvent->Parent();
Accessible* parent = hideEvent->LocalParent();
while (parent) {
if (parent->IsDoc()) {
break;
@ -410,7 +410,7 @@ void NotificationController::CoalesceMutationEvents() {
}
}
parent = parent->Parent();
parent = parent->LocalParent();
}
}
@ -528,7 +528,7 @@ void NotificationController::ProcessMutationEvents() {
continue;
}
Accessible* parent = event->GetAccessible()->Parent();
Accessible* parent = event->GetAccessible()->LocalParent();
showEvents.GetOrInsert(parent).AppendElement(event);
}
@ -893,7 +893,7 @@ void NotificationController::WillRefresh(mozilla::TimeStamp aTime) {
continue;
}
Accessible* parent = childDoc->Parent();
Accessible* parent = childDoc->LocalParent();
DocAccessibleChild* parentIPCDoc = mDocument->IPCDoc();
MOZ_DIAGNOSTIC_ASSERT(parentIPCDoc);
uint64_t id = reinterpret_cast<uintptr_t>(parent->UniqueID());

View File

@ -165,8 +165,8 @@ HyperTextAccessible* Pivot::SearchForText(Accessible* aAnchor, bool aBackward) {
while (true) {
Accessible* child = nullptr;
while ((child = (aBackward ? accessible->LastChild()
: accessible->FirstChild()))) {
while ((child = (aBackward ? accessible->LocalLastChild()
: accessible->LocalFirstChild()))) {
accessible = child;
if (child->IsHyperText()) {
return child->AsHyperText();
@ -192,8 +192,8 @@ HyperTextAccessible* Pivot::SearchForText(Accessible* aAnchor, bool aBackward) {
break;
}
sibling = aBackward ? temp->PrevSibling() : temp->NextSibling();
} while ((temp = temp->Parent()));
sibling = aBackward ? temp->LocalPrevSibling() : temp->LocalNextSibling();
} while ((temp = temp->LocalParent()));
if (!sibling) {
break;
@ -247,9 +247,9 @@ Accessible* Pivot::NextText(Accessible* aAnchor, int32_t* aStartOffset,
// if we're starting on a text leaf, translate the offsets to the
// HyperTextAccessible parent and start from there.
if (aAnchor->IsTextLeaf() && aAnchor->Parent() &&
aAnchor->Parent()->IsHyperText()) {
HyperTextAccessible* text = aAnchor->Parent()->AsHyperText();
if (aAnchor->IsTextLeaf() && aAnchor->LocalParent() &&
aAnchor->LocalParent()->IsHyperText()) {
HyperTextAccessible* text = aAnchor->LocalParent()->AsHyperText();
tempPosition = text;
int32_t childOffset = text->GetChildOffset(aAnchor);
if (tempEnd == -1) {
@ -282,8 +282,9 @@ Accessible* Pivot::NextText(Accessible* aAnchor, int32_t* aStartOffset,
// starting on a text leaf), start the text movement from the end of that
// node, otherwise we just default to 0.
if (tempEnd == -1) {
tempEnd =
text == curPosition->Parent() ? text->GetChildOffset(curPosition) : 0;
tempEnd = text == curPosition->LocalParent()
? text->GetChildOffset(curPosition)
: 0;
}
// If there's no more text on the current node, try to find the next text
@ -298,7 +299,7 @@ Accessible* Pivot::NextText(Accessible* aAnchor, int32_t* aStartOffset,
// offset. Otherwise, do a forward search for the next node to land on
// (we don't do this in the first case because we don't want to go to the
// subtree).
Accessible* sibling = tempPosition->NextSibling();
Accessible* sibling = tempPosition->LocalNextSibling();
if (tempPosition->IsLink()) {
if (sibling && sibling->IsLink()) {
tempStart = tempEnd = -1;
@ -306,7 +307,7 @@ Accessible* Pivot::NextText(Accessible* aAnchor, int32_t* aStartOffset,
} else {
tempStart = tempPosition->StartOffset();
tempEnd = tempPosition->EndOffset();
tempPosition = tempPosition->Parent();
tempPosition = tempPosition->LocalParent();
}
} else {
tempPosition = SearchForText(tempPosition, false);
@ -386,9 +387,9 @@ Accessible* Pivot::PrevText(Accessible* aAnchor, int32_t* aStartOffset,
// if we're starting on a text leaf, translate the offsets to the
// HyperTextAccessible parent and start from there.
if (aAnchor->IsTextLeaf() && aAnchor->Parent() &&
aAnchor->Parent()->IsHyperText()) {
HyperTextAccessible* text = aAnchor->Parent()->AsHyperText();
if (aAnchor->IsTextLeaf() && aAnchor->LocalParent() &&
aAnchor->LocalParent()->IsHyperText()) {
HyperTextAccessible* text = aAnchor->LocalParent()->AsHyperText();
tempPosition = text;
int32_t childOffset = text->GetChildOffset(aAnchor);
if (tempStart == -1) {
@ -422,7 +423,7 @@ Accessible* Pivot::PrevText(Accessible* aAnchor, int32_t* aStartOffset,
// starting on a text leaf), start the text movement from the end offset
// of that node. Otherwise we just default to the last offset in the parent.
if (tempStart == -1) {
if (tempPosition != curPosition && text == curPosition->Parent()) {
if (tempPosition != curPosition && text == curPosition->LocalParent()) {
tempStart = text->GetChildOffset(curPosition) +
nsAccUtils::TextLength(curPosition);
} else {
@ -442,7 +443,7 @@ Accessible* Pivot::PrevText(Accessible* aAnchor, int32_t* aStartOffset,
// offset. Otherwise, do a forward search for the next node to land on
// (we don't do this in the first case because we don't want to go to the
// subtree).
Accessible* sibling = tempPosition->PrevSibling();
Accessible* sibling = tempPosition->LocalPrevSibling();
if (tempPosition->IsLink()) {
if (sibling && sibling->IsLink()) {
HyperTextAccessible* siblingText = sibling->AsHyperText();
@ -452,7 +453,7 @@ Accessible* Pivot::PrevText(Accessible* aAnchor, int32_t* aStartOffset,
} else {
tempStart = tempPosition->StartOffset();
tempEnd = tempPosition->EndOffset();
tempPosition = tempPosition->Parent();
tempPosition = tempPosition->LocalParent();
}
} else {
HyperTextAccessible* tempText = SearchForText(tempPosition, true);

View File

@ -44,7 +44,7 @@ void TextAttrsMgr::GetAttributes(nsIPersistentProperties* aAttributes,
// Embedded objects are combined into own range with empty attributes set.
if (mOffsetAcc && !mOffsetAcc->IsText()) {
for (int32_t childIdx = mOffsetAccIdx - 1; childIdx >= 0; childIdx--) {
Accessible* currAcc = mHyperTextAcc->GetChildAt(childIdx);
Accessible* currAcc = mHyperTextAcc->LocalChildAt(childIdx);
if (currAcc->IsText()) break;
(*aStartOffset)--;
@ -53,7 +53,7 @@ void TextAttrsMgr::GetAttributes(nsIPersistentProperties* aAttributes,
uint32_t childCount = mHyperTextAcc->ChildCount();
for (uint32_t childIdx = mOffsetAccIdx + 1; childIdx < childCount;
childIdx++) {
Accessible* currAcc = mHyperTextAcc->GetChildAt(childIdx);
Accessible* currAcc = mHyperTextAcc->LocalChildAt(childIdx);
if (currAcc->IsText()) break;
(*aEndOffset)++;
@ -137,7 +137,7 @@ void TextAttrsMgr::GetRange(TextAttr* aAttrArray[], uint32_t aAttrArrayLen,
uint32_t* aStartOffset, uint32_t* aEndOffset) {
// Navigate backward from anchor accessible to find start offset.
for (int32_t childIdx = mOffsetAccIdx - 1; childIdx >= 0; childIdx--) {
Accessible* currAcc = mHyperTextAcc->GetChildAt(childIdx);
Accessible* currAcc = mHyperTextAcc->LocalChildAt(childIdx);
// Stop on embedded accessible since embedded accessibles are combined into
// own range.
@ -163,7 +163,7 @@ void TextAttrsMgr::GetRange(TextAttr* aAttrArray[], uint32_t aAttrArrayLen,
// Navigate forward from anchor accessible to find end offset.
uint32_t childLen = mHyperTextAcc->ChildCount();
for (uint32_t childIdx = mOffsetAccIdx + 1; childIdx < childLen; childIdx++) {
Accessible* currAcc = mHyperTextAcc->GetChildAt(childIdx);
Accessible* currAcc = mHyperTextAcc->LocalChildAt(childIdx);
if (!currAcc->IsText()) break;
MOZ_ASSERT(nsCoreUtils::GetDOMElementFor(currAcc->GetContent()),

View File

@ -26,11 +26,11 @@ bool TextPoint::operator<(const TextPoint& aPoint) const {
AutoTArray<Accessible*, 30> parents1, parents2;
do {
parents1.AppendElement(p1);
p1 = p1->Parent();
p1 = p1->LocalParent();
} while (p1);
do {
parents2.AppendElement(p2);
p2 = p2->Parent();
p2 = p2->LocalParent();
} while (p2);
// Find where the parent chain differs
@ -48,7 +48,7 @@ bool TextPoint::operator<(const TextPoint& aPoint) const {
// is mContainer's ancestor that is the child of aPoint.mContainer.
// We compare its end offset in aPoint.mContainer with aPoint.mOffset.
Accessible* child = parents1.ElementAt(pos1 - 1);
MOZ_ASSERT(child->Parent() == aPoint.mContainer);
MOZ_ASSERT(child->LocalParent() == aPoint.mContainer);
return child->EndOffset() < static_cast<uint32_t>(aPoint.mOffset);
}
@ -58,7 +58,7 @@ bool TextPoint::operator<(const TextPoint& aPoint) const {
// is aPoint.mContainer's ancestor that is the child of mContainer.
// We compare its start offset in mContainer with mOffset.
Accessible* child = parents2.ElementAt(pos2 - 1);
MOZ_ASSERT(child->Parent() == mContainer);
MOZ_ASSERT(child->LocalParent() == mContainer);
return static_cast<uint32_t>(mOffset) < child->StartOffset();
}
@ -83,7 +83,7 @@ void TextRange::EmbeddedChildren(nsTArray<Accessible*>* aChildren) const {
int32_t startIdx = mStartContainer->GetChildIndexAtOffset(mStartOffset);
int32_t endIdx = mStartContainer->GetChildIndexAtOffset(mEndOffset);
for (int32_t idx = startIdx; idx <= endIdx; idx++) {
Accessible* child = mStartContainer->GetChildAt(idx);
Accessible* child = mStartContainer->LocalChildAt(idx);
if (!child->IsText()) {
aChildren->AppendElement(child);
}
@ -106,7 +106,7 @@ void TextRange::EmbeddedChildren(nsTArray<Accessible*>* aChildren) const {
uint32_t childCount = parent->ChildCount();
for (uint32_t childIdx = child->IndexInParent(); childIdx < childCount;
childIdx++) {
Accessible* next = parent->GetChildAt(childIdx);
Accessible* next = parent->LocalChildAt(childIdx);
if (!next->IsText()) {
aChildren->AppendElement(next);
}
@ -117,7 +117,7 @@ void TextRange::EmbeddedChildren(nsTArray<Accessible*>* aChildren) const {
int32_t endIdx = parents2[pos2 - 1]->IndexInParent();
int32_t childIdx = parents1[pos1 - 1]->IndexInParent() + 1;
for (; childIdx < endIdx; childIdx++) {
Accessible* next = container->GetChildAt(childIdx);
Accessible* next = container->LocalChildAt(childIdx);
if (!next->IsText()) {
aChildren->AppendElement(next);
}
@ -129,7 +129,7 @@ void TextRange::EmbeddedChildren(nsTArray<Accessible*>* aChildren) const {
Accessible* child = parents2[idx - 1];
int32_t endIdx = child->IndexInParent();
for (int32_t childIdx = 0; childIdx < endIdx; childIdx++) {
Accessible* next = parent->GetChildAt(childIdx);
Accessible* next = parent->LocalChildAt(childIdx);
if (!next->IsText()) {
aChildren->AppendElement(next);
}
@ -143,10 +143,10 @@ void TextRange::Text(nsAString& aText) const {
mStartOffset - mStartContainer->GetChildOffset(current);
while (current && TextInternal(aText, current, startIntlOffset)) {
current = current->Parent();
current = current->LocalParent();
if (!current) break;
current = current->NextSibling();
current = current->LocalNextSibling();
}
}
@ -441,7 +441,7 @@ bool TextRange::TextInternal(nsAString& aText, Accessible* aCurrent,
uint32_t aStartIntlOffset) const {
bool moveNext = true;
int32_t endIntlOffset = -1;
if (aCurrent->Parent() == mEndContainer &&
if (aCurrent->LocalParent() == mEndContainer &&
mEndContainer->GetChildAtOffset(mEndOffset) == aCurrent) {
uint32_t currentStartOffset = mEndContainer->GetChildOffset(aCurrent);
endIntlOffset = mEndOffset - currentStartOffset;
@ -456,12 +456,12 @@ bool TextRange::TextInternal(nsAString& aText, Accessible* aCurrent,
if (!moveNext) return false;
}
Accessible* next = aCurrent->FirstChild();
Accessible* next = aCurrent->LocalFirstChild();
if (next) {
if (!TextInternal(aText, next, 0)) return false;
}
next = aCurrent->NextSibling();
next = aCurrent->LocalNextSibling();
if (next) {
if (!TextInternal(aText, next, 0)) return false;
}
@ -491,11 +491,11 @@ Accessible* TextRange::CommonParent(Accessible* aAcc1, Accessible* aAcc2,
Accessible* p2 = aAcc2;
do {
aParents1->AppendElement(p1);
p1 = p1->Parent();
p1 = p1->LocalParent();
} while (p1);
do {
aParents2->AppendElement(p2);
p2 = p2->Parent();
p2 = p2->LocalParent();
} while (p2);
// Find where the parent chain differs

View File

@ -35,7 +35,7 @@ void TextUpdater::Run(DocAccessible* aDocument, TextLeafAccessible* aTextLeaf,
void TextUpdater::DoUpdate(const nsAString& aNewText, const nsAString& aOldText,
uint32_t aSkipStart) {
Accessible* parent = mTextLeaf->Parent();
Accessible* parent = mTextLeaf->LocalParent();
if (!parent) return;
mHyperText = parent->AsHyperText();

View File

@ -120,7 +120,7 @@ bool TreeWalker::Seek(nsIContent* aChildNode) {
MOZ_ASSERT(
!(mFlags & eScoped),
"Walker should not be scoped when seeking into relocated children");
if (child->Parent() != mContext) {
if (child->LocalParent() != mContext) {
return false;
}

View File

@ -75,7 +75,7 @@ int32_t nsAccUtils::GetDefaultLevel(const Accessible* aAccessible) {
if (role == roles::OUTLINEITEM) return 1;
if (role == roles::ROW) {
Accessible* parent = aAccessible->Parent();
Accessible* parent = aAccessible->LocalParent();
// It is a row inside flatten treegrid. Group level is always 1 until it
// is overriden by aria-level attribute.
if (parent && parent->Role() == roles::TREE_TABLE) return 1;
@ -239,7 +239,7 @@ Accessible* nsAccUtils::GetSelectableContainer(Accessible* aAccessible,
if (!(aState & states::SELECTABLE)) return nullptr;
Accessible* parent = aAccessible;
while ((parent = parent->Parent()) && !parent->IsSelect()) {
while ((parent = parent->LocalParent()) && !parent->IsSelect()) {
if (parent->Role() == roles::PANE) return nullptr;
}
return parent;
@ -253,14 +253,14 @@ bool nsAccUtils::IsDOMAttrTrue(const Accessible* aAccessible, nsAtom* aAttr) {
Accessible* nsAccUtils::TableFor(Accessible* aRow) {
if (aRow) {
Accessible* table = aRow->Parent();
Accessible* table = aRow->LocalParent();
if (table) {
roles::Role tableRole = table->Role();
const nsRoleMapEntry* roleMapEntry = table->ARIARoleMap();
if (tableRole == roles::GROUPING || // if there's a rowgroup.
(table->IsGenericHyperText() && !roleMapEntry &&
!table->IsTable())) { // or there is a wrapping text container
table = table->Parent();
table = table->LocalParent();
if (table) tableRole = table->Role();
}
@ -284,7 +284,7 @@ HyperTextAccessible* nsAccUtils::GetTextContainer(nsINode* aNode) {
HyperTextAccessible* textAcc = accessible->AsHyperText();
if (textAcc) return textAcc;
accessible = accessible->Parent();
accessible = accessible->LocalParent();
} while (accessible);
return nullptr;
@ -344,7 +344,7 @@ void nsAccUtils::ConvertScreenCoordsTo(int32_t* aX, int32_t* aY,
}
nsIntPoint nsAccUtils::GetScreenCoordsForParent(Accessible* aAccessible) {
Accessible* parent = aAccessible->Parent();
Accessible* parent = aAccessible->LocalParent();
if (!parent) return nsIntPoint(0, 0);
nsIFrame* parentFrame = parent->GetFrame();
@ -381,7 +381,7 @@ bool nsAccUtils::IsTextInterfaceSupportCorrect(Accessible* aAccessible) {
bool foundText = false;
uint32_t childCount = aAccessible->ChildCount();
for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
Accessible* child = aAccessible->GetChildAt(childIdx);
Accessible* child = aAccessible->LocalChildAt(childIdx);
if (child->IsText()) {
foundText = true;
break;

View File

@ -1011,7 +1011,7 @@ Accessible* nsAccessibilityService::CreateAccessible(nsINode* aNode,
} else if (roleMapEntry->IsOfType(eTableRow)) {
if (aContext->IsTable() ||
(aContext->Parent() && aContext->Parent()->IsTable())) {
(aContext->LocalParent() && aContext->LocalParent()->IsTable())) {
newAcc = new ARIARowAccessible(content, document);
}
@ -1347,8 +1347,10 @@ nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
// Accessible HTML table row may be a child of tbody/tfoot/thead of
// accessible HTML table or a direct child of accessible of HTML table.
Accessible* table = aContext->IsTable() ? aContext : nullptr;
if (!table && aContext->Parent() && aContext->Parent()->IsTable())
table = aContext->Parent();
if (!table && aContext->LocalParent() &&
aContext->LocalParent()->IsTable()) {
table = aContext->LocalParent();
}
if (table) {
nsIContent* parentContent =

View File

@ -419,7 +419,7 @@ bool nsAccessiblePivot::IsDescendantOf(Accessible* aAccessible,
Accessible* accessible = aAccessible;
do {
if (accessible == aAncestor) return true;
} while ((accessible = accessible->Parent()));
} while ((accessible = accessible->LocalParent()));
return false;
}

View File

@ -158,7 +158,7 @@ nsresult nsTextEquivUtils::AppendFromAccessibleChildren(
uint32_t childCount = aAccessible->ChildCount();
for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
Accessible* child = aAccessible->GetChildAt(childIdx);
Accessible* child = aAccessible->LocalChildAt(childIdx);
rv = AppendFromAccessible(child, aString);
NS_ENSURE_SUCCESS(rv, rv);
}

View File

@ -422,7 +422,7 @@ nsresult ARIAGridAccessible::SetARIASelected(Accessible* aAccessible,
// siblings cells.
if (role == roles::GRID_CELL || role == roles::ROWHEADER ||
role == roles::COLUMNHEADER) {
Accessible* row = aAccessible->Parent();
Accessible* row = aAccessible->LocalParent();
if (row && row->Role() == roles::ROW && nsAccUtils::IsARIASelected(row)) {
rv = SetARIASelected(row, false, false);
@ -535,7 +535,7 @@ uint32_t ARIAGridCellAccessible::ColIdx() const {
int32_t indexInRow = IndexInParent();
uint32_t colIdx = 0;
for (int32_t idx = 0; idx < indexInRow; idx++) {
Accessible* cell = row->GetChildAt(idx);
Accessible* cell = row->LocalChildAt(idx);
if (cell->IsTableCell()) {
colIdx += cell->AsTableCell()->ColExtent();
}
@ -563,7 +563,7 @@ void ARIAGridCellAccessible::ApplyARIAState(uint64_t* aState) const {
if (*aState & states::SELECTED) return;
// Check aria-selected="true" on the row.
Accessible* row = Parent();
Accessible* row = LocalParent();
if (!row || row->Role() != roles::ROW) return;
nsIContent* rowContent = row->GetContent();
@ -591,7 +591,7 @@ ARIAGridCellAccessible::NativeAttributes() {
int32_t colIdx = 0, colCount = 0;
uint32_t childCount = thisRow->ChildCount();
for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
Accessible* child = thisRow->GetChildAt(childIdx);
Accessible* child = thisRow->LocalChildAt(childIdx);
if (child == this) colIdx = colCount;
roles::Role role = child->Role();

View File

@ -111,7 +111,7 @@ class ARIAGridCellAccessible : public HyperTextAccessibleWrap,
* Return a containing row.
*/
Accessible* Row() const {
Accessible* row = Parent();
Accessible* row = LocalParent();
return row && row->IsTableRow() ? row : nullptr;
}

View File

@ -109,10 +109,10 @@ inline bool Accessible::InsertAfter(Accessible* aNewChild,
Accessible* aRefChild) {
MOZ_ASSERT(aNewChild, "No new child to insert");
if (aRefChild && aRefChild->Parent() != this) {
if (aRefChild && aRefChild->LocalParent() != this) {
#ifdef A11Y_LOG
logging::TreeInfo("broken accessible tree", 0, "parent", this,
"prev sibling parent", aRefChild->Parent(), "child",
"prev sibling parent", aRefChild->LocalParent(), "child",
aNewChild, nullptr);
if (logging::IsEnabled(logging::eVerbose)) {
logging::Tree("TREE", "Document tree", mDoc);

View File

@ -459,7 +459,9 @@ bool Accessible::NativelyUnavailable() const {
Accessible* Accessible::FocusedChild() {
Accessible* focus = FocusMgr()->FocusedAccessible();
if (focus && (focus == this || focus->Parent() == this)) return focus;
if (focus && (focus == this || focus->LocalParent() == this)) {
return focus;
}
return nullptr;
}
@ -511,7 +513,7 @@ Accessible* Accessible::ChildAtPoint(int32_t aX, int32_t aY,
popupDoc->GetAccessibleOrContainer(popupFrame->GetContent());
Accessible* popupChild = this;
while (popupChild && !popupChild->IsDoc() && popupChild != popupAcc)
popupChild = popupChild->Parent();
popupChild = popupChild->LocalParent();
if (popupChild == popupAcc) startFrame = popupFrame;
}
@ -545,7 +547,7 @@ Accessible* Accessible::ChildAtPoint(int32_t aX, int32_t aY,
// ensure obtained accessible is a child of this accessible.
Accessible* child = accessible;
while (child != this) {
Accessible* parent = child->Parent();
Accessible* parent = child->LocalParent();
if (!parent) {
// Reached the top of the hierarchy. These bounds were inside an
// accessible that is not a descendant of this one.
@ -566,7 +568,7 @@ Accessible* Accessible::ChildAtPoint(int32_t aX, int32_t aY,
// OuterDocAccessibles).
uint32_t childCount = accessible->ChildCount();
for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
Accessible* child = accessible->GetChildAt(childIdx);
Accessible* child = accessible->LocalChildAt(childIdx);
nsIntRect childRect = child->Bounds();
if (childRect.Contains(aX, aY) &&
@ -1225,7 +1227,7 @@ void Accessible::ApplyARIAState(uint64_t* aState) const {
// If has a role & ID and aria-activedescendant on the container, assume
// focusable.
const Accessible* ancestor = this;
while ((ancestor = ancestor->Parent()) && !ancestor->IsDoc()) {
while ((ancestor = ancestor->LocalParent()) && !ancestor->IsDoc()) {
dom::Element* el = ancestor->Elm();
if (el &&
el->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant)) {
@ -1239,7 +1241,7 @@ void Accessible::ApplyARIAState(uint64_t* aState) const {
if (*aState & states::FOCUSABLE) {
// Propogate aria-disabled from ancestors down to any focusable descendant.
const Accessible* ancestor = this;
while ((ancestor = ancestor->Parent()) && !ancestor->IsDoc()) {
while ((ancestor = ancestor->LocalParent()) && !ancestor->IsDoc()) {
dom::Element* el = ancestor->Elm();
if (el && el->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_disabled,
nsGkAtoms::_true, eCaseMatters)) {
@ -1651,7 +1653,7 @@ Relation Accessible::RelationByType(RelationType aType) const {
if (view) {
nsIScrollableFrame* scrollFrame = do_QueryFrame(frame);
if (scrollFrame || view->GetWidget() || !frame->GetParent())
rel.AppendTarget(Parent());
rel.AppendTarget(LocalParent());
}
}
@ -1698,9 +1700,9 @@ Relation Accessible::RelationByType(RelationType aType) const {
* radio button (because input=radio buttons are
* HTMLRadioButtonAccessibles) */
Relation rel = Relation();
Accessible* currParent = Parent();
Accessible* currParent = LocalParent();
while (currParent && currParent->Role() != roles::RADIO_GROUP) {
currParent = currParent->Parent();
currParent = currParent->LocalParent();
}
if (currParent && currParent->Role() == roles::RADIO_GROUP) {
@ -2208,7 +2210,7 @@ void Accessible::RelocateChild(uint32_t aNewIndex, Accessible* aChild) {
MOZ_DIAGNOSTIC_ASSERT(aChild->mIndexInParent != -1,
"Unbound child was given");
MOZ_DIAGNOSTIC_ASSERT(
aChild->mParent->GetChildAt(aChild->mIndexInParent) == aChild,
aChild->mParent->LocalChildAt(aChild->mIndexInParent) == aChild,
"Wrong index in parent");
MOZ_DIAGNOSTIC_ASSERT(
static_cast<uint32_t>(aChild->mIndexInParent) != aNewIndex,
@ -2257,7 +2259,7 @@ void Accessible::RelocateChild(uint32_t aNewIndex, Accessible* aChild) {
aChild->SetShowEventTarget(true);
}
Accessible* Accessible::GetChildAt(uint32_t aIndex) const {
Accessible* Accessible::LocalChildAt(uint32_t aIndex) const {
Accessible* child = mChildren.SafeElementAt(aIndex, nullptr);
if (!child) return nullptr;
@ -2293,7 +2295,7 @@ Accessible* Accessible::GetEmbeddedChildAt(uint32_t aIndex) {
: nullptr;
}
return GetChildAt(aIndex);
return LocalChildAt(aIndex);
}
int32_t Accessible::GetIndexOfEmbeddedChild(Accessible* aChild) {
@ -2358,7 +2360,7 @@ void Accessible::ToTextPoint(HyperTextAccessible** aContainer, int32_t* aOffset,
const Accessible* parent = this;
do {
child = parent;
parent = parent->Parent();
parent = parent->LocalParent();
} while (parent && !parent->IsHyperText());
if (parent) {
@ -2516,7 +2518,8 @@ void Accessible::SetCurrentItem(const Accessible* aItem) {
Accessible* Accessible::ContainerWidget() const {
if (HasARIARole() && mContent->HasID()) {
for (Accessible* parent = Parent(); parent; parent = parent->Parent()) {
for (Accessible* parent = LocalParent(); parent;
parent = parent->LocalParent()) {
nsIContent* parentContent = parent->GetContent();
if (parentContent && parentContent->IsElement() &&
parentContent->AsElement()->HasAttr(
@ -2565,7 +2568,7 @@ Accessible* Accessible::GetSiblingAtOffset(int32_t aOffset,
return nullptr;
}
Accessible* child = mParent->GetChildAt(mIndexInParent + aOffset);
Accessible* child = mParent->LocalChildAt(mIndexInParent + aOffset);
if (aError && !child) *aError = NS_ERROR_UNEXPECTED;
return child;
@ -2660,7 +2663,7 @@ int32_t Accessible::GetLevelInternal() {
level = 1;
Accessible* parent = this;
while ((parent = parent->Parent())) {
while ((parent = parent->LocalParent())) {
roles::Role parentRole = parent->Role();
if (parentRole == roles::OUTLINE) break;
@ -2677,7 +2680,7 @@ int32_t Accessible::GetLevelInternal() {
// Calculate 'level' attribute based on number of parent listitems.
level = 0;
Accessible* parent = this;
while ((parent = parent->Parent())) {
while ((parent = parent->LocalParent())) {
roles::Role parentRole = parent->Role();
if (parentRole == roles::LISTITEM)
@ -2689,12 +2692,12 @@ int32_t Accessible::GetLevelInternal() {
if (level == 0) {
// If this listitem is on top of nested lists then expose 'level'
// attribute.
parent = Parent();
parent = LocalParent();
uint32_t siblingCount = parent->ChildCount();
for (uint32_t siblingIdx = 0; siblingIdx < siblingCount; siblingIdx++) {
Accessible* sibling = parent->GetChildAt(siblingIdx);
Accessible* sibling = parent->LocalChildAt(siblingIdx);
Accessible* siblingChild = sibling->LastChild();
Accessible* siblingChild = sibling->LocalLastChild();
if (siblingChild) {
roles::Role lastChildRole = siblingChild->Role();
if (lastChildRole == roles::LIST || lastChildRole == roles::GROUPING)
@ -2710,7 +2713,7 @@ int32_t Accessible::GetLevelInternal() {
level = 1;
Accessible* parent = this;
while ((parent = parent->Parent())) {
while ((parent = parent->LocalParent())) {
roles::Role parentRole = parent->Role();
if (parentRole == roles::COMMENT) {
++level;

View File

@ -388,12 +388,12 @@ class Accessible : public nsISupports {
/**
* Return parent accessible.
*/
Accessible* Parent() const { return mParent; }
Accessible* LocalParent() const { return mParent; }
/**
* Return child accessible at the given index.
*/
virtual Accessible* GetChildAt(uint32_t aIndex) const;
virtual Accessible* LocalChildAt(uint32_t aIndex) const;
/**
* Return child accessible count.
@ -415,17 +415,17 @@ class Accessible : public nsISupports {
/**
* Return true if accessible has children;
*/
bool HasChildren() const { return !!GetChildAt(0); }
bool HasChildren() const { return !!LocalChildAt(0); }
/**
* Return first/last/next/previous sibling of the accessible.
*/
inline Accessible* NextSibling() const { return GetSiblingAtOffset(1); }
inline Accessible* PrevSibling() const { return GetSiblingAtOffset(-1); }
inline Accessible* FirstChild() const { return GetChildAt(0); }
inline Accessible* LastChild() const {
inline Accessible* LocalNextSibling() const { return GetSiblingAtOffset(1); }
inline Accessible* LocalPrevSibling() const { return GetSiblingAtOffset(-1); }
inline Accessible* LocalFirstChild() const { return LocalChildAt(0); }
inline Accessible* LocalLastChild() const {
uint32_t childCount = ChildCount();
return childCount != 0 ? GetChildAt(childCount - 1) : nullptr;
return childCount != 0 ? LocalChildAt(childCount - 1) : nullptr;
}
/**

View File

@ -80,7 +80,9 @@ Accessible* ApplicationAccessible::ChildAtPoint(
Accessible* ApplicationAccessible::FocusedChild() {
Accessible* focus = FocusMgr()->FocusedAccessible();
if (focus && focus->Parent() == this) return focus;
if (focus && focus->LocalParent() == this) {
return focus;
}
return nullptr;
}

View File

@ -118,7 +118,7 @@ const Accessible* LinkableAccessible::ActionWalk(
// on non accessible node in parent chain but this node is skipped when tree
// is traversed.
const Accessible* walkUpAcc = this;
while ((walkUpAcc = walkUpAcc->Parent()) && !walkUpAcc->IsDoc()) {
while ((walkUpAcc = walkUpAcc->LocalParent()) && !walkUpAcc->IsDoc()) {
if (walkUpAcc->LinkState() & states::LINKED) {
if (aIsLink) {
*aIsLink = true;

View File

@ -28,7 +28,7 @@ inline Accessible* DocAccessible::AccessibleOrTrueContainer(
// containing all options.
Accessible* container = GetAccessibleOrContainer(aNode, aNoContainerIfPruned);
if (container && container->IsHTMLCombobox()) {
return container->FirstChild();
return container->LocalFirstChild();
}
return container;
}

View File

@ -1762,7 +1762,7 @@ void DocAccessible::DoInitialUpdate() {
// this document may be fired prior to this reorder event. If this is
// a problem then consider to keep event processing per tab document.
if (!IsRoot()) {
RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(Parent());
RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(LocalParent());
ParentDocument()->FireDelayedEvent(reorderEvent);
}
@ -2035,7 +2035,7 @@ bool InsertIterator::Next() {
// HTML comboboxes have no-content list accessible as an intermediate
// containing all options.
if (container->IsHTMLCombobox()) {
container = container->FirstChild();
container = container->LocalFirstChild();
}
if (!container->IsAcceptableChild(node)) {
@ -2097,12 +2097,12 @@ void DocAccessible::ProcessContentInserted(
TreeMutation mt(aContainer);
do {
Accessible* parent = iter.Child()->Parent();
Accessible* parent = iter.Child()->LocalParent();
if (parent) {
Accessible* previousSibling = iter.ChildBefore();
if (parent != aContainer ||
iter.Child()->PrevSibling() != previousSibling) {
if (previousSibling && previousSibling->Parent() != aContainer) {
iter.Child()->LocalPrevSibling() != previousSibling) {
if (previousSibling && previousSibling->LocalParent() != aContainer) {
// previousSibling hasn't been moved into aContainer yet.
// previousSibling should be later in the insertion list, so the tree
// will get adjusted when we process it later.
@ -2196,12 +2196,12 @@ void DocAccessible::FireEventsOnInsertion(Accessible* aContainer) {
FireDelayedEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor);
break;
}
} while ((ancestor = ancestor->Parent()));
} while ((ancestor = ancestor->LocalParent()));
}
}
void DocAccessible::ContentRemoved(Accessible* aChild) {
Accessible* parent = aChild->Parent();
Accessible* parent = aChild->LocalParent();
MOZ_DIAGNOSTIC_ASSERT(parent, "Unattached accessible from tree");
#ifdef A11Y_LOG
@ -2221,7 +2221,7 @@ void DocAccessible::ContentRemoved(Accessible* aChild) {
return;
}
MOZ_DIAGNOSTIC_ASSERT(aChild->Parent(), "Alive but unparented #1");
MOZ_DIAGNOSTIC_ASSERT(aChild->LocalParent(), "Alive but unparented #1");
if (aChild->IsRelocated()) {
nsTArray<RefPtr<Accessible>>* owned = mARIAOwnsHash.Get(parent);
@ -2231,7 +2231,7 @@ void DocAccessible::ContentRemoved(Accessible* aChild) {
mARIAOwnsHash.Remove(parent);
}
}
MOZ_DIAGNOSTIC_ASSERT(aChild->Parent(), "Unparented #2");
MOZ_DIAGNOSTIC_ASSERT(aChild->LocalParent(), "Unparented #2");
parent->RemoveChild(aChild);
UncacheChildrenInSubtree(aChild);
@ -2340,7 +2340,7 @@ void DocAccessible::DoARIAOwnsRelocation(Accessible* aOwner) {
}
// Same child on same position, no change.
if (child->Parent() == aOwner) {
if (child->LocalParent() == aOwner) {
int32_t indexInParent = child->IndexInParent();
// The child is being placed in its current index,
@ -2372,7 +2372,7 @@ void DocAccessible::DoARIAOwnsRelocation(Accessible* aOwner) {
MOZ_ASSERT(owned->SafeElementAt(idx) != child, "Already in place!");
// A new child is found, check for loops.
if (child->Parent() != aOwner) {
if (child->LocalParent() != aOwner) {
// Child is aria-owned by another container, skip.
if (child->IsRelocated()) {
continue;
@ -2380,7 +2380,7 @@ void DocAccessible::DoARIAOwnsRelocation(Accessible* aOwner) {
Accessible* parent = aOwner;
while (parent && parent != child && !parent->IsDoc()) {
parent = parent->Parent();
parent = parent->LocalParent();
}
// A referred child cannot be a parent of the owner.
if (parent == child) {
@ -2415,7 +2415,7 @@ void DocAccessible::PutChildrenBack(nsTArray<RefPtr<Accessible>>* aChildren,
}
// Remove the child from the owner
Accessible* owner = child->Parent();
Accessible* owner = child->LocalParent();
if (!owner) {
NS_ERROR("Cannot put the child back. No parent, a broken tree.");
continue;
@ -2439,9 +2439,9 @@ void DocAccessible::PutChildrenBack(nsTArray<RefPtr<Accessible>>* aChildren,
Accessible* prevChild = walker.Prev();
if (prevChild) {
idxInParent = prevChild->IndexInParent() + 1;
MOZ_DIAGNOSTIC_ASSERT(origContainer == prevChild->Parent(),
MOZ_DIAGNOSTIC_ASSERT(origContainer == prevChild->LocalParent(),
"Broken tree");
origContainer = prevChild->Parent();
origContainer = prevChild->LocalParent();
} else {
idxInParent = 0;
}
@ -2460,9 +2460,11 @@ void DocAccessible::PutChildrenBack(nsTArray<RefPtr<Accessible>>* aChildren,
DebugOnly<bool> moved = MoveChild(child, origContainer, idxInParent);
MOZ_ASSERT(moved, "Failed to put child back.");
} else {
MOZ_ASSERT(!child->PrevSibling() || !child->PrevSibling()->IsRelocated(),
MOZ_ASSERT(!child->LocalPrevSibling() ||
!child->LocalPrevSibling()->IsRelocated(),
"No relocated child should appear before this one");
MOZ_ASSERT(!child->NextSibling() || child->NextSibling()->IsRelocated(),
MOZ_ASSERT(!child->LocalNextSibling() ||
child->LocalNextSibling()->IsRelocated(),
"No ordinal child should appear after this one");
}
}
@ -2473,14 +2475,14 @@ void DocAccessible::PutChildrenBack(nsTArray<RefPtr<Accessible>>* aChildren,
bool DocAccessible::MoveChild(Accessible* aChild, Accessible* aNewParent,
int32_t aIdxInParent) {
MOZ_ASSERT(aChild, "No child");
MOZ_ASSERT(aChild->Parent(), "No parent");
MOZ_ASSERT(aChild->LocalParent(), "No parent");
// We can't guarantee MoveChild works correctly for accessibilities storing
// children outside mChildren.
MOZ_ASSERT(
aIdxInParent <= static_cast<int32_t>(aNewParent->mChildren.Length()),
"Wrong insertion point for a moving child");
Accessible* curParent = aChild->Parent();
Accessible* curParent = aChild->LocalParent();
if (!aNewParent->IsAcceptableChild(aChild->GetContent())) {
return false;
@ -2555,7 +2557,7 @@ void DocAccessible::CacheChildrenInSubtree(Accessible* aRoot,
FocusMgr()->HasDOMFocus(aRoot->GetContent()))
*aFocusedAcc = aRoot;
Accessible* root = aRoot->IsHTMLCombobox() ? aRoot->FirstChild() : aRoot;
Accessible* root = aRoot->IsHTMLCombobox() ? aRoot->LocalFirstChild() : aRoot;
if (root->KidsFromDOM()) {
TreeMutation mt(root, TreeMutation::kNoEvents);
TreeWalker walker(root);

View File

@ -292,7 +292,7 @@ void HyperTextAccessible::TextSubstring(int32_t aStartOffset,
int32_t childOffset = GetChildOffset(startChildIdx);
if (childOffset == -1) return;
Accessible* child = GetChildAt(startChildIdx);
Accessible* child = LocalChildAt(startChildIdx);
child->AppendTextTo(aText, startOffset - childOffset,
endOffset - startOffset);
return;
@ -301,19 +301,19 @@ void HyperTextAccessible::TextSubstring(int32_t aStartOffset,
int32_t startChildOffset = GetChildOffset(startChildIdx);
if (startChildOffset == -1) return;
Accessible* startChild = GetChildAt(startChildIdx);
Accessible* startChild = LocalChildAt(startChildIdx);
startChild->AppendTextTo(aText, startOffset - startChildOffset);
for (int32_t childIdx = startChildIdx + 1; childIdx < endChildIdx;
childIdx++) {
Accessible* child = GetChildAt(childIdx);
Accessible* child = LocalChildAt(childIdx);
child->AppendTextTo(aText);
}
int32_t endChildOffset = GetChildOffset(endChildIdx);
if (endChildOffset == -1) return;
Accessible* endChild = GetChildAt(endChildIdx);
Accessible* endChild = LocalChildAt(endChildIdx);
endChild->AppendTextTo(aText, 0, endOffset - endChildOffset);
}
@ -406,7 +406,7 @@ uint32_t HyperTextAccessible::TransformOffset(Accessible* aDescendant,
uint32_t offset = aOffset;
Accessible* descendant = aDescendant;
while (descendant) {
Accessible* parent = descendant->Parent();
Accessible* parent = descendant->LocalParent();
if (parent == this) return GetChildOffset(descendant) + offset;
// This offset no longer applies because the passed-in text object is not
@ -422,8 +422,9 @@ uint32_t HyperTextAccessible::TransformOffset(Accessible* aDescendant,
// for a list when it should return the list bullet.
// We manually set the offset so the error doesn't propagate up.
if (offset == 0 && parent && parent->IsHTMLListItem() &&
descendant->PrevSibling() && descendant->PrevSibling()->GetFrame() &&
descendant->PrevSibling()->GetFrame()->IsBulletFrame()) {
descendant->LocalPrevSibling() &&
descendant->LocalPrevSibling()->GetFrame() &&
descendant->LocalPrevSibling()->GetFrame()->IsBulletFrame()) {
offset = 0;
} else {
offset = (offset > 0 || descendant->IndexInParent() > 0) ? 1 : 0;
@ -455,7 +456,7 @@ DOMPoint HyperTextAccessible::OffsetToDOMPoint(int32_t aOffset) const {
int32_t childIdx = GetChildIndexAtOffset(aOffset);
if (childIdx == -1) return DOMPoint();
Accessible* child = GetChildAt(childIdx);
Accessible* child = LocalChildAt(childIdx);
int32_t innerOffset = aOffset - GetChildOffset(childIdx);
// A text leaf case.
@ -509,7 +510,7 @@ uint32_t HyperTextAccessible::FindOffset(uint32_t aOffset,
return DOMPointToOffset(text->GetNode(), 0, aDirection == eDirNext);
}
child = text->GetChildAt(childIdx);
child = text->LocalChildAt(childIdx);
// HTML list items may need special processing because PeekOffset doesn't
// work with list bullets.
@ -1264,7 +1265,7 @@ int32_t HyperTextAccessible::GetLevelInternal() {
void HyperTextAccessible::SetMathMLXMLRoles(
nsIPersistentProperties* aAttributes) {
// Add MathML xmlroles based on the position inside the parent.
Accessible* parent = Parent();
Accessible* parent = LocalParent();
if (parent) {
switch (parent->Role()) {
case roles::MATHML_CELL:
@ -1284,10 +1285,10 @@ void HyperTextAccessible::SetMathMLXMLRoles(
nsEmbellishData embellishData;
mathMLFrame->GetEmbellishData(embellishData);
if (NS_MATHML_EMBELLISH_IS_FENCE(embellishData.flags)) {
if (!PrevSibling()) {
if (!LocalPrevSibling()) {
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::xmlroles,
nsGkAtoms::open_fence);
} else if (!NextSibling()) {
} else if (!LocalNextSibling()) {
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::xmlroles,
nsGkAtoms::close_fence);
}
@ -1542,7 +1543,7 @@ nsIntRect HyperTextAccessible::TextBounds(int32_t aStartOffset,
int32_t offset1 = startOffset - prevOffset;
while (childIdx < static_cast<int32_t>(ChildCount())) {
nsIFrame* frame = GetChildAt(childIdx++)->GetFrame();
nsIFrame* frame = LocalChildAt(childIdx++)->GetFrame();
if (!frame) {
MOZ_ASSERT_UNREACHABLE("No frame for a child!");
continue;
@ -1585,7 +1586,7 @@ already_AddRefed<TextEditor> HyperTextAccessible::GetEditor() const {
if (!mContent->HasFlag(NODE_IS_EDITABLE)) {
// If we're inside an editable container, then return that container's
// editor
Accessible* ancestor = Parent();
Accessible* ancestor = LocalParent();
while (ancestor) {
HyperTextAccessible* hyperText = ancestor->AsHyperText();
if (hyperText) {
@ -1594,7 +1595,7 @@ already_AddRefed<TextEditor> HyperTextAccessible::GetEditor() const {
return hyperText->GetEditor();
}
ancestor = ancestor->Parent();
ancestor = ancestor->LocalParent();
}
return nullptr;
@ -2037,8 +2038,9 @@ void HyperTextAccessible::RangeByChild(Accessible* aChild,
Accessible* child = aChild;
Accessible* parent = nullptr;
while ((parent = child->Parent()) && !(ht = parent->AsHyperText()))
while ((parent = child->LocalParent()) && !(ht = parent->AsHyperText())) {
child = parent;
}
// If no text then return collapsed text range, otherwise return a range
// containing the text enclosed by the given child.
@ -2057,7 +2059,9 @@ void HyperTextAccessible::RangeAtPoint(int32_t aX, int32_t aY,
if (!child) return;
Accessible* parent = nullptr;
while ((parent = child->Parent()) && !parent->IsHyperText()) child = parent;
while ((parent = child->LocalParent()) && !parent->IsHyperText()) {
child = parent;
}
// Return collapsed text range for the point.
if (parent) {
@ -2122,7 +2126,7 @@ Relation HyperTextAccessible::RelationByType(RelationType aType) const {
switch (aType) {
case RelationType::NODE_CHILD_OF:
if (HasOwnContent() && mContent->IsMathMLElement()) {
Accessible* parent = Parent();
Accessible* parent = LocalParent();
if (parent) {
nsIContent* parentContent = parent->GetContent();
if (parentContent &&
@ -2135,8 +2139,8 @@ Relation HyperTextAccessible::RelationByType(RelationType aType) const {
break;
case RelationType::NODE_PARENT_OF:
if (HasOwnContent() && mContent->IsMathMLElement(nsGkAtoms::mroot_)) {
Accessible* base = GetChildAt(0);
Accessible* index = GetChildAt(1);
Accessible* base = LocalChildAt(0);
Accessible* index = LocalChildAt(1);
if (base && index) {
// Append the <mroot> children in the order index, base.
rel.AppendTarget(index);
@ -2252,7 +2256,7 @@ int32_t HyperTextAccessible::GetChildIndexAtOffset(uint32_t aOffset) const {
uint32_t childCount = ChildCount();
while (mOffsets.Length() < childCount) {
Accessible* child = GetChildAt(mOffsets.Length());
Accessible* child = LocalChildAt(mOffsets.Length());
lastOffset += nsAccUtils::TextLength(child);
mOffsets.AppendElement(lastOffset);
if (aOffset < lastOffset) return mOffsets.Length() - 1;

View File

@ -167,7 +167,7 @@ class HyperTextAccessible : public AccessibleWrap {
int32_t childIdx = GetChildIndexAtOffset(aOffset);
if (childIdx == -1) return false;
Accessible* child = GetChildAt(childIdx);
Accessible* child = LocalChildAt(childIdx);
child->AppendTextTo(aChar, aOffset - GetChildOffset(childIdx), 1);
if (aStartOffset && aEndOffset) {
@ -260,7 +260,7 @@ class HyperTextAccessible : public AccessibleWrap {
* @param aOffset [in] the given text offset
*/
Accessible* GetChildAtOffset(uint32_t aOffset) const {
return GetChildAt(GetChildIndexAtOffset(aOffset));
return LocalChildAt(GetChildIndexAtOffset(aOffset));
}
/**

View File

@ -85,7 +85,7 @@ Accessible* OuterDocAccessible::ChildAtPoint(int32_t aX, int32_t aY,
// Always return the inner doc as direct child accessible unless bounds
// outside of it.
Accessible* child = GetChildAt(0);
Accessible* child = LocalChildAt(0);
NS_ENSURE_TRUE(child, nullptr);
if (aWhichChild == eDeepestChild) {
@ -224,8 +224,8 @@ uint32_t OuterDocAccessible::ChildCount() const {
return result;
}
Accessible* OuterDocAccessible::GetChildAt(uint32_t aIndex) const {
Accessible* result = AccessibleWrap::GetChildAt(aIndex);
Accessible* OuterDocAccessible::LocalChildAt(uint32_t aIndex) const {
Accessible* result = AccessibleWrap::LocalChildAt(aIndex);
if (result || aIndex) {
return result;
}

View File

@ -59,7 +59,7 @@ class OuterDocAccessible final : public AccessibleWrap {
#if defined(XP_WIN)
virtual uint32_t ChildCount() const override;
virtual Accessible* GetChildAt(uint32_t aIndex) const override;
virtual Accessible* LocalChildAt(uint32_t aIndex) const override;
#endif // defined(XP_WIN)
protected:

View File

@ -501,7 +501,7 @@ void RootAccessible::HandlePopupShownEvent(Accessible* aAccessible) {
if (role == roles::COMBOBOX_LIST) {
// Fire expanded state change event for comboboxes and autocompeletes.
Accessible* combobox = aAccessible->Parent();
Accessible* combobox = aAccessible->LocalParent();
if (!combobox) return;
if (combobox->IsCombobox() || combobox->IsAutoComplete()) {
@ -550,7 +550,7 @@ void RootAccessible::HandlePopupHidingEvent(nsINode* aPopupNode) {
uint32_t childCount = popupContainer->ChildCount();
for (uint32_t idx = 0; idx < childCount; idx++) {
Accessible* child = popupContainer->GetChildAt(idx);
Accessible* child = popupContainer->LocalChildAt(idx);
if (child->IsAutoCompletePopup()) {
popup = child;
break;

View File

@ -75,7 +75,7 @@ bool TableAccessible::IsProbablyLayoutTable() {
}
// Check for legitimate data table elements.
Accessible* caption = thisacc->FirstChild();
Accessible* caption = thisacc->LocalFirstChild();
if (caption && caption->IsHTMLCaption() && caption->HasChildren()) {
RETURN_LAYOUT_ANSWER(false,
"Not empty caption -- legitimate table structures");
@ -135,7 +135,7 @@ bool TableAccessible::IsProbablyLayoutTable() {
}
}
if (cell->ChildCount() == 1 &&
cell->FirstChild()->IsAbbreviation()) {
cell->LocalFirstChild()->IsAbbreviation()) {
RETURN_LAYOUT_ANSWER(
false, "has abbr -- legitimate table structures");
}
@ -198,7 +198,7 @@ bool TableAccessible::IsProbablyLayoutTable() {
nscolor rowColor = 0;
nscolor prevRowColor;
for (auto childIdx = 0U; childIdx < childCount; childIdx++) {
Accessible* child = thisacc->GetChildAt(childIdx);
Accessible* child = thisacc->LocalChildAt(childIdx);
if (child->IsHTMLTableRow()) {
prevRowColor = rowColor;
nsIFrame* rowFrame = child->GetFrame();

View File

@ -160,7 +160,7 @@ HTMLSummaryAccessible* HTMLSummaryAccessible::FromDetails(Accessible* details) {
// Iterate through the children of our details accessible to locate main
// summary. This iteration includes the anonymous summary if the details
// element was not explicitly created with one.
Accessible* child = details->GetChildAt(i);
Accessible* child = details->LocalChildAt(i);
auto* summary =
mozilla::dom::HTMLSummaryElement::FromNodeOrNull(child->GetContent());
if (summary && summary->IsMainSummary()) {

View File

@ -449,7 +449,7 @@ nsresult HTMLFileInputAccessible::HandleAccEvent(AccEvent* aEvent) {
event->GetState() == states::REQUIRED ||
event->GetState() == states::HASPOPUP ||
event->GetState() == states::INVALID)) {
Accessible* button = GetChildAt(0);
Accessible* button = LocalChildAt(0);
if (button && button->Role() == roles::PUSHBUTTON) {
RefPtr<AccStateChangeEvent> childEvent = new AccStateChangeEvent(
button, event->GetState(), event->IsStateEnabled(),
@ -469,7 +469,7 @@ Accessible* HTMLFileInputAccessible::CurrentItem() const {
// The HTML file input itself gets DOM focus, not the button inside it.
// For a11y, we want the button to get focus.
Accessible* button = FirstChild();
Accessible* button = LocalFirstChild();
if (!button) {
MOZ_ASSERT_UNREACHABLE("File input doesn't contain a button");
return nullptr;
@ -633,7 +633,7 @@ Relation HTMLLegendAccessible::RelationByType(RelationType aType) const {
Relation rel = HyperTextAccessibleWrap::RelationByType(aType);
if (aType != RelationType::LABEL_FOR) return rel;
Accessible* groupbox = Parent();
Accessible* groupbox = LocalParent();
if (groupbox && groupbox->Role() == roles::GROUPING)
rel.AppendTarget(groupbox);
@ -691,7 +691,7 @@ Relation HTMLFigcaptionAccessible::RelationByType(RelationType aType) const {
Relation rel = HyperTextAccessibleWrap::RelationByType(aType);
if (aType != RelationType::LABEL_FOR) return rel;
Accessible* figure = Parent();
Accessible* figure = LocalParent();
if (figure && figure->GetContent()->NodeInfo()->Equals(
nsGkAtoms::figure, mContent->GetNameSpaceID())) {
rel.AppendTarget(figure);

View File

@ -41,12 +41,12 @@ role HTMLImageMapAccessible::NativeRole() const { return roles::IMAGE_MAP; }
uint32_t HTMLImageMapAccessible::AnchorCount() { return ChildCount(); }
Accessible* HTMLImageMapAccessible::AnchorAt(uint32_t aAnchorIndex) {
return GetChildAt(aAnchorIndex);
return LocalChildAt(aAnchorIndex);
}
already_AddRefed<nsIURI> HTMLImageMapAccessible::AnchorURIAt(
uint32_t aAnchorIndex) const {
Accessible* area = GetChildAt(aAnchorIndex);
Accessible* area = LocalChildAt(aAnchorIndex);
if (!area) return nullptr;
nsIContent* linkContent = area->GetContent();

View File

@ -171,7 +171,7 @@ uint64_t HTMLSelectOptionAccessible::NativeState() const {
// visibility implementation unless they get reimplemented in layout
state &= ~states::OFFSCREEN;
// <select> is not collapsed: compare bounds to calculate OFFSCREEN
Accessible* listAcc = Parent();
Accessible* listAcc = LocalParent();
if (listAcc) {
nsIntRect optionRect = Bounds();
nsIntRect listRect = listAcc->Bounds();
@ -234,8 +234,10 @@ void HTMLSelectOptionAccessible::SetSelected(bool aSelect) {
// HTMLSelectOptionAccessible: Widgets
Accessible* HTMLSelectOptionAccessible::ContainerWidget() const {
Accessible* parent = Parent();
if (parent && parent->IsHTMLOptGroup()) parent = parent->Parent();
Accessible* parent = LocalParent();
if (parent && parent->IsHTMLOptGroup()) {
parent = parent->LocalParent();
}
return parent && parent->IsListControl() ? parent : nullptr;
}
@ -459,7 +461,7 @@ nsRect HTMLComboboxListAccessible::RelativeBounds(
nsIFrame** aBoundingFrame) const {
*aBoundingFrame = nullptr;
Accessible* comboAcc = Parent();
Accessible* comboAcc = LocalParent();
if (!comboAcc) return nsRect();
if (0 == (comboAcc->State() & states::COLLAPSED)) {

View File

@ -88,10 +88,12 @@ class HTMLSelectOptionAccessible : public HyperTextAccessibleWrap {
*/
Accessible* GetSelect() const {
Accessible* parent = mParent;
if (parent && parent->IsHTMLOptGroup()) parent = parent->Parent();
if (parent && parent->IsHTMLOptGroup()) {
parent = parent->LocalParent();
}
if (parent && parent->IsListControl()) {
Accessible* combobox = parent->Parent();
Accessible* combobox = parent->LocalParent();
return combobox && combobox->IsCombobox() ? combobox : mParent;
}
@ -103,10 +105,12 @@ class HTMLSelectOptionAccessible : public HyperTextAccessibleWrap {
*/
Accessible* GetCombobox() const {
Accessible* parent = mParent;
if (parent && parent->IsHTMLOptGroup()) parent = parent->Parent();
if (parent && parent->IsHTMLOptGroup()) {
parent = parent->LocalParent();
}
if (parent && parent->IsListControl()) {
Accessible* combobox = parent->Parent();
Accessible* combobox = parent->LocalParent();
return combobox && combobox->IsCombobox() ? combobox : nullptr;
}

View File

@ -94,7 +94,7 @@ HTMLTableCellAccessible::NativeAttributes() {
// from abbr DOM attribute.
nsAutoString abbrText;
if (ChildCount() == 1) {
Accessible* abbr = FirstChild();
Accessible* abbr = LocalFirstChild();
if (abbr->IsAbbreviation()) {
nsIContent* firstChildNode = abbr->GetContent()->GetFirstChild();
if (firstChildNode) {
@ -143,7 +143,7 @@ GroupPos HTMLTableCellAccessible::GroupPosition() {
TableAccessible* HTMLTableCellAccessible::Table() const {
Accessible* parent = const_cast<HTMLTableCellAccessible*>(this);
while ((parent = parent->Parent())) {
while ((parent = parent->LocalParent())) {
if (parent->IsTable()) return parent->AsTable();
}
@ -798,7 +798,9 @@ nsTableWrapperFrame* HTMLTableAccessible::GetTableWrapperFrame() const {
Relation HTMLCaptionAccessible::RelationByType(RelationType aType) const {
Relation rel = HyperTextAccessible::RelationByType(aType);
if (aType == RelationType::LABEL_FOR) rel.AppendTarget(Parent());
if (aType == RelationType::LABEL_FOR) {
rel.AppendTarget(LocalParent());
}
return rel;
}

View File

@ -69,7 +69,7 @@ void DocAccessibleChildBase::SerializeTree(Accessible* aRoot,
#endif
for (uint32_t i = 0; i < childCount; i++) {
SerializeTree(aRoot->GetChildAt(i), aTree);
SerializeTree(aRoot->LocalChildAt(i), aTree);
}
}
@ -85,7 +85,7 @@ void DocAccessibleChildBase::InsertIntoIpcTree(Accessible* aParent,
}
void DocAccessibleChildBase::ShowEvent(AccShowEvent* aShowEvent) {
Accessible* parent = aShowEvent->Parent();
Accessible* parent = aShowEvent->LocalParent();
uint64_t parentID =
parent->IsDoc() ? 0 : reinterpret_cast<uint64_t>(parent->UniqueID());
uint32_t idxInParent = aShowEvent->GetAccessible()->IndexInParent();

View File

@ -171,7 +171,7 @@ nsresult AccessibleWrap::HandleAccEvent(AccEvent* aEvent) {
Accessible* acc = aEvent->GetAccessible();
// If there is a text input ancestor, use it as the event source.
while (acc && GetTypeFromRole(acc->Role()) != [mozTextAccessible class]) {
acc = acc->Parent();
acc = acc->LocalParent();
}
eventTarget = acc ? acc : aEvent->GetAccessible();
break;

View File

@ -74,8 +74,8 @@ bool HyperTextIterator::NormalizeForward() {
// If we are not a link, it is a root hypertext accessible.
return false;
}
if (!mCurrentContainer->Parent() ||
!mCurrentContainer->Parent()->IsHyperText()) {
if (!mCurrentContainer->LocalParent() ||
!mCurrentContainer->LocalParent()->IsHyperText()) {
// If we are a link, but our parent is not a hypertext accessible
// treat the current container as the root hypertext accessible.
// This can be the case with some XUL containers that are not
@ -84,7 +84,7 @@ bool HyperTextIterator::NormalizeForward() {
}
uint32_t endOffset = mCurrentContainer->EndOffset();
if (endOffset != 0) {
mCurrentContainer = mCurrentContainer->Parent()->AsHyperText();
mCurrentContainer = mCurrentContainer->LocalParent()->AsHyperText();
mCurrentStartOffset = endOffset;
if (mCurrentContainer == mEndContainer &&
@ -143,8 +143,8 @@ bool HyperTextIterator::NormalizeBackward() {
// If we are not a link, it is a root hypertext accessible.
return false;
}
if (!mCurrentContainer->Parent() ||
!mCurrentContainer->Parent()->IsHyperText()) {
if (!mCurrentContainer->LocalParent() ||
!mCurrentContainer->LocalParent()->IsHyperText()) {
// If we are a link, but our parent is not a hypertext accessible
// treat the current container as the root hypertext accessible.
// This can be the case with some XUL containers that are not
@ -153,7 +153,7 @@ bool HyperTextIterator::NormalizeBackward() {
}
uint32_t startOffset = mCurrentContainer->StartOffset();
mCurrentContainer = mCurrentContainer->Parent()->AsHyperText();
mCurrentContainer = mCurrentContainer->LocalParent()->AsHyperText();
mCurrentStartOffset = startOffset;
// Call NormalizeBackward recursively to get top-most link if at the
@ -519,11 +519,11 @@ void HyperTextAccessibleWrap::ParagraphAt(int32_t aOffset,
return;
}
if (end.mOffset == -1 && Parent() && Parent()->IsHyperText()) {
if (end.mOffset == -1 && LocalParent() && LocalParent()->IsHyperText()) {
// If end offset is -1 we didn't find a paragraph boundary.
// This must be an inline container, go to its parent to
// retrieve paragraph boundaries.
static_cast<HyperTextAccessibleWrap*>(Parent()->AsHyperText())
static_cast<HyperTextAccessibleWrap*>(LocalParent()->AsHyperText())
->ParagraphAt(StartOffset(), aStartContainer, aStartOffset,
aEndContainer, aEndOffset);
return;
@ -551,9 +551,9 @@ void HyperTextAccessibleWrap::StyleAt(int32_t aOffset,
return;
}
MOZ_ASSERT(leaf->Parent()->IsHyperText());
MOZ_ASSERT(leaf->LocalParent()->IsHyperText());
HyperTextAccessibleWrap* container =
static_cast<HyperTextAccessibleWrap*>(leaf->Parent()->AsHyperText());
static_cast<HyperTextAccessibleWrap*>(leaf->LocalParent()->AsHyperText());
if (!container) {
return;
}
@ -594,7 +594,7 @@ void HyperTextAccessibleWrap::PreviousClusterAt(
void HyperTextAccessibleWrap::RangeOfChild(Accessible* aChild,
int32_t* aStartOffset,
int32_t* aEndOffset) {
MOZ_ASSERT(aChild->Parent() == this);
MOZ_ASSERT(aChild->LocalParent() == this);
*aStartOffset = *aEndOffset = -1;
int32_t index = GetIndexOf(aChild);
if (index != -1) {
@ -617,7 +617,7 @@ Accessible* HyperTextAccessibleWrap::LeafAtOffset(int32_t aOffset) {
return text;
}
child = text->GetChildAt(childIdx);
child = text->LocalChildAt(childIdx);
if (!child || nsAccUtils::MustPrune(text)) {
return text;
}
@ -665,16 +665,16 @@ TextPoint HyperTextAccessibleWrap::FindTextPoint(
return TextPoint(text, 0);
}
child = text->GetChildAt(childIdx);
child = text->LocalChildAt(childIdx);
if (child->IsHyperText() && !child->ChildCount()) {
// If this is a childless hypertext, jump to its
// previous or next sibling, depending on
// direction.
if (aDirection == eDirPrevious && childIdx > 0) {
child = text->GetChildAt(--childIdx);
child = text->LocalChildAt(--childIdx);
} else if (aDirection == eDirNext &&
childIdx + 1 < static_cast<int32_t>(text->ChildCount())) {
child = text->GetChildAt(++childIdx);
child = text->LocalChildAt(++childIdx);
}
}
@ -687,7 +687,7 @@ TextPoint HyperTextAccessibleWrap::FindTextPoint(
// its search there.
childIdx--;
innerOffset -= text->GetChildOffset(childIdx);
child = text->GetChildAt(childIdx);
child = text->LocalChildAt(childIdx);
} else {
innerOffset -= childOffset;
}
@ -757,7 +757,8 @@ TextPoint HyperTextAccessibleWrap::FindTextPoint(
HyperTextAccessibleWrap* HyperTextAccessibleWrap::EditableRoot() {
Accessible* editable = nullptr;
for (Accessible* acc = this; acc && acc != Document(); acc = acc->Parent()) {
for (Accessible* acc = this; acc && acc != Document();
acc = acc->LocalParent()) {
if (acc->NativeState() & states::EDITABLE) {
editable = acc;
} else {

View File

@ -299,9 +299,9 @@ using namespace mozilla::a11y;
// We do this only with XUL menuitems that conform to the native theme, and
// not with aria menu items that might have a pseudo element or something.
if (acc->ChildCount() == 1 &&
acc->FirstChild()->Role() == roles::STATICTEXT) {
acc->LocalFirstChild()->Role() == roles::STATICTEXT) {
nsAutoString marker;
acc->FirstChild()->Name(marker);
acc->LocalFirstChild()->Name(marker);
if (marker.Length() == 1) {
return nsCocoaUtils::ToNSString(marker);
}

View File

@ -470,11 +470,11 @@ enum CachedBool { eCachedBoolMiss, eCachedTrue, eCachedFalse };
// XUL trees store their columns in a group at the tree's first
// child. Here, we iterate over that group to get each column's
// native accessible and add it to our col array.
Accessible* treeColumns = treeAcc->GetChildAt(0);
Accessible* treeColumns = treeAcc->LocalChildAt(0);
if (treeColumns) {
uint32_t colCount = treeColumns->ChildCount();
for (uint32_t i = 0; i < colCount; i++) {
Accessible* treeColumnItem = treeColumns->GetChildAt(i);
Accessible* treeColumnItem = treeColumns->LocalChildAt(i);
[cols addObject:GetNativeFromGeckoAccessible(treeColumnItem)];
}
return cols;

View File

@ -175,7 +175,7 @@ ia2Accessible::role(long* aRole) {
// the IA2 role a ROLE_OUTLINEITEM.
MOZ_ASSERT(!acc->IsProxy());
if (geckoRole == roles::ROW) {
Accessible* xpParent = acc->Parent();
Accessible* xpParent = acc->LocalParent();
if (xpParent && xpParent->Role() == roles::TREE_TABLE)
*aRole = ROLE_SYSTEM_OUTLINEITEM;
}
@ -461,7 +461,7 @@ ia2Accessible::get_accessibleWithCaret(IUnknown** aAccessible,
return S_FALSE;
Accessible* child = accWithCaret;
while (!child->IsDoc() && child != acc) child = child->Parent();
while (!child->IsDoc() && child != acc) child = child->LocalParent();
if (child != acc) return S_FALSE;

View File

@ -55,7 +55,7 @@ ia2AccessibleComponent::get_locationInParent(long* aX, long* aY) {
// The coordinates of the returned position are relative to this object's
// parent or relative to the screen on which this object is rendered if it
// has no parent.
if (!acc->Parent()) {
if (!acc->LocalParent()) {
*aX = rect.X();
*aY = rect.Y();
return S_OK;
@ -63,7 +63,7 @@ ia2AccessibleComponent::get_locationInParent(long* aX, long* aY) {
// The coordinates of the bounding box are given relative to the parent's
// coordinate system.
nsIntRect parentRect = acc->Parent()->Bounds();
nsIntRect parentRect = acc->LocalParent()->Bounds();
*aX = rect.X() - parentRect.X();
*aY = rect.Y() - parentRect.Y();
return S_OK;

View File

@ -203,7 +203,7 @@ AccessibleWrap::get_accParent(IDispatch __RPC_FAR* __RPC_FAR* ppdispParent) {
if (IsDefunct()) return CO_E_OBJNOTCONNECTED;
Accessible* xpParentAcc = Parent();
Accessible* xpParentAcc = LocalParent();
if (!xpParentAcc) return S_FALSE;
*ppdispParent = NativeAccessible(xpParentAcc);
@ -441,7 +441,7 @@ AccessibleWrap::get_accRole(
// the MSAA role a ROLE_OUTLINEITEM for consistency and compatibility. We need
// this because ARIA has a role of "row" for both grid and treegrid
if (geckoRole == roles::ROW) {
Accessible* xpParent = Parent();
Accessible* xpParent = LocalParent();
if (xpParent && xpParent->Role() == roles::TREE_TABLE)
msaaRole = ROLE_SYSTEM_OUTLINEITEM;
}
@ -894,7 +894,7 @@ AccessibleWrap::accNavigate(
navAccessible = WrapperFor(Proxy()->FirstChild());
}
} else {
if (!nsAccUtils::MustPrune(this)) navAccessible = FirstChild();
if (!nsAccUtils::MustPrune(this)) navAccessible = LocalFirstChild();
}
break;
case NAVDIR_LASTCHILD:
@ -903,16 +903,16 @@ AccessibleWrap::accNavigate(
navAccessible = WrapperFor(Proxy()->LastChild());
}
} else {
if (!nsAccUtils::MustPrune(this)) navAccessible = LastChild();
if (!nsAccUtils::MustPrune(this)) navAccessible = LocalLastChild();
}
break;
case NAVDIR_NEXT:
navAccessible =
IsProxy() ? WrapperFor(Proxy()->NextSibling()) : NextSibling();
IsProxy() ? WrapperFor(Proxy()->NextSibling()) : LocalNextSibling();
break;
case NAVDIR_PREVIOUS:
navAccessible =
IsProxy() ? WrapperFor(Proxy()->PrevSibling()) : PrevSibling();
IsProxy() ? WrapperFor(Proxy()->PrevSibling()) : LocalPrevSibling();
break;
case NAVDIR_DOWN:
case NAVDIR_LEFT:
@ -1352,7 +1352,7 @@ bool AccessibleWrap::IsRootForHWND() {
return true;
}
HWND thisHwnd = GetHWNDFor(this);
AccessibleWrap* parent = static_cast<AccessibleWrap*>(Parent());
AccessibleWrap* parent = static_cast<AccessibleWrap*>(LocalParent());
MOZ_ASSERT(parent);
HWND parentHwnd = GetHWNDFor(parent);
return thisHwnd != parentHwnd;
@ -1420,7 +1420,7 @@ already_AddRefed<IAccessible> AccessibleWrap::GetIAccessibleFor(
if (varChild.lVal > 0) {
// Gecko child indices are 0-based in contrast to indices used in MSAA.
MOZ_ASSERT(!IsProxy());
Accessible* xpAcc = GetChildAt(varChild.lVal - 1);
Accessible* xpAcc = LocalChildAt(varChild.lVal - 1);
if (!xpAcc) {
return nullptr;
}
@ -1459,7 +1459,7 @@ already_AddRefed<IAccessible> AccessibleWrap::GetIAccessibleFor(
return result.forget();
}
parent = parent->Parent();
parent = parent->LocalParent();
}
}

View File

@ -24,7 +24,7 @@ ChildrenEnumVariant::Next(ULONG aCount, VARIANT FAR* aItems,
*aCountFetched = 0;
if (mAnchorAcc->IsDefunct() || mAnchorAcc->GetChildAt(mCurIndex) != mCurAcc)
if (mAnchorAcc->IsDefunct() || mAnchorAcc->LocalChildAt(mCurIndex) != mCurAcc)
return CO_E_OBJNOTCONNECTED;
ULONG countFetched = 0;
@ -34,7 +34,7 @@ ChildrenEnumVariant::Next(ULONG aCount, VARIANT FAR* aItems,
IDispatch* accNative = AccessibleWrap::NativeAccessible(mCurAcc);
++mCurIndex;
mCurAcc = mAnchorAcc->GetChildAt(mCurIndex);
mCurAcc = mAnchorAcc->LocalChildAt(mCurIndex);
// Don't output the accessible and count it as having been fetched unless
// it is non-null
@ -55,11 +55,11 @@ ChildrenEnumVariant::Next(ULONG aCount, VARIANT FAR* aItems,
STDMETHODIMP
ChildrenEnumVariant::Skip(ULONG aCount) {
if (mAnchorAcc->IsDefunct() || mAnchorAcc->GetChildAt(mCurIndex) != mCurAcc)
if (mAnchorAcc->IsDefunct() || mAnchorAcc->LocalChildAt(mCurIndex) != mCurAcc)
return CO_E_OBJNOTCONNECTED;
mCurIndex += aCount;
mCurAcc = mAnchorAcc->GetChildAt(mCurIndex);
mCurAcc = mAnchorAcc->LocalChildAt(mCurIndex);
return mCurAcc ? S_OK : S_FALSE;
}
@ -69,7 +69,7 @@ ChildrenEnumVariant::Reset() {
if (mAnchorAcc->IsDefunct()) return CO_E_OBJNOTCONNECTED;
mCurIndex = 0;
mCurAcc = mAnchorAcc->GetChildAt(0);
mCurAcc = mAnchorAcc->LocalChildAt(0);
return S_OK;
}

View File

@ -19,7 +19,9 @@ namespace a11y {
class ChildrenEnumVariant final : public IEnumVARIANT {
public:
explicit ChildrenEnumVariant(AccessibleWrap* aAnchor)
: mAnchorAcc(aAnchor), mCurAcc(mAnchorAcc->GetChildAt(0)), mCurIndex(0) {}
: mAnchorAcc(aAnchor),
mCurAcc(mAnchorAcc->LocalChildAt(0)),
mCurIndex(0) {}
// IUnknown
DECL_IUNKNOWN

View File

@ -89,9 +89,9 @@ Relation XULLabelAccessible::RelationByType(RelationType aType) const {
// The label for xul:groupbox is generated from the first xul:label
if (aType == RelationType::LABEL_FOR) {
Accessible* parent = Parent();
Accessible* parent = LocalParent();
if (parent && parent->Role() == roles::GROUPING &&
parent->GetChildAt(0) == this) {
parent->LocalChildAt(0) == this) {
nsIContent* parentContent = parent->GetContent();
if (parentContent && parentContent->IsXULElement(nsGkAtoms::groupbox)) {
rel.AppendTarget(parent);

View File

@ -222,7 +222,7 @@ Relation XULGroupboxAccessible::RelationByType(RelationType aType) const {
// The label for xul:groupbox is generated from the first xul:label
if (aType == RelationType::LABELLED_BY && ChildCount() > 0) {
Accessible* childAcc = GetChildAt(0);
Accessible* childAcc = LocalChildAt(0);
if (childAcc->Role() == roles::LABEL &&
childAcc->GetContent()->IsXULElement(nsGkAtoms::label)) {
rel.AppendTarget(childAcc);
@ -363,12 +363,12 @@ void XULToolbarButtonAccessible::GetPositionAndSizeInternal(int32_t* aPosInSet,
int32_t setSize = 0;
int32_t posInSet = 0;
Accessible* parent = Parent();
Accessible* parent = LocalParent();
if (!parent) return;
uint32_t childCount = parent->ChildCount();
for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
Accessible* child = parent->GetChildAt(childIdx);
Accessible* child = parent->LocalChildAt(childIdx);
if (IsSeparator(child)) { // end of a group of buttons
if (posInSet) break; // we've found our group, so we're done

View File

@ -133,7 +133,7 @@ Accessible* XULListboxAccessible::CellAt(uint32_t aRowIndex,
Accessible* row = mDoc->GetAccessible(element);
NS_ENSURE_TRUE(row, nullptr);
return row->GetChildAt(aColumnIndex);
return row->LocalChildAt(aColumnIndex);
}
bool XULListboxAccessible::IsColSelected(uint32_t aColIdx) {
@ -502,4 +502,6 @@ void XULListitemAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
////////////////////////////////////////////////////////////////////////////////
// XULListitemAccessible: Widgets
Accessible* XULListitemAccessible::ContainerWidget() const { return Parent(); }
Accessible* XULListitemAccessible::ContainerWidget() const {
return LocalParent();
}

View File

@ -77,7 +77,7 @@ uint64_t XULMenuitemAccessible::NativeState() const {
// Is collapsed?
bool isCollapsed = false;
Accessible* parent = Parent();
Accessible* parent = LocalParent();
if (parent && parent->State() & states::INVISIBLE) isCollapsed = true;
if (isSelected) {
@ -86,7 +86,7 @@ uint64_t XULMenuitemAccessible::NativeState() const {
// Selected and collapsed?
if (isCollapsed) {
// Set selected option offscreen/invisible according to combobox state
Accessible* grandParent = parent->Parent();
Accessible* grandParent = parent->LocalParent();
if (!grandParent) return state;
NS_ASSERTION(grandParent->IsCombobox(),
"grandparent of combobox listitem is not combobox");
@ -145,7 +145,7 @@ KeyBinding XULMenuitemAccessible::AccessKey() const {
uint32_t modifierKey = 0;
Accessible* parentAcc = Parent();
Accessible* parentAcc = LocalParent();
if (parentAcc) {
if (parentAcc->NativeRole() == roles::MENUBAR) {
// If top level menu item, add Alt+ or whatever modifier text to string
@ -369,7 +369,7 @@ uint64_t XULMenupopupAccessible::NativeState() const {
bool isActive =
mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::menuactive);
if (!isActive) {
Accessible* parent = Parent();
Accessible* parent = LocalParent();
if (parent) {
nsIContent* parentContent = parent->GetContent();
if (parentContent && parentContent->IsElement())
@ -411,7 +411,7 @@ role XULMenupopupAccessible::NativeRole() const {
if (mParent->Role() == roles::PUSHBUTTON) {
// Some widgets like the search bar have several popups, owned by buttons.
Accessible* grandParent = mParent->Parent();
Accessible* grandParent = mParent->LocalParent();
if (grandParent && grandParent->IsAutoComplete())
return roles::COMBOBOX_LIST;
}
@ -454,7 +454,7 @@ Accessible* XULMenupopupAccessible::ContainerWidget() const {
nsMenuParent* menuParent = menuFrame->GetMenuParent();
if (!menuParent) // menulist or menubutton
return menuPopup->Parent();
return menuPopup->LocalParent();
if (menuParent->IsMenuBar()) { // menubar menu
nsMenuBarFrame* menuBarFrame = static_cast<nsMenuBarFrame*>(menuParent);

View File

@ -106,7 +106,7 @@ uint32_t XULSelectControlAccessible::SelectedItemCount() {
}
bool XULSelectControlAccessible::AddItemToSelection(uint32_t aIndex) {
Accessible* item = GetChildAt(aIndex);
Accessible* item = LocalChildAt(aIndex);
if (!item || !item->GetContent()) return false;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
@ -134,7 +134,7 @@ bool XULSelectControlAccessible::AddItemToSelection(uint32_t aIndex) {
}
bool XULSelectControlAccessible::RemoveItemFromSelection(uint32_t aIndex) {
Accessible* item = GetChildAt(aIndex);
Accessible* item = LocalChildAt(aIndex);
if (!item || !item->GetContent()) return false;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =
@ -162,7 +162,7 @@ bool XULSelectControlAccessible::RemoveItemFromSelection(uint32_t aIndex) {
}
bool XULSelectControlAccessible::IsItemSelected(uint32_t aIndex) {
Accessible* item = GetChildAt(aIndex);
Accessible* item = LocalChildAt(aIndex);
if (!item || !item->GetContent()) return false;
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm =

View File

@ -340,9 +340,11 @@ bool XULTreeAccessible::SelectAll() {
////////////////////////////////////////////////////////////////////////////////
// XULTreeAccessible: Accessible implementation
Accessible* XULTreeAccessible::GetChildAt(uint32_t aIndex) const {
Accessible* XULTreeAccessible::LocalChildAt(uint32_t aIndex) const {
uint32_t childCount = Accessible::ChildCount();
if (aIndex < childCount) return Accessible::GetChildAt(aIndex);
if (aIndex < childCount) {
return Accessible::LocalChildAt(aIndex);
}
return GetTreeItemAccessible(aIndex - childCount);
}
@ -855,7 +857,7 @@ Accessible* XULTreeItemAccessibleBase::GetSiblingAtOffset(
int32_t aOffset, nsresult* aError) const {
if (aError) *aError = NS_OK; // fail peacefully
return mParent->GetChildAt(IndexInParent() + aOffset);
return mParent->LocalChildAt(IndexInParent() + aOffset);
}
////////////////////////////////////////////////////////////////////////////////
@ -986,7 +988,7 @@ Accessible* XULTreeColumAccessible::GetSiblingAtOffset(int32_t aOffset,
int32_t rowCount = 0;
treeView->GetRowCount(&rowCount);
if (rowCount > 0 && aOffset <= rowCount) {
XULTreeAccessible* treeAcc = Parent()->AsXULTree();
XULTreeAccessible* treeAcc = LocalParent()->AsXULTree();
if (treeAcc) return treeAcc->GetTreeItemAccessible(aOffset - 1);
}

View File

@ -45,7 +45,7 @@ class XULTreeAccessible : public AccessibleWrap {
virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
EWhichChildAtPoint aWhichChild) override;
virtual Accessible* GetChildAt(uint32_t aIndex) const override;
virtual Accessible* LocalChildAt(uint32_t aIndex) const override;
virtual uint32_t ChildCount() const override;
virtual Relation RelationByType(RelationType aType) const override;

View File

@ -117,9 +117,9 @@ void XULTreeGridAccessible::ColDescription(uint32_t aColIdx,
nsString& aDescription) {
aDescription.Truncate();
Accessible* treeColumns = Accessible::GetChildAt(0);
Accessible* treeColumns = Accessible::LocalChildAt(0);
if (treeColumns) {
Accessible* treeColumnItem = treeColumns->GetChildAt(aColIdx);
Accessible* treeColumnItem = treeColumns->LocalChildAt(aColIdx);
if (treeColumnItem) treeColumnItem->Name(aDescription);
}
}
@ -277,7 +277,7 @@ Accessible* XULTreeGridRowAccessible::ChildAtPoint(
return GetCellAccessible(cellInfo.mCol);
}
Accessible* XULTreeGridRowAccessible::GetChildAt(uint32_t aIndex) const {
Accessible* XULTreeGridRowAccessible::LocalChildAt(uint32_t aIndex) const {
if (IsDefunct()) return nullptr;
RefPtr<nsTreeColumn> column = nsCoreUtils::GetSensibleColumnAt(mTree, aIndex);
@ -483,7 +483,7 @@ bool XULTreeGridCellAccessible::DoAction(uint8_t aIndex) const {
// XULTreeGridCellAccessible: TableCell
TableAccessible* XULTreeGridCellAccessible::Table() const {
Accessible* grandParent = mParent->Parent();
Accessible* grandParent = mParent->LocalParent();
if (grandParent) return grandParent->AsTable();
return nullptr;
@ -630,7 +630,7 @@ Accessible* XULTreeGridCellAccessible::GetSiblingAtOffset(
if (!columnAtOffset) return nullptr;
RefPtr<XULTreeItemAccessibleBase> rowAcc = do_QueryObject(Parent());
RefPtr<XULTreeItemAccessibleBase> rowAcc = do_QueryObject(LocalParent());
return rowAcc->GetCellAccessible(columnAtOffset);
}

View File

@ -65,7 +65,7 @@ class XULTreeGridAccessible : public XULTreeAccessible, public TableAccessible {
*/
class XULTreeGridRowAccessible final : public XULTreeItemAccessibleBase {
public:
using Accessible::GetChildAt;
using Accessible::LocalChildAt;
XULTreeGridRowAccessible(nsIContent* aContent, DocAccessible* aDoc,
Accessible* aParent, dom::XULTreeElement* aTree,
@ -83,7 +83,7 @@ class XULTreeGridRowAccessible final : public XULTreeItemAccessibleBase {
virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
EWhichChildAtPoint aWhichChild) override;
virtual Accessible* GetChildAt(uint32_t aIndex) const override;
virtual Accessible* LocalChildAt(uint32_t aIndex) const override;
virtual uint32_t ChildCount() const override;
// XULTreeItemAccessibleBase