After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 100943 - Additional text API needed for efficient screen review
Additional text API needed for efficient screen review
Status: RESOLVED FIXED
Product: atk
Classification: Platform
Component: gail
unspecified
Other All
: Normal enhancement
: ---
Assigned To: padraig.obriain
padraig.obriain
: 100942 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-12-11 13:35 UTC by bill.haneman
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
Proposed new API (14.41 KB, patch)
2003-01-10 10:37 UTC, padraig.obriain
none Details | Review
Updated proposed API (15.58 KB, patch)
2003-01-14 10:26 UTC, padraig.obriain
none Details | Review

Description bill.haneman 2002-12-11 13:35:40 UTC
In order to do efficient screen review, in which an assistive technology
attempts to extract text coordinate informatin from the screen and convert
it into a 2-D character format, certain new APIs are needed.

The existing APIs allow screen review, but require substantial (and often
inefficient) client processing.

New API needed:

atk_text_get_range_extents (AtkText *text, 
                            gint start_offset, gint end_offset,
                            gint *x, gint *y, 
                            gint *width, gint *height,
                            AtkCoordType *coord_type);

atk_text_get_range_within_bounds (AtkText *text,
                                  gint *start_offset, gint *end_offset,
                                  gint x, gint y, 
                                  gint width, gint height,
                                  AtkCoordType *coord_type);

These should be virtualized functions.
Comment 1 padraig.obriain 2002-12-11 16:39:00 UTC
*** Bug 100942 has been marked as a duplicate of this bug. ***
Comment 2 padraig.obriain 2003-01-09 10:21:06 UTC
I note that in the bug report 100944 the proposal for
getRangeFromBounds seems to have changed from the initial proposal.

Do the paraameters for atk_text_get_range_within_bounds() also need to
change?

Should the function atk_text_get_range_extents() return -1  for x, y,
width and height if the offset values are invalid?

If so, should the same apply to atk_text_get_character_offset()?
Comment 3 bill.haneman 2003-01-09 11:02:20 UTC
Hi Padraig:

Yes, since there could be multiple contiguous ranges within a bounding
box, I think the Atk API should change too.  I am not sure what we
should return for our 'RangeList', or if perhaps there is a better way
for ATK to indicate one (via 'out params' or such, as the original
proposal did with the start and end offsets).  I don't mind leaving
that to your judgement.

I assume you mean ..._get_character_extents above.  I would return
width and height of zero for all 'invalid' cases; am not sure about -1
for x and y, since in some coordinate systems these would be valid and
meaningful offset values.  Personally I think it's reasonable to say
that the return values for these methods are "undefined" when invalid
offsets are given... though perhaps '0' should always give usable results.


Comment 4 padraig.obriain 2003-01-10 10:37:35 UTC
Created attachment 13466 [details] [review]
Proposed new API
Comment 5 padraig.obriain 2003-01-10 10:38:59 UTC
Bill,

I have attached a proposal for the new API for the get_bounded_ranges
function.

Can we get agreement on this?
Comment 6 bill.haneman 2003-01-10 16:29:36 UTC
Padraig:

this looks good - my only suggestion is that perhaps the
atk_text_get_bounded_ranges() call might, rather than returning offset
lists into int** pointers, return something more structured.

Most clients of this API will ultimately be interested not only in the
offset ranges but the geometry of the ranges within the outer bounding
box.  Thus after calling atk_text_get_bounded_ranges() they might call
atk_text_get_text_range (start, end) and atk_text_get_range_extents
(start, end) on each of the ranges.

This is likely to be somewhat redundant since in the process of
calculating the 'bounded ranges', the original function call will
probably have amassed most of the info necessary for getting the range
extents, etc.  So it might be more efficient to return not only the
bounding offsets for the returned ranges, but their bounds as well.

with that in mind, we could return an array of AtkTextRange structs:

struct AtkTextRange {
    AtkTextRectangle bounds;
    gint startOffset;
    gint endOffset;
};

or perhaps even include the text string itself:
    ...
    gint endOffset;
    char *content;
};

This means that the caller would have to do more g_free()'ing, but it
would eliminate the need for multiple subsequent client API calls in
many cases.

What do you think?

-Bill
 














Comment 7 padraig.obriain 2003-01-14 10:26:53 UTC
Created attachment 13554 [details] [review]
Updated proposed API
Comment 8 padraig.obriain 2003-01-14 10:28:42 UTC
Bill,

I have updated the proposed API and provided an implementation.

I would appreciate your comments on the attachment.
Comment 9 bill.haneman 2003-01-20 10:26:34 UTC
Hi Padraig:

API-wise the patch looks great (except for my concerns about an
apparent API change in atk_text_get_character_extents).  I like the
inclusion of text content and offsets in the TextRange structure which
as we discussed is likely to be very useful to ATs.

I see that atk_text_real_get_character_extents and
atk_text_get_character_extents don't check to see that the input
AtkTextRectangle param is non-null before poking it.  Seems as though
we should. 

The patch doesn't seem to actually connect the API to the vtable
entries, unless I am missing something... seems to be missing the
changes to class_init.

The one issues with the patch is that atk_text_get_character_extents
changes its API signature.  Since this method has been around in the
stable branch for awhile, I don't think we can do this even though
your new API is more elegant.  I would suggest making this new
text-char-extents API internal so that it can conveniently be used by
your range-bounds implementation, and wrap it in the old API for
public use.

Comment 10 padraig.obriain 2003-01-20 11:10:45 UTC
Bill,

I am confused by your comments about atk_text_get_character_extents().
There is no change to the API. The only change is to ensure that the
width returned is not negative.

The function atk_text_real_get_range_extents() is called in
atk_text_get_range_extents() if no other implementation has been
provided.
Comment 11 bill.haneman 2003-01-21 11:31:41 UTC
you're right of course.  I can't see where I misread the patch
yesterday, but it seems I did.

Looks good as-is.  The use of a default implementation based on
whether the vtable entry is null seems unusual but perhaps it's
necessary for interface classes, not sure.  At any rate I don't think
it's harmful.
Comment 12 padraig.obriain 2003-01-21 11:51:24 UTC
Patch has been applied to CVS HEAD, i.e. after branch for gnome-2-2.
Comment 13 padraig.obriain 2003-01-21 16:51:56 UTC
I have discovered how to specify default implementations in the vtable
for interfaces. I will commit a change for that.