Trouble using IA2 uniqueID and accessibleObjectFromEvent / accChild in Gecko 1.9

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Trouble using IA2 uniqueID and accessibleObjectFromEvent / accChild in Gecko 1.9

Michael Curran
Hi all,

I was wondering if anyone is successfully able to use a uniqueID received
from IAccessible2::uniqueID (from an IA2 object in Gecko) and then use that
uniqueID to later fetch the same object again using
AccessibleObjectFromEvent(windowHandle,0,uniqueID) or
IAccessible::accChild(uniqueID) (on the root IAccessible for the window).

I now need to do this in NVDA with the new virtual Buffer library as we no
longer actually cache the real IAccessible objects, but rather just cache
their uniqueIDs. However, If the user arrows to a particular part of the
buffer and wants to perhaps activate it (press a button or something) the
uniqueID at that spot needs to be used to fetch a real
IAccessible/IAccessible2 object to actually call accDoDefaultAction etc.

But for some reason, every time I use
AccessibleObjectFromEvent(windowHandle,0,uniqueID) I just get back the
IAccessible object for the window, and a childID equal to the uniqueID. If I
then try calling something like IAccessible::accRole(childID) I get COM
exceptions.

If instead, I just use the root IAccessible to call
IAccessible::accChild(uniqueID) I also get a COM exception.

I must note that accessibleObjectFromEvent always works fine for me in other
cercomstances, as in fetching an IAccessible for a specific
windowHandle,objectID,childID winEvent, but in this sercomstance, it doesn't
seem to do what is stated in the Mozilla Accessibility Wiki.

I can't say if this same technique worked in Gecko 1.8 with plain
IAccessible as I never used ISimpleDom::getNodeInfo to retreave a uniqueID
that I could actually try this with, I used to just cache all IAccessibles.

Mick



_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility
Reply | Threaded
Open this post in threaded view
|

Re: Trouble using IA2 uniqueID and accessibleObjectFromEvent / accChildin Gecko 1.9

Michael Curran
I should also mention that the uniqueIDs I'm getting back from IAccessible2
are positive integers. Though in the IAccessible2 IDL it states that a
uniqueID is  tipically a negative number.

I'm not sure if this has anything to do with the problems?

Mick

----- Original Message -----
From: "Michael Curran" <[hidden email]>
To: <[hidden email]>
Sent: Monday, December 31, 2007 3:53 PM
Subject: Trouble using IA2 uniqueID and accessibleObjectFromEvent /
accChildin Gecko 1.9


> Hi all,
>
> I was wondering if anyone is successfully able to use a uniqueID received
> from IAccessible2::uniqueID (from an IA2 object in Gecko) and then use
> that
> uniqueID to later fetch the same object again using
> AccessibleObjectFromEvent(windowHandle,0,uniqueID) or
> IAccessible::accChild(uniqueID) (on the root IAccessible for the window).
>
> I now need to do this in NVDA with the new virtual Buffer library as we no
> longer actually cache the real IAccessible objects, but rather just cache
> their uniqueIDs. However, If the user arrows to a particular part of the
> buffer and wants to perhaps activate it (press a button or something) the
> uniqueID at that spot needs to be used to fetch a real
> IAccessible/IAccessible2 object to actually call accDoDefaultAction etc.
>
> But for some reason, every time I use
> AccessibleObjectFromEvent(windowHandle,0,uniqueID) I just get back the
> IAccessible object for the window, and a childID equal to the uniqueID. If
> I
> then try calling something like IAccessible::accRole(childID) I get COM
> exceptions.
>
> If instead, I just use the root IAccessible to call
> IAccessible::accChild(uniqueID) I also get a COM exception.
>
> I must note that accessibleObjectFromEvent always works fine for me in
> other
> cercomstances, as in fetching an IAccessible for a specific
> windowHandle,objectID,childID winEvent, but in this sercomstance, it
> doesn't
> seem to do what is stated in the Mozilla Accessibility Wiki.
>
> I can't say if this same technique worked in Gecko 1.8 with plain
> IAccessible as I never used ISimpleDom::getNodeInfo to retreave a uniqueID
> that I could actually try this with, I used to just cache all
> IAccessibles.
>
> Mick
>
>
>
> _______________________________________________
> dev-accessibility mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-accessibility
>
>

_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility
Reply | Threaded
Open this post in threaded view
|

Re: Trouble using IA2 uniqueID and accessibleObjectFromEvent / accChildin Gecko 1.9

Marco Zehe-3
In reply to this post by Michael Curran
Hi Mick,

Michael Curran wrote:
> I should also mention that the uniqueIDs I'm getting back from
> IAccessible2 are positive integers. Though in the IAccessible2 IDL it
> states that a uniqueID is  tipically a negative number.

