Closed Bug 1730862 Opened 3 years ago Closed 2 years ago

TextLeafPoint: Implement support for caret at end of wrapped line

Categories

(Core :: Disability Access APIs, task)

task

Tracking

()

RESOLVED FIXED
96 Branch
Tracking Status
firefox96 --- fixed

People

(Reporter: Jamie, Assigned: Jamie)

References

Details

Attachments

(3 files)

When the caret is at the end of a line which wraps (e.g. if you press the end key), the text position (object and offset) is the same as the start of the next line. That is, the end of the wrapped line doesn't have its own position. To handle this, HyperTextAccessible has a special TEXT_OFFSET_CARET which the caller can specify when fetching boundaries. For example, if the caret is at the end of the line and you call TextAtOffset with TEXT_OFFSET_CARET and nsIAccessibleText::BOUNDARY_LINE_START, it will return the line before the caret, not the one after it.

We need to support this for TextLeafPoint. I think we'll need a special TextLeafPoint instantiation which gets handled specially by FindBoundary.

No longer blocks: a11y-ctw
Depends on: 1741792
Assignee: nobody → jteh
Blocks: 1741792
No longer depends on: 1741792
  1. When calculating a start offset, we usually want 0 if the offset can't be transformed, thus clipping to the start of this Accessible.
    Previously, CharacterCount was always returned even when calculating a start offset.
    Now, we return 0 for a start offset, CharacterCount for an end offset.
  2. Sometimes, this fallback value is insufficient and we need to know explicitly whether it failed.
    As well as the offset, we now return a boolean indicating this.
    This will be used in a subsequent patch.
  3. Even though TransformOffset only deals with positive numbers, callers usually deal with signed numbers.
    Therefore, we now use int32_t insteaed of uint32_t to avoid a lot of casting.

The caret can be at the end of a wrapped line, but this does not have its own offset.
In this case, the way we handle the caret depends on what is being queried.
For character, we want to return no character at the position of the caret.
For word and line, we want to return the word/line before the caret.

To facilitate this conditional treatment, we use a special TextLeafPoint which represents the caret.
This is then actualized to a real point depending on the method called.

This uses the caret support in TextLeafPoint.

Pushed by jteh@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/865c820b1414
part 1: Make HyperTextAccessibleBase::TransformOffset easier to use. r=eeejay
https://hg.mozilla.org/integration/autoland/rev/189f0c680c68
part 2: Support retrieval of the caret using TextLeafPoint. r=eeejay
https://hg.mozilla.org/integration/autoland/rev/6d52b2ac56ef
part 3: Support the caret at the end of a line in HyperTextAccessibleBase. r=eeejay
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: