Closed Bug 1821954 Opened 2 years ago Closed 2 years ago

[CTW] Delegate to HyperTextAccessibleBase in HyperTextAccessible::Char/TextBounds

Categories

(Core :: Disability Access APIs, task)

task

Tracking

()

RESOLVED FIXED
113 Branch
Tracking Status
firefox113 --- fixed

People

(Reporter: Jamie, Assigned: Jamie)

References

Details

Attachments

(1 file)

In bug 1820029, TextLeafPoint gained its own support for CharBounds on LocalAccessibles. I noted this during review, but forgot about it when accepting the patch:

HyperTextAccessible::CharBounds/TextBounds should probably call the HyperTextAccessibleBase versions if the cache is enabled, just as we do for TextAtOffset, etc. This will allow our existing cross-platform text tests (where we have more coverage) to test that the new implementation is working. It also paves the way for us to rip out the HyperTextAccessible methods once the cache is shipped.

This is consistent with other HyperTextAccessible methods such as TextAtOffset.
It allows us to test the new implementation with LocalAccessible.
This is especially useful because we have better test coverage in our HyperText tests than we do in our TextLeafPoint tests.

In fact, running the tests with this change uncovered some bugs which I had to fix here.

First, TextLeafPoint::ComputeBoundsFromFrame was preferring to stick to the end of the first frame when on a boundary, rather than using the next frame.
For example, if we had the text "a\nb" where "b" is split into a continuation, offset 2 "b" was previously using the primary frame instead of the continuation.
This isn't a problem in HyperTextAccessible::GetBoundsInFrame because it walks to the next continuation if needed, since it is dealing with a range of offsets.
This is fixed by preferring the beginning of the next frame instead.

Second, passing the text length as the offset (i.e. one past the last character) should return a 0 rect.
TextLeafPoint::CharBounds needed to be tweaked accordingly.

Third, if TextLeafPoint returns a 0 rect (e.g. because a RemoteAccessible doesn't have a cache yet), HyperTextAccessibleBase needs to respect that and return it untouched.

Pushed by jteh@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/908a298d2fdd
Make HyperTextAccessible::Char/TextBounds use HyperTextAccessibleBase when the cache is enabled. r=morgan
Regressions: 1823594
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: