Bug 1359129 - Use the most recent RootDocAccessible when delaying DocAccessibleChild messages. r=aklotz

We sometimes briefly have more than one root DocAccessible associated with a TabChild, for example, while navigating links in a page.  This patch makes sure that we use the correct accessible when delaying messages that we forward to the parent process.
This commit is contained in:
David Parks 2017-05-01 14:04:55 -07:00
Родитель f939196196
Коммит 1810e88c32
4 изменённых файлов: 24 добавлений и 12 удалений

Просмотреть файл

@ -1481,6 +1481,9 @@ DocAccessible::DoInitialUpdate()
if (RefPtr<dom::TabChild> tabChild = dom::TabChild::GetFrom(docShell)) {
DocAccessibleChild* ipcDoc = new DocAccessibleChild(this, tabChild);
SetIPCDoc(ipcDoc);
if (IsRoot()) {
tabChild->SetTopLevelDocAccessibleChild(ipcDoc);
}
#if defined(XP_WIN)
IAccessibleHolder holder(CreateHolderFromAccessible(this));

Просмотреть файл

@ -102,18 +102,8 @@ DocAccessibleChild::PushDeferredEvent(UniquePtr<DeferredEvent> aEvent)
return;
}
nsTArray<PDocAccessibleChild*> ipcDocAccs;
tabChild->ManagedPDocAccessibleChild(ipcDocAccs);
// Look for the top-level DocAccessibleChild - there will only be one
// per TabChild.
for (uint32_t i = 0, l = ipcDocAccs.Length(); i < l; ++i) {
auto ipcDocAcc = static_cast<DocAccessibleChild*>(ipcDocAccs[i]);
if (ipcDocAcc->mDoc && ipcDocAcc->mDoc->IsRoot()) {
topLevelIPCDoc = ipcDocAcc;
break;
}
}
topLevelIPCDoc =
static_cast<DocAccessibleChild*>(tabChild->GetTopLevelDocAccessibleChild());
}
if (topLevelIPCDoc) {

Просмотреть файл

@ -403,6 +403,9 @@ TabChild::TabChild(nsIContentChild* aManager,
#if defined(XP_WIN) && defined(ACCESSIBILITY)
, mNativeWindowHandle(0)
#endif
#if defined(ACCESSIBILITY)
, mTopLevelDocAccessibleChild(nullptr)
#endif
{
nsWeakPtr weakPtrThis(do_GetWeakReference(static_cast<nsITabChild*>(this))); // for capture by the lambda
mSetAllowedTouchBehaviorCallback = [weakPtrThis](uint64_t aInputBlockId,

Просмотреть файл

@ -675,6 +675,18 @@ public:
mozilla::dom::TabGroup* TabGroup();
#if defined(ACCESSIBILITY)
void SetTopLevelDocAccessibleChild(PDocAccessibleChild* aTopLevelChild)
{
mTopLevelDocAccessibleChild = aTopLevelChild;
}
PDocAccessibleChild* GetTopLevelDocAccessibleChild()
{
return mTopLevelDocAccessibleChild;
}
#endif
protected:
virtual ~TabChild();
@ -843,6 +855,10 @@ private:
uintptr_t mNativeWindowHandle;
#endif // defined(XP_WIN)
#if defined(ACCESSIBILITY)
PDocAccessibleChild* mTopLevelDocAccessibleChild;
#endif
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
};