-
-
Notifications
You must be signed in to change notification settings - Fork 641
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
Get reliable points from offsets in virtual buffers #8479
Conversation
fixes probably also #7915 |
@Adriani90 commented on 4 jul. 2018 15:34 CEST:
Would you be able to verify that using this try build? Note that this try build doesn't contain the adobe code yet. |
@LeonarddeR I have tested the issues and got following results: #6460: I cannot reproduce it at all, neither with NVDA 2018.2.1. But the webpage from NV Access has been redesigned. I tried different selections but I get different offset points for x and y, both at the start and at the end of the offset. #7853: I confirm that your try build solves the issue. #7915: unfortunately there is no improvement of mouse routing to navigator object in google chrome at all. #7916: I guess the getPointFromOffset in MS Edge is broken as well. Mouse routing dows not work either. |
@Adriani90 commented on 4 jul. 2018 22:20 CEST:
How did you test this? |
I went on different websites and used object navigation. In Laptop layout, I pressed nvda+shift+m to route the mouse to the navigator object. But I didn‘t see any difference compared to NVDA 2018.2.1.
Von meinem iPhone gesendet
… Am 05.07.2018 um 06:54 schrieb Leonard de Ruijter ***@***.***>:
@Adriani90 commented on 4 jul. 2018 22:20 CEST:
#7915: unfortunately there is no improvement of mouse routing to navigator object in google chrome at all.
How did you test this?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Note that you should not use object navigation to test this, because that will always set the mouse to the start of the object you selected. You should just move the browse mode caret character by character or word by word and than move the mouse to the navigator object. This script description is actually confusing, as conceptually, the mouse is moved to the review position. |
I have tested as you adviced. There is still the same behavior like in NVDA 2018.2.1. I have tried on google, hello magazine, NV Access and other websites. I have also tried to route the mouse in focus and browse mode. It does not move the mouse to the object at all. It just reports "Window" or "Pane" but it does not behave like in firefox, or internet explorer where the mouse is routed much more accurately. |
But there is a huge improvement in Mozilla Firefox, with your try build. The mouse can be routed from word to word which is quite reliable compared to NVDA 2018.2.1. In Internet explorer, Google Chrome and MS Edge there is no difference between NVDA 2018.2.1 and the try build. |
Edge will be dealt with in a subsequent pr, however that depends on #7537.
|
On some buttons on Github, when I try to route the mouse in Firefox, I get following error:
The buttons are: Insert a quote Add a bulleted list Directly mention a user or team |
on the top of the github page, for some elements I get following error:
This is the case for following elements: Link Homepage Button Create new… |
The attribute "Rindex" error appears in Google Chrome everytime as well, much more often than in Firefox. |
In Edge I don't get any entry in the log file unfortunately, there is no input registered. |
In Internet explorer there is also no entry in the log file when mouse routing fails. |
@Adriani90 commented on 5 jul. 2018 19:32 CEST:
AH, this bug was already there actually. Fixed it while at it.
Hmm this error seems to be quite unrelated to this pr.
Could you please limit your comments and reports to the scope of this pr, thus, adobe reader, Firefox and Chrome? As I noted earlier, Edge will be dealt with at a later moment. For Internet Explorer, I"m afraid there's nothing we can do to improve mouse tracking. |
…es from IA2Text. Thanks to @jcsteh
…thin the control field.
…attribute to the node that indicates this
Here is a try build that should move the mouse to the center of the characters in Firefox and Chrome. |
@@ -132,7 +132,7 @@ def _getPointFromOffsetInObject(cls,obj,offset): | |||
# believes that it belongs to offset+1. | |||
# This means that, when you use l{_getOffsetFromPoint}, the result would be offset+1. | |||
# We yet stay with the center of the character, though. | |||
point=textInfos.Point(res[0]+res[2]/2,res[1]+res[3]/2) | |||
point=textInfos.Point(res[0]+(res[2]/2),res[1]+(res[3]/2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than doing the math here, can you use the location helper classes? It would make it clearer that characterExtents
returns (x,y,width,height)
except COMError: | ||
raise NotImplementedError | ||
# Normally, L{_getPointFromOffset} implementations that rely on | ||
# character bounding rectangles use the center point of the rectangle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment still correct? It makes it sound like this will not use the center, which is what it appears to do.
I'm testing out this new build (nvda_snapshot_try-geckoPointFromOffset-15793,c19970ec.exe) Indeed in chrome and firefox the middle of the word / character is now selected.
One point is that I do not have mouse tracking enabled, should it still read the paragraph? The amount reported does obey the resolution setting.
For some reason I can't seem to get anything intelligible when using |
@feerrenrut commented on 7 aug. 2018 06:48 CEST:
Hmm yes, it turns out that disabling mouse tracking will still report mouse changes triggered by NVDA. I did not expect this honestly, and I'm not sure whether this is defined behavior. I'd expect it not to do this.
I tend to use this website for testing random things. Try the text that reads "Similarly, the open-ended nature of the game" for example. That will report the character that belongs to offset+1 when I move the mouse to the text. Now, your eyes should be able to determine whether pointFromOffset or offsetFromPoint fails here. |
@leonardder commented on Aug 7, 2018, 3:14 PM GMT+10:
I can't remember whether there was a filed issue for this change, but without this behaviour, moving mouse to review would just report nothing when mouse tracking is disabled. Silence is confusing/misleading here, IMO. We could report "Moved" or something, but if we're going to do that, we may as well report where it moved. |
Using your link, and arrowing around (to the last letter of "players are free to attack at will") moving the mouse to the 'L' with "Move mouse to current navigator object", and using the "Navigate to the object under the mouse" then "Paragraph" is reported. Pressing "Report current word in review" and "Similarly," is reported. Which is the start of the paragraph. I don't know how to report the word under the mouse in this way.
I'm happy with this, perhaps we can document it somewhere as part of this pull request? Also that the amount reported does obey the resolution setting in the mouse setting dialog. |
@feerrenrut commented on 7 aug. 2018 11:48 CEST:
Does the mouse end up at the exact center position of the "L" though? |
Yes, in Firefox and Chrome. In Adobe reader the mouse moves to the center of the word as expected. |
@feerrenrut: Are you done with reviewing this, or have I missed something that I haven't yet addressed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this looks good.
First of all, many thanks to @jcsteh for sharing his ideas with regard to how to implement this.
Link to issue number:
Fixes #6460
Summary of the issue:
When calculating the position of text in virtual buffers, NVDA uses the position of the object the text belongs to, rather than the real position of the offset you're retrieving the point for.
Description of how this pull request fixes the issue:
Added two attributes to virtual buffer text nodes as discussed with @jcsteh:
the Gecko virtual buffer text info now has its own _getPointFromOffset implementation that uses the new virtual buffer attributes.
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.
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.
Testing performed:
Known issues with pull request:
Change log entry: