getTextAtOffset fails on wrapped links

RESOLVED FIXED

Status

()

Core
Disability Access APIs
RESOLVED FIXED
11 years ago
11 years ago

People

(Reporter: parente, Assigned: Aaron Leventhal)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

11 years ago
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a5pre) Gecko/20070503 Minefield/3.0a5pre

This looks like a FF bug blocking LSR.

1) Opened the "wrapped_link.html" test case.
2) Resized window so the link "Accessible Rich Internet Applications" spanned
two visible lines in both paragraphs.
3) Entered the following in Accerciser.

==== BEGIN TEST FOR PARAGRAPH #1 ====
In [28]: t = IText(acc)
In [29]: t.getTextAtOffset(0, TEXT_BOUNDARY_LINE_START)
Out[29]: 
('This section details how LSR responds to basic user behaviors in a Web ',
 0,
 71)
In [30]: t.getTextAtOffset(71, TEXT_BOUNDARY_LINE_START)
Out[30]: 
('browser such as tabbing through a document, refreshing a page, following ',
 71,
 144)
In [31]: t.getTextAtOffset(144, TEXT_BOUNDARY_LINE_START)
Out[31]: 
('a link, raising the window frame to the foreground after switching away, ',
 144,
 217)
In [32]: t.getTextAtOffset(217, TEXT_BOUNDARY_LINE_START)
Out[32]: 
('and so on. The behaviors described in this section are independent of the ',
 217,
 291)
In [33]: t.getTextAtOffset(291, TEXT_BOUNDARY_LINE_START)
Out[33]: ('features defined for \xef\xbf\xbc and ', 291, 318)
In [34]: t.getTextAtOffset(318, TEXT_BOUNDARY_LINE_START)
Out[34]: ('features defined for \xef\xbf\xbc and \xef\xbf\xbc', 291, 319)
In [35]: t.getTextAtOffset(319, TEXT_BOUNDARY_LINE_START)
Out[35]: ('', 318, 318)
==== END TEST FOR PARAGRAPH #1 ====

Notice that the link doesn't appear when I request the line starting at 291.
But when I request 319, it returns the same line with the link included.

Here's the case that convinces me it's a FF problem.

==== BEGIN TEST FOR PARAGRAPH #2 ====
In [36]: t = IText(acc)
In [37]: t.getTextAtOffset(0, TEXT_BOUNDARY_LINE_START)
Out[37]: 
('This section details how LSR responds to basic user behaviors in a Web ',
 0,
 71)
In [38]: t.getTextAtOffset(71, TEXT_BOUNDARY_LINE_START)
Out[38]: 
('browser such as tabbing through a document, refreshing a page, following ',
 71,
 144)
In [39]: t.getTextAtOffset(144, TEXT_BOUNDARY_LINE_START)
Out[39]: 
('a link, raising the window frame to the foreground after switching away, ',
 144,
 217)
In [40]: t.getTextAtOffset(217, TEXT_BOUNDARY_LINE_START)
Out[40]: 
('and so on. The behaviors described in this section are independent of the ',
 217,
 291)
In [41]: t.getTextAtOffset(291, TEXT_BOUNDARY_LINE_START)
Out[41]: ('features defined for \xef\xbf\xbc and ', 291, 318)
In [42]: t.getTextAtOffset(318, TEXT_BOUNDARY_LINE_START)
Out[42]: ('features defined for \xef\xbf\xbc and \xef\xbf\xbc', 291, 319)
In [43]: t.getTextAtOffset(319, TEXT_BOUNDARY_LINE_START)
Out[43]: ('', 318, 318)
In [44]: t.characterCount
Out[44]: 345
In [45]: t.getTextAtOffset(320, TEXT_BOUNDARY_LINE_START)
Out[45]: ('', 318, 318)
In [46]: t.getText(0,-1)
Out[46]: 'This section details how LSR responds to basic user behaviors in a
Web browser such as tabbing through a document, refreshing a page, following a
link, raising the window frame to the foreground after switching away, and so
on. The behaviors described in this section are independent of the features
defined for \xef\xbf\xbc and \xef\xbf\xbc. And some more text here.'
In [47]: 
==== END TEST FOR PARAGRAPH #2 ====

Notice from In[41] to Out[43], I get the same behavior as in paragraph #1. But
this is wrong because there is text following the wrapped link. Notice the
character count in Out[44]. No matter what index I try to use after the link, I
can't get at that text. Requesting all of the text does work. This has
something to do with getTextAtOffset again.
(Assignee)

Comment 1

11 years ago
Created attachment 264247 [details] [diff] [review]
If we're anywhere inside the child object after offset 0, then a parent-relative offset needs to come after the embed char
Attachment #264247 - Flags: review?(parente)
(Reporter)

Updated

11 years ago
Attachment #264247 - Flags: review?(parente) → review+
(Assignee)

Updated

11 years ago
Status: NEW → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED

Comment 2

11 years ago
Comment on attachment 264247 [details] [diff] [review]
If we're anywhere inside the child object after offset 0, then a parent-relative offset needs to come after the embed char


>-    addTextOffset = (TextLength(descendantAccessible) == addTextOffset) ? 1 : 0;
>+    addTextOffset = addTextOffset > 0;

Doesn't it add compliling warnings? In any way I guess 
addTextOffset > 0 ? 1 : 0
is easier to read.
You need to log in before you can comment on or make changes to this bug.