XIBObject* NIBWriter::AddOutputObject(XIBObject *pObj) { if ( !pObj->NeedsSerialization() ) return pObj; if ( pObj->_parent != NULL && _baseObject != NULL ) { bool found = false; XIBObject *curObj = pObj; while ( curObj ) { if ( curObj == _baseObject ) { found = true; break; } curObj = curObj->_parent; } if ( !found ) { pObj = GetProxyFor(pObj); } } for ( size_t i = 0; i < _outputObjects.size(); i ++ ) { if ( _outputObjects[i] == pObj ) { return pObj; } } _outputObjects.push_back(pObj); pObj->EmitObject(this); return pObj; }
ProxyAccessible* ProxyAccessible::AnchorAt(uint32_t aIdx) { RefPtr<IAccessibleHyperlink> link = QueryInterface<IAccessibleHyperlink>(this); if (!link) { return nullptr; } VARIANT anchor; if (FAILED(link->get_anchor(aIdx, &anchor))) { return nullptr; } MOZ_ASSERT(anchor.vt == VT_UNKNOWN); ProxyAccessible* proxyAnchor = GetProxyFor(Document(), anchor.punkVal); anchor.punkVal->Release(); return proxyAnchor; }
nsTArray<ProxyAccessible*> ProxyAccessible::RelationByType( RelationType aType) const { RefPtr<IAccessible2_2> acc = QueryInterface<IAccessible2_2>(this); if (!acc) { return nsTArray<ProxyAccessible*>(); } _bstr_t relationType; for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) { if (aType == sRelationTypePairs[idx].first) { relationType = sRelationTypePairs[idx].second; break; } } if (!relationType) { return nsTArray<ProxyAccessible*>(); } IUnknown** targets; long nTargets = 0; HRESULT hr = acc->get_relationTargetsOfType(relationType, 0, &targets, &nTargets); if (FAILED(hr)) { return nsTArray<ProxyAccessible*>(); } nsTArray<ProxyAccessible*> proxies; for (long idx = 0; idx < nTargets; idx++) { IUnknown* target = targets[idx]; proxies.AppendElement(GetProxyFor(Document(), target)); target->Release(); } CoTaskMemFree(targets); return proxies; }