mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
bug 1259023 - make nsIAccessible.parent work with proxies r=yzen
This commit is contained in:
parent
3fd0587905
commit
8a74954930
@ -793,24 +793,13 @@ getParentCB(AtkObject *aAtkObj)
|
||||
if (aAtkObj->accessible_parent)
|
||||
return aAtkObj->accessible_parent;
|
||||
|
||||
AtkObject* atkParent = nullptr;
|
||||
if (AccessibleWrap* wrapper = GetAccessibleWrap(aAtkObj)) {
|
||||
Accessible* parent = wrapper->Parent();
|
||||
atkParent = parent ? AccessibleWrap::GetAtkObject(parent) : nullptr;
|
||||
} else if (ProxyAccessible* proxy = GetProxy(aAtkObj)) {
|
||||
ProxyAccessible* parent = proxy->Parent();
|
||||
if (parent) {
|
||||
atkParent = GetWrapperFor(parent);
|
||||
} else {
|
||||
// Otherwise this should be the proxy for the tab's top level document.
|
||||
Accessible* outerDocParent = proxy->OuterDocOfRemoteBrowser();
|
||||
NS_ASSERTION(outerDocParent, "this document should have an outerDoc as a parent");
|
||||
if (outerDocParent) {
|
||||
atkParent = AccessibleWrap::GetAtkObject(outerDocParent);
|
||||
}
|
||||
}
|
||||
AccessibleOrProxy acc = GetInternalObj(aAtkObj);
|
||||
if (acc.IsNull()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AccessibleOrProxy parent = acc.Parent();
|
||||
AtkObject* atkParent = !parent.IsNull() ? GetWrapperFor(parent) : nullptr;
|
||||
if (atkParent)
|
||||
atk_object_set_parent(aAtkObj, atkParent);
|
||||
|
||||
@ -1101,6 +1090,16 @@ GetWrapperFor(ProxyAccessible* aProxy)
|
||||
return reinterpret_cast<AtkObject*>(aProxy->GetWrapper() & ~IS_PROXY);
|
||||
}
|
||||
|
||||
AtkObject*
|
||||
GetWrapperFor(AccessibleOrProxy aObj)
|
||||
{
|
||||
if (aObj.IsProxy()) {
|
||||
return GetWrapperFor(aObj.AsProxy());
|
||||
}
|
||||
|
||||
return AccessibleWrap::GetAtkObject(aObj.AsAccessible());
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
GetInterfacesForProxy(ProxyAccessible* aProxy, uint32_t aInterfaces)
|
||||
{
|
||||
|
@ -69,6 +69,7 @@ mozilla::a11y::AccessibleWrap* GetAccessibleWrap(AtkObject* aAtkObj);
|
||||
mozilla::a11y::ProxyAccessible* GetProxy(AtkObject* aAtkObj);
|
||||
mozilla::a11y::AccessibleOrProxy GetInternalObj(AtkObject* aObj);
|
||||
AtkObject* GetWrapperFor(mozilla::a11y::ProxyAccessible* aProxy);
|
||||
AtkObject* GetWrapperFor(mozilla::a11y::AccessibleOrProxy aObj);
|
||||
|
||||
extern int atkMajorVersion, atkMinorVersion;
|
||||
|
||||
|
27
accessible/base/AccessibleOrProxy.cpp
Normal file
27
accessible/base/AccessibleOrProxy.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "AccessibleOrProxy.h"
|
||||
|
||||
AccessibleOrProxy
|
||||
AccessibleOrProxy::Parent() const
|
||||
{
|
||||
if (IsAccessible()) {
|
||||
return AsAccessible()->Parent();
|
||||
}
|
||||
|
||||
ProxyAccessible* proxy = AsProxy();
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (ProxyAccessible* parent = proxy->Parent()) {
|
||||
return parent;
|
||||
}
|
||||
|
||||
// Otherwise this should be the proxy for the tab's top level document.
|
||||
return proxy->OuterDocOfRemoteBrowser();
|
||||
}
|
@ -106,6 +106,8 @@ public:
|
||||
return AsAccessible()->Role();
|
||||
}
|
||||
|
||||
AccessibleOrProxy Parent() const;
|
||||
|
||||
// XXX these are implementation details that ideally would not be exposed.
|
||||
uintptr_t Bits() const { return mBits; }
|
||||
void SetBits(uintptr_t aBits) { mBits = aBits; }
|
||||
|
@ -26,6 +26,7 @@ if CONFIG['MOZ_DEBUG']:
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'AccessibleOrProxy.cpp',
|
||||
'AccEvent.cpp',
|
||||
'AccGroupInfo.cpp',
|
||||
'AccIterator.cpp',
|
||||
|
@ -25,10 +25,11 @@ xpcAccessible::GetParent(nsIAccessible** aParent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParent);
|
||||
*aParent = nullptr;
|
||||
if (!Intl())
|
||||
if (IntlGeneric().IsNull())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_IF_ADDREF(*aParent = ToXPC(Intl()->Parent()));
|
||||
AccessibleOrProxy parent = IntlGeneric().Parent();
|
||||
NS_IF_ADDREF(*aParent = ToXPC(parent));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user