示例#1
0
AtkObject *
refChildCB(AtkObject *aAtkObj, gint aChildIndex)
{
    // aChildIndex should not be less than zero
    if (aChildIndex < 0) {
      return nsnull;
    }

    AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
    if (!accWrap || nsAccUtils::MustPrune(accWrap)) {
        return nsnull;
    }

    Accessible* accChild = accWrap->GetEmbeddedChildAt(aChildIndex);
    if (!accChild)
        return nsnull;

    AtkObject* childAtkObj = AccessibleWrap::GetAtkObject(accChild);

    NS_ASSERTION(childAtkObj, "Fail to get AtkObj");
    if (!childAtkObj)
        return nsnull;
    g_object_ref(childAtkObj);

  if (aAtkObj != childAtkObj->accessible_parent)
    atk_object_set_parent(childAtkObj, aAtkObj);

  return childAtkObj;
}
示例#2
0
AtkObject *
refChildCB(AtkObject *aAtkObj, gint aChildIndex)
{
  // aChildIndex should not be less than zero
  if (aChildIndex < 0) {
    return nullptr;
  }

  AtkObject* childAtkObj = nullptr;
  AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
  if (accWrap) {
    if (nsAccUtils::MustPrune(accWrap)) {
      return nullptr;
    }

    Accessible* accChild = accWrap->GetEmbeddedChildAt(aChildIndex);
    if (accChild) {
      childAtkObj = AccessibleWrap::GetAtkObject(accChild);
    } else {
      OuterDocAccessible* docOwner = accWrap->AsOuterDoc();
      if (docOwner) {
        ProxyAccessible* proxyDoc = docOwner->RemoteChildDoc();
        if (proxyDoc)
          childAtkObj = GetWrapperFor(proxyDoc);
      }
    }
  } else if (ProxyAccessible* proxy = GetProxy(aAtkObj)) {
    if (proxy->MustPruneChildren())
      return nullptr;

    ProxyAccessible* child = proxy->EmbeddedChildAt(aChildIndex);
    if (child)
      childAtkObj = GetWrapperFor(child);
  } else {
    return nullptr;
  }

  NS_ASSERTION(childAtkObj, "Fail to get AtkObj");
  if (!childAtkObj)
    return nullptr;

  g_object_ref(childAtkObj);

  if (aAtkObj != childAtkObj->accessible_parent)
    atk_object_set_parent(childAtkObj, aAtkObj);

  return childAtkObj;
}