Skip to content

Commit

Permalink
Bug 1199755 - Retrieve native proxy children when mozAccessible child…
Browse files Browse the repository at this point in the history
…ren is called on outerdocs in parent r=tbsaunde
  • Loading branch information
lorienhu committed Jun 9, 2016
1 parent 21ef3ac commit 3cbc320
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
1 change: 0 additions & 1 deletion accessible/ipc/ProxyAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,6 @@ ProxyAccessible::OuterDocOfRemoteBrowser() const
return nullptr;

DocAccessible* chromeDoc = GetExistingDocAccessible(frame->OwnerDoc());
NS_ASSERTION(chromeDoc, "accessible tab in not accessible chromeDocument");

return chromeDoc ? chromeDoc->GetAccessible(frame) : nullptr;
}
Expand Down
19 changes: 19 additions & 0 deletions accessible/mac/Platform.mm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "Platform.h"
#include "ProxyAccessible.h"
#include "DocAccessibleParent.h"
#include "mozTableAccessible.h"

#include "nsAppShell.h"
Expand Down Expand Up @@ -54,11 +55,29 @@
uintptr_t accWrap = reinterpret_cast<uintptr_t>(aProxy) | IS_PROXY;
mozAccessible* mozWrapper = [[type alloc] initWithAccessible:accWrap];
aProxy->SetWrapper(reinterpret_cast<uintptr_t>(mozWrapper));

// Invalidate native parent in parent process's children on proxy creation
if (aProxy->IsDoc() && aProxy->AsDoc()->IsTopLevel()) {
Accessible* outerDoc = aProxy->OuterDocOfRemoteBrowser();
if (outerDoc) {
mozAccessible* nativeParent = GetNativeFromGeckoAccessible(outerDoc);
[nativeParent invalidateChildren];
}
}
}

void
ProxyDestroyed(ProxyAccessible* aProxy)
{
// Invalidate native parent in parent process's children on proxy destruction
if (aProxy->IsDoc() && aProxy->AsDoc()->IsTopLevel()) {
Accessible* outerDoc = aProxy->OuterDocOfRemoteBrowser();
if (outerDoc) {
mozAccessible* nativeParent = GetNativeFromGeckoAccessible(outerDoc);
[nativeParent invalidateChildren];
}
}

mozAccessible* wrapper = GetNativeFromProxy(aProxy);
[wrapper expire];
[wrapper release];
Expand Down
10 changes: 10 additions & 0 deletions accessible/mac/mozAccessible.mm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "TableAccessible.h"
#include "TableCellAccessible.h"
#include "mozilla/a11y/PDocAccessible.h"
#include "OuterDocAccessible.h"

#include "mozilla/Services.h"
#include "nsRect.h"
Expand Down Expand Up @@ -619,6 +620,15 @@ - (NSArray*)children
[mChildren addObject:nativeChild];
}

// children from child if this is an outerdoc
OuterDocAccessible* docOwner = accWrap->AsOuterDoc();
if (docOwner) {
if (ProxyAccessible* proxyDoc = docOwner->RemoteChildDoc()) {
mozAccessible* nativeRemoteChild = GetNativeFromProxy(proxyDoc);
[mChildren insertObject:nativeRemoteChild atIndex:0];
NSAssert1 (nativeRemoteChild, @"%@ found a child remote doc missing a native\n", self);
}
}
} else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
uint32_t childCount = proxy->ChildrenCount();
for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
Expand Down

0 comments on commit 3cbc320

Please sign in to comment.