Closed Bug 1547407 Opened 5 years ago Closed 2 years ago

Cannot get line of text via get_text_at_offset() due to generated character at end of line

Categories

(Core :: Disability Access APIs, defect, P3)

defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jdiggs, Unassigned)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

Attached file broken-text.html

Steps to reproduce:

  1. Launch the attached test case

  2. Launch Accerciser and use it to select the accessible link

  3. In Accerciser's iPython console, type the following:

    acc.queryText().getTextAtOffset(0, TEXT_BOUNDARY_LINE_START)

Expected results: A valid string, a valid start offset, and a valid end offset.

Actual results: '', 0, 0

Impact: Orca cannot get the line using the API intended for this purpose. Instead it has to employ hacks to sort out what's on the line. Hacks are non-performant and prone to bugs. :(

Note: It's not broken for word; just line:

acc.queryText().getTextAtOffset(0, TEXT_BOUNDARY_WORD_START)

returns: 'Start ', 0, 6

Further distilled test case:
data:text/html,<style>p:after { content: 'c' };</style><p>ab</p>

This does seem to affect words in a different way as well, but only if the generated content would be treated as part of the word. In this example:
Word at offsets 0 and 1 return (0, 2, 'ab')
Word at offset 2 returns (0, 3, 'abc')

Blocks: texta11y
OS: Unspecified → All
Priority: -- → P3
Hardware: Unspecified → All

(In reply to James Teh [:Jamie] from comment #1)

Further distilled test case:
data:text/html,<style>p:after { content: 'c' };</style><p>ab</p>

This still returns (0, 0, none) for all 3 offsets 0 to 2 if called with line offset boundary, after bug 1670541.

This does seem to affect words in a different way as well, but only if the generated content would be treated as part of the word. In this example:
Word at offsets 0 and 1 return (0, 2, 'ab')
Word at offset 2 returns (0, 3, 'abc')

After your word boundary fixes, this always returns (0, 3, 'abc').

I can't reproduce this any more, with or without CTW.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: