Closed Bug 1901457 Opened 1 year ago Closed 1 year ago

[UIA] Implement support for retrieving the caret and selection

Categories

(Core :: Disability Access APIs, task)

Desktop
Windows
task

Tracking

()

RESOLVED FIXED
129 Branch
Tracking Status
firefox129 --- fixed

People

(Reporter: Jamie, Assigned: Jamie)

References

(Blocks 1 open bug, Regressed 1 open bug)

Details

Attachments

(6 files)

Bug 1901456 implements support for querying plain text boxes. To actually make this useful to an end user, we need to be able to retrieve the caret and selection. That means implementing ITextProvider get_SupportedTextSelection and GetSelection.

Assignee: nobody → jteh

Splitting setting into a separate bug.

Summary: [UIA] Implement support for retrieving and setting the caret and selection → [UIA] Implement support for retrieving the caret and selection
Blocks: 1903478

We already did this for BOUNDARY_CHAR, but i neglected to update this for cluster in bug 855184.
Without this, FindBoundary with BOUNDARY_CLUSTER on a caret TextLeafPoint when the caret is at the end of a line would return the last cluster instead of no character.

Previously, TextLeafPoint::GetCaret() returned a placeholder representation of the caret.
ActualizeCaret() was then used to get the real caret position, optionally adjusting for the line end depending on the caller's needs.
This causes problems when we need to store the TextLeafPoint information in a UIA text range object because the only way to indicate the line end insertion point is to use the GetCaret() placeholder, but that also means the stored position changes if the caret moves.
For example, if you disabled NVDA's "caret moves review cursor" setting and then moved the caret, the review cursor should stay at the old position, but it didn't previously.

To fix this:

  1. TextLeafPoint now has a new mIsEndOfLineInsertionPoint flag which is set to true by GetCaret() if appropriate.
  2. GetCaret() sets mAcc and mOffset immediately, rather than needing to call ActualizeCaret() later.
  3. TextLeafPoint methods still need to adjust the point to correctly handle the line end insertion point in some cases, but that is now handled by the private TextLeafPoint::AdjustEndOfLine method.
  4. FindBoundary now correctly returns the previous character/cluster when requested for this end of line insertion point. Strictly speaking, this bug always existed, but no existing callers ever triggered it.
Pushed by jteh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bf97de62f41d part 1: When a caret is at the end of a line, have TextLeafPoint::FindBoundary return no character for BOUNDARY_CLUSTER. r=nlapre https://hg.mozilla.org/integration/autoland/rev/eb0e859fbfc7 part 2: Refactor TextLeafPoint caret retrieval so that the end of line insertion point can be stored without being tied to the current caret position. r=nlapre https://hg.mozilla.org/integration/autoland/rev/bfba24b656c0 part 3: Add a way to get text selection as TextLeafRanges. r=nlapre https://hg.mozilla.org/integration/autoland/rev/23ab186873f4 part 4: Implement ITextProvider::get_SupportedTextSelection. r=nlapre https://hg.mozilla.org/integration/autoland/rev/8827579f5604 part 5: Implement ITextProvider::GetSelection. r=nlapre https://hg.mozilla.org/integration/autoland/rev/65c2331c0461 part 6: Raise UIA Text TextSelectionChanged and TextChanged events. r=nlapre
Regressions: 1904830
See Also: → 1905065
See Also: 1905065
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: