To fix this, when we find a text leaf in ChildAtPoint, I think we're going to need to look at the character rects. Walking the character rects for the entire node will be way too expensive. Instead, for each line start, we can: 1. Use the line start cache to get the start and inclusive end offset of each line. 2. Get the character rects for the start and end offset. 3. Union them to get the line rect. 4. Check if the point is within that rect. This is similar to what we do in TextLeafRange::Bounds, but because we only need this for RemoteAccessible and because we are always walking from the first line start, I think it'll be easier to use the cache directly rather than TextLeafPoint.
Bug 1822340 Comment 3 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
To fix this, when we find a text leaf in ChildAtPoint, I think we're going to need to look at the character rects. Walking the character rects for the entire node will be way too expensive. Instead, for each line start, we can: 1. Use the line start cache to get the start and inclusive end offset of each line. 2. Get the character rects for the start and end offset. 3. Union them to get the line rect. 4. Check if the point is within that rect. This is similar to what we do in TextLeafRange::Bounds, but because we only need this for RemoteAccessible, we only need it within a single text leaf (not a HyperText) and we are always walking from the first line start, I think it'll be easier to use the cache directly rather than TextLeafPoint.