That's very strange. I just looked at the Windows-specific wrappers for
the UniqueID, and noticed that these are explicitly converted to
negative numbers. Mozilla-internal unique IDs seem to be unsigned ints,
which means positive numbers.

Aaron will be on vacation until January 7. Alexander, Evan or Ginn, can
you shed any light on this?

Thanks,
Marco


_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility
Reply | Threaded
Open this post in threaded view
|

Re: Trouble using IA2 uniqueID and accessibleObjectFromEvent /accChildin Gecko 1.9

Michael Curran
Hi Marco,

Hmm, I just wrote a small c++ program to test exactly what
IAccessible2::uniqueID is giving me, and its definitly positive.

I thought it could have been Python comtypes or something getting a bit
confused with types and values but writing it in pure c++ also gives me
positive numbers.

Not sure if this means anything, but IA2 objects representing the top frame
and other XUL elements usually get a uniqueID of 20000000 or higher, and IA2
objects with in a document get uniqueIDs around 50000000 or higher.

IAccessible2::uniqueID is a long, according to its specification

How exactly is the ID being converted to negative in the windows wrappers?
is it just a simple 0-ID or ID*-1?

Mick

----- Original Message -----
From: "Marco Zehe" <[hidden email]>
Newsgroups: mozilla.dev.accessibility
To: <[hidden email]>
Sent: Wednesday, January 02, 2008 9:03 PM
Subject: Re: Trouble using IA2 uniqueID and accessibleObjectFromEvent
/accChildin Gecko 1.9


> Hi Mick,
>
> Michael Curran wrote:
>> I should also mention that the uniqueIDs I'm getting back from
>> IAccessible2 are positive integers. Though in the IAccessible2 IDL it
>> states that a uniqueID is  tipically a negative number.
>
> That's very strange. I just looked at the Windows-specific wrappers for
> the UniqueID, and noticed that these are explicitly converted to
> negative numbers. Mozilla-internal unique IDs seem to be unsigned ints,
> which means positive numbers.
>
> Aaron will be on vacation until January 7. Alexander, Evan or Ginn, can
> you shed any light on this?
>
> Thanks,
> Marco
>
>
> _______________________________________________
> dev-accessibility mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-accessibility
>
>

_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility
Reply | Threaded
Open this post in threaded view
|

Re: Trouble using IA2 uniqueID and accessibleObjectFromEvent /accChildin Gecko 1.9

Marco Zehe-3
In reply to this post by Marco Zehe-3
Hi Mick,

Michael Curran wrote:
> IAccessible2::uniqueID is a long, according to its specification
>
> How exactly is the ID being converted to negative in the windows
> wrappers? is it just a simple 0-ID or ID*-1?

In nsAccessNodeWrap::get_nodeInfo, the parameter for the UniqueID is
declared as this:
    /* [out] */ unsigned int __RPC_FAR *aUniqueID,

which is strange, because an unsigned int is always positive.

Later in that method, aUniqueID is calculated as follows:

  void *uniqueID;
  GetUniqueID(&uniqueID);
  *aUniqueID = - NS_PTR_TO_INT32(uniqueID);

similar for nsAccessibleWrap::GetChildIDFor. This method returns a
PRInt32, which is signed. GetUniqueID definitely returns a positive
number, and it gets converted to a negative in both cases.
So what's strange is the fact that the nsAccessNodeWrap::get_nodeInfo
declares aUniqueID as being an unsigned int.

Marco

_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility
Reply | Threaded
Open this post in threaded view
|

Re: Trouble using IA2 uniqueID and accessibleObjectFromEvent /accChildin Gecko 1.9

Steve Lee-3
On 03/01/2008, Marco Zehe <[hidden email]> wrote:
> So what's strange is the fact that the nsAccessNodeWrap::get_nodeInfo
> declares aUniqueID as being an unsigned int.

HI Guys and happy new year.

I'm a little rusty on this level of detail in C but the
signed/unsigned-ness affects how a number is interpreted in
expressions and the same bit pattern can be treated as either signed
or unsigned according to how you declare it. Further signedness has no
effect when 'assigning' as the bit pattern is just copied. For example

#include<stdio.h>
main()
{
    unsigned int u;
    signed int s = -3, s2 = 0;
    u=s;
    s2=u;
    printf("%u %d %d %u %d", u, s, u, s, s2);
}

will compile just fine and print something like
  4294967293 -3 -3 4294967293 -3
depending on sizeof(int)

Often if you crank up the compiler warning level or use a lint you
should get warnings about singed/unsigned mismatch.

The fact thatnsAccessNodeWrap::get_nodeInfo passes out via a pointer
probably weakens any such checking. You can return a signed via a
pointer to unsigned into a signed variable without trouble.

