Re: [g-a-devel] Doubt about AtkHypertext interface



On Tue, 2010-09-28 at 14:49 -0400, Joanmarie Diggs wrote:
> [...]
> > ..but still, I can't get what the char_index is and what it's used for.
> 
> Consider this paragraph:
> 
>     <p>This <a href='foo'>is</a> a <a href='bar'>test</a>.</p>
> 
> char_index refers to the offset within the string, thus:
> 
> T h i s   i s   a   t e s t .
> 0 1 2 3 4 5 6 7 8 9 A B C D E
> 
> The question atk_hypertext_get_link_index is answering is: Is the
> character at index/offset i part of a link -- and if so which link?

Great explanation. Now 'suddently' everything makes sense for me! :-)

> Thus:
> 
> * For indices 5 and 6, I'd expect atk_hypertext_get_link_index to 
>   return 0 because 'is' is text associated with the first link.
> 
> * For indices 10 through 13, I'd expect 1 to be returned because 'test' 
>   is text associated with the second link.
> 
> * For all other indices, I'd expect -1 to be returned because the    
>   characters at those indices are not associated with any link.

Thanks for the examples. They clearly confirmed what I'd understood from
the explanation above, so no doubts now.

> As for why we might want to use it:
> 
> Let's say the user is arrowing within the text by character or by word.
> WebKitGtk emits an object:text-caret-moved event. Orca needs to present
> that new character or word in response -- and we'd like to let the user
> know if that new character/word is part of a link.
> 
> In this example, what we know from the event is the AtkObject associated
> with the event (here it would be the paragraph), and we know the offset
> to which the caret was moved (event.detail1). From these two items we
> can find out if we need to say 'link' or not based on the return value
> of atk_hypertext_get_link_index().
> 
> Taking it a step further, since I'm already deep diving :-), let's say
> the return value is 0, so Orca announces 'link.' The user might then
> want to know the URI associated with the link at the location of the
> caret and do a whereAmI. The return value tells us which link it is. We
> can get that link via atk_hypertext_get_link() and, having done so, use
> atk_hyperlink_get_uri() to report 'foo'.

Ok, now I see why it's so useful. Anyway, my plan (if that's ok to you)
it's to try to fix 33785 for the time being, so later on we could tackle
the implementation of the rest of the functionality for hypertext and
hyperlink interfaces/objects.

But who knows... perhaps while fixing 33875 I could find out that
implementing some other methods like this one could be really easy, so
I'd do it anyway while fixing 33785... only time will tell :-)

> Thanks again for all your work! Sorry for being long-winded. And I look
> forward to meeting you very, very soon. :-)

Thanks to you for your great help. Looking forward to meet you as well,
along with the rest of the a11y gang, next week.

Mario



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]