In both cases there has been agreement on the first method (which will
be used the vast majority of the time):

// Fetch one target, even if there is more than one.
HRESULT IAccessible2_2::relationTargetOfType (
  [in] BSTR type,
  [out, retvalue] IUnknown **target )

But there have been two suggestions for a companion method to get more
than one relation:

// Fetch all targets
HRESULT IAccessible2_2::relationTargetsOfType (
  [in] BSTR type,
  [out, size_is(,*nTargets)] IUnknown ***targets,
  [out, retval] long *nTargets  )  // # targets returned

or

// Fetch either a specified number of targets or
// all targets depending on the maxTargets parameter.
//
// maxTargets will typically be 1 or 0.
// If maxTargets is 0 all targets will be returned.
HRESULT IAccessible2_2::relationTargetsOfType (
  [in] BSTR type,
  [in] long maxTargets,
  [out, size_is(,*nTargets)] IUnknown ***targets,
  [out, retval] long *nTargets  )  // # targets returned

Note: In both cases the server allocates the array.  The size of the
array is conveyed via nTargets.

Pete

On 3/6/12 9:47 AM, Pete Brunet wrote:
> Thanks Alex, I still prefer 1 rather than 1.1 and 2, but let's see
> what others say.  -Pete
>
> On 3/6/12 12:26 AM, Alexander Surkov wrote:
>> 2nd is more flexible than 1, 1.1 is a nice shortcut for 2 in case of
>> one target so probably I would go with 1.1 and 2.
>> Alex.
>>
>> On Tue, Mar 6, 2012 at 2:35 PM, Pete Brunet <[email protected]> wrote:
>>> Thanks Alex (and Jamie), I offer two choices, and in both cases using IDL
>>> like our recently added IATable2::selectedRows/Columns/Cells.  I like the
>>> first choice better because it offers a very simple method for the case that
>>> will be used 99% of the time.  The second choice is the one Jamie proposed.
>>>
>>> 1)
>>> // Fetch one target, even if there is more than one.
>>> HRESULT IAccessible2_2::relationTargetOfType (
>>>   [in] BSTR type,
>>>   [out, retvalue] IUnknown **target )
>>>
>>> and
>>>
>>> // Fetch all targets
>>> HRESULT IAccessible2_2::relationTargetsOfType (
>>>   [in] BSTR type,
>>>   [out, size_is(,*nTargets)] IUnknown ***targets,
>>>
>>>   [out, retval] long *nTargets  )
>>>
>>> 2)
>>> // Fetch either one or all targets depending on the maxTargets parameter.
>>> // Typically maxTargets will be 1 but if maxTargets is 0 the server will
>>> return all available targets, using nTargets to indicate how many were
>>> returned.
>>> HRESULT IAccessible2_2::relationTargetsOfType (
>>>   [in] BSTR type,
>>>   [in] long maxTargets,
>>>   [out, size_is(,*nTargets)] IUnknown ***targets,
>>>
>>>   [out, retval] long *nTargets  )
>>>
>>> That maxTargets parameter could be a boolean but as a long it provides the
>>> option of asking for the first n targets.
>>>
>>> In both cases the server would allocate the array, using CoTaskMemAlloc. The
>>> client would use CoTaskMemFree to free the array.
>>>
>>> Pete
>>>
>>>
>>> On 3/5/12 10:25 PM, Alexander Surkov wrote:
>>>
>>> Basically that's what Jamie said. We need to make sure the server
>>> doesn't do extra work when nobody needs it. So I'm fine with Jamie
>>> proposal to pass the desired targets amount.
>>> Alex.
>>>
>>> On Tue, Mar 6, 2012 at 1:19 PM, Alexander Surkov
>>> <[email protected]> wrote:
>>>
>>> ARIA tends to expose multiple targets especially stuffs like
>>> aria-labelledby. I don't have statistics though. But the point is if
>>> AT needs only one targets then the server shouldn't spend a time to
>>> check whether there are other targets. In other words we can end up
>>> with single target but the server can do a lot of computation to
>>> figure out this.
>>>
>>> Thank you.
>>> Alex.
>>>
>>>
>>> On Tue, Mar 6, 2012 at 6:31 AM, James Teh <[email protected]> wrote:
>>>
>>> On 6/03/2012 7:20 AM, Pete Brunet wrote:
>>>
>>> Jamie, Since the server allocates the array, are there any issues for AT
>>> regarding the method I proposed?
>>>
>>> Not directly for ATs. However, fetching multiple targets might be expensive
>>> and slow on the server side; if I recall correctly, Alex has concurred with
>>> this. Obviously, if the server is slow, the client slows down too. The idea
>>> was to allow clients who only want one target to just fetch one target
>>> without incurring a performance penalty on the server side.
>>>
>>> Alex, how often are there actually multiple targets for a single relation in
>>> Mozilla itself?
>>>
>>>
>>> Jamie
_______________________________________________
Accessibility-ia2 mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/accessibility-ia2

Reply via email to