so
  *aUniqueID = - NS_PTR_TO_INT32(uniqueID);
is quite happy and if NS_PTR_TO_INT32 is a macro rather than inline
(I'm guessing as all caps) then there is even less type checking going
on.

So in conclusion its probably an symantic error but you get away with
it due to weak compiler checking. The signed/unsignedness of
intermediate variables/declarations has no effect on the value you
see. What matters is the value being written and how the receiving
variable is declared (python adds layers to that).

Hope that helps rather than muddies things.

Steve



--
Steve Lee
--
Jambu - Alternative Access to Computers
www.fullmeasure.co.uk


On 03/01/2008, Marco Zehe <[hidden email]> wrote:

> Hi Mick,
>
> Michael Curran wrote:
> > IAccessible2::uniqueID is a long, according to its specification
> >
> > How exactly is the ID being converted to negative in the windows
> > wrappers? is it just a simple 0-ID or ID*-1?
>
> In nsAccessNodeWrap::get_nodeInfo, the parameter for the UniqueID is
> declared as this:
>     /* [out] */ unsigned int __RPC_FAR *aUniqueID,
>
> which is strange, because an unsigned int is always positive.
>
> Later in that method, aUniqueID is calculated as follows:
>
>   void *uniqueID;
>   GetUniqueID(&uniqueID);
>   *aUniqueID = - NS_PTR_TO_INT32(uniqueID);
>
> similar for nsAccessibleWrap::GetChildIDFor. This method returns a
> PRInt32, which is signed. GetUniqueID definitely returns a positive
> number, and it gets converted to a negative in both cases.
> So what's strange is the fact that the nsAccessNodeWrap::get_nodeInfo
> declares aUniqueID as being an unsigned int.
>
> Marco
>
> _______________________________________________
> dev-accessibility mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-accessibility
>


--
Steve Lee
--
Jambu - Alternative Access to Computers
www.fullmeasure.co.uk
_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility
Reply | Threaded
Open this post in threaded view
|

Re: Trouble using IA2 uniqueID and accessibleObjectFromEvent /accChildin Gecko 1.9

Marco Zehe-3
In reply to this post by Marco Zehe-3
Hi Steve,

Steve Lee wrote:
> HI Guys and happy new year.
The same to you and family!

> I'm a little rusty on this level of detail in C but the
> signed/unsigned-ness affects how a number is interpreted in
> expressions and the same bit pattern can be treated as either signed
> or unsigned according to how you declare it. Further signedness has no
> effect when 'assigning' as the bit pattern is just copied. For example

Thanks! I vividly remember something way back from my computer sciences
studies. :-)

However, Mick and I discussed this further on IRC and found the culprit
in NSAccessibleWrap::Get_UniqueID, whose only parameter, a reference
parameter, is a long, as documented in the IA2 IDL. In that method, we
don't negate the value we're getting back, and that's the value Mick is
getting. As soon as he negated the value on his end and then tried one
of the other methods, he was getting correct results.
I've prepared a patch for this and am going to test it now so ATs don't
have to negate the value, but we give them what is right. In other
methods, we actually expect the value to be negated, so it's definitely
our bug.

If you're interested, look at bug
https://bugzilla.mozilla.org/show_bug.cgi?id=410604.

Marco

_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility
Reply | Threaded
Open this post in threaded view
|

Re: Trouble using IA2 uniqueID and accessibleObjectFromEvent / accChildin Gecko 1.9

Marco Zehe-3
In reply to this post by Michael Curran
Michael Curran wrote:
> I should also mention that the uniqueIDs I'm getting back from
> IAccessible2 are positive integers. Though in the IAccessible2 IDL it
> states that a uniqueID is  tipically a negative number.

This is going to be fixed in the January 6, 2007 nightly build.

Marco


_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility
Reply | Threaded
Open this post in threaded view
|

Re: Trouble using IA2 uniqueID and accessibleObjectFromEvent / accChildin Gecko 1.9

Marco Zehe-3
Marco Zehe wrote:
> This is going to be fixed in the January 6, 2007 nightly build.

OK, this time the new-year-devil bit me: It must be January 6, 2008
build of course! :-)

Marco

_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility
Reply | Threaded
Open this post in threaded view
|

Re: Trouble using IA2 uniqueID and accessibleObjectFromEvent / accChildin Gecko 1.9

Marco Zehe-3
In reply to this post by Michael Curran
Hi all,

Michael Curran wrote:
> I should also mention that the uniqueIDs I'm getting back from
> IAccessible2 are positive integers. Though in the IAccessible2 IDL it
> states that a uniqueID is  tipically a negative number.

Fix verified in Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US;
rv:1.9b3pre) Gecko/2008010605 Minefield/3.0b3pre using your test tool.

Marco

_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility