IA2TextTextInfo: Fix handling of embedded objects when expanding to mouse chunk. (#14755)
Fixes #9235.
Summary of the issue:
In Firefox, when there is text before and after a link, mousing over the text after the link often doesn't read the text. This applies to other types of inline elements as well; e.g. buttons.
Description of user facing changes
In Mozilla Firefox, moving the mouse over text after a link, etc. now reliably reports the text.
Description of development approach
When handling unit_mouseChunk, the code in IA2TextTextInfo.expand first expands to the user configured resolution (line, paragraph, etc.). It then attempts to shrink the range so that it only covers the text between embedded objects before and after the origin, if any.
The code previously calculated the final end offset incorrectly. It used oldEnd - self._startOffset as the offset from which to search for an embedded object after the origin. However, self._startOffset had already been moved to the embedded object before the origin, so it was no longer related to the text string. This meant that the search offset was completely bogus and could even result in _endOffset being smaller than _startOffset.
Now, we use the same offset for both embedded object searches: our origin relative to the start of the expanded range of text. I've also added comments.