Closed Bug 1730096 Opened 3 years ago Closed 3 years ago

TextLeafPoint/Range: Implement support for format boundaries

Categories

(Core :: Disability Access APIs, task)

task

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: Jamie, Assigned: Jamie)

References

(Blocks 2 open bugs)

Details

Attachments

(9 files)

Clients need to be able to get a range of text with the same formatting. TextLeafPoint/Range needs to support this. Perhaps we could add a BOUNDARY_FORMAT or similar which is supported by TextLeafPoint::FindBoundary.

Depends on: 1729407
No longer depends on: 1730087

Most formatting spans an entire DOM element, so we can cache it by just caching the formatting attributes on each text leaf. To find the format boundary, we can search the tree looking for changes in the attributes. However, spelling errors (and eventually grammar errors) are more complicated because they can span just part of a text leaf. The same will be true for the upcoming CSS Custom Highlight API.

For spelling errors, I'm thinking it probably makes sense to cache the spelling error selection ranges on the document. We're probably going to have to do similarly for normal text selection. When searching for format boundaries, we'd then tweak the returned range if it overlapped any spelling error range.

No longer blocks: a11y-ctw

This will be used later to check whether text attributes are different between two Accessibles.
I added this as a method instead of operator== because callers always hold a pointer to AccAttributes, and *a1 == *a2 is weird and will probably lead to mistakes.
This required adding operator== for our value structs.

Assignee: nobody → jteh
Status: NEW → ASSIGNED

This supports both fetching text attributes and finding the start of attribute runs, but only for LocalAccessible.
Support for RemoteAccessible will be added in a subsequent patch.

This uses TextLeafPoint.
This patch includes support for ATK, IA2 and XPCOM.
As with TextAtOffset, HyperTextAccessible calls the base implementation if the cache is enabled, but otherwise uses the old implementation for now.

This will be used to include text attributes as part of the cache for an Accessible.

This is necessary for two reasons:

  1. Leaf text attributes and default text attributes are cached separately, since the caller can choose whether to include defaults or not. This means merging them together.
  2. Methods for retrieving attributes currently return a non-const AccAttributes. We might be able to change this in future for some of them, but I didn't want to deal with that in this work.

This patch includes ATK and XPCOM support.

Blocks: 1737919
Pushed by jteh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/809cb98971bc part 1: Add AccAttributes::Equal to compare attributes in two instances. r=eeejay https://hg.mozilla.org/integration/autoland/rev/3d075d392eeb part 2: Implement support for text attributes in TextLeafPoint. r=eeejay https://hg.mozilla.org/integration/autoland/rev/e273963101b6 part 3: Add HyperTextAccessibleBase::TextAttributes. r=eeejay https://hg.mozilla.org/integration/autoland/rev/10a11e1eaf81 part 4: Support AccAttributes as a value inside an AccAttributes. r=eeejay https://hg.mozilla.org/integration/autoland/rev/627e8bd8323d part 5: Push text attributes to the cache. r=eeejay https://hg.mozilla.org/integration/autoland/rev/ba4efa10da03 part 6: Add AccAttributes::CopyTo to copy an AccAttributes. r=eeejay https://hg.mozilla.org/integration/autoland/rev/5ea77a2caedd part 7: Support cached remote text attributes in TextLeafPoint. r=eeejay https://hg.mozilla.org/integration/autoland/rev/b13e575cde62 part 8: Move DefaultTextAttributes to HyperTextAccessibleBase and implement it for RemoteAccessible. r=eeejay https://hg.mozilla.org/integration/autoland/rev/50a53cf974d6 part 9: Add tests for cached text attributes. r=eeejay
Blocks: 1739559
Regressions: 1744150
Regressions: 1754675
Regressions: 1756730
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: