New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect offset points generated in tree interceptor text info #6460

Closed
leonardder opened this Issue Oct 13, 2016 · 1 comment

Comments

Projects
None yet
3 participants
@leonardder
Collaborator

leonardder commented Oct 13, 2016

Steps to reproduce:

  1. GO to nvaccess.org
  2. Scroll to the text below the "What is NVDA" heading
  3. Select the line below the heading
  4. Start a python console
  5. Do the following:

    ti=nav.treeInterceptor.makeTextInfo("selection")
    ti._startOffset
    323
    ti._endOffset
    421
    ti._getPointFromOffset(323).x
    401
    ti._getPointFromOffset(323).y
    673
    ti._getPointFromOffset(421).x
    401
    ti._getPointFromOffset(421).y
    673

As you will notice, the x and y for both offsets are the same, which shouldn't be the case.

@jcsteh jcsteh added the p4 label Oct 26, 2016

@jcsteh

This comment has been minimized.

Contributor

jcsteh commented Oct 26, 2016

Currently, virtual buffers can only reliably map to the deepest object; i.e. they can't map to positions within the text. Doing otherwise is complicated because of the way embedded objects are exposed, things such as aria-label (which aren't really text as far as the underlying document is concerned), etc. Doing this efficiently would require some significant enhancements to the virtual buffer framework.

We're looking at moving away from virtual buffers in the future anyway (at least for some things), at which point this issue will no longer exist. However, that is probably quite some way off.

P4 because this would definitely be nice to have, but it doesn't affect most use cases currently.

@nvaccessAuto nvaccessAuto added this to the 2018.4 milestone Aug 20, 2018

feerrenrut added a commit that referenced this issue Aug 20, 2018

Get reliable points from offsets in virtual buffers (PR #8479)
Fixes #6460

1. Added two attributes to virtual buffer text nodes.
   - ia2TextOffset: holds the start offset for a TextFieldNode within the IAccessibleText of its associated 
     object. This attribute is only added to text field nodes that originate from IAccessibleText.
   - strippedCharsFromStart: When characters are stripped from the start of a text node (#2963) this 
      attribute holds the amount of stripped chars from the start, in order for us to correct the 
      ia2TextOffset.

2. the Gecko virtual buffer text info now has its own _getPointFromOffset implementation that uses the new virtual buffer attributes.

3. VirtualBufferTextInfo.getTextWithFields is now split up into a helper function _getFieldsInRange, similar to DisplayModelTextInfo. This allows for easy retrieval of control/format fields in a particular range, regardless where the text info is positioned.

4. pointFromOffset in the adobe acrobat virtual buffer now uses the _indexINParent attribute. It seems Adobe Acrobat has separate dom nodes for every word, so pointFromOffset now gets the center point of the word, which is far better than it was before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment