Skip to content
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 · Fixed by #8479
Closed

Incorrect offset points generated in tree interceptor text info #6460

LeonarddeR opened this issue Oct 13, 2016 · 1 comment · Fixed by #8479
Labels
p5 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority
Milestone

Comments

@LeonarddeR
Copy link
Collaborator

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 p5 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority label Oct 26, 2016
@jcsteh
Copy link
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 pushed a commit that referenced this issue Aug 20, 2018
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
Labels
p5 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants