Closed Bug 1756528 Opened 2 years ago Closed 2 years ago

TextRange::Crop doesn't crop siblings

Categories

(Core :: Disability Access APIs, defect)

defect

Tracking

()

RESOLVED FIXED
99 Branch
Tracking Status
firefox99 --- fixed

People

(Reporter: Jamie, Assigned: Jamie)

References

Details

(Whiteboard: [ctw-m1])

Attachments

(1 file)

I discovered this while working on cached text selection in bug 1741793.

Scenario:

  1. <div><p id="p1">a</p><p id="p2">b</p></div>
  2. "b" is selected.
  3. Get SelectionRanges from the div. The returned range will contain only p2.
  4. Call Crop() on the range, passing it the Accessible for p1.
  5. Crop should return false. Instead, it returns true! The range still contains p2.

This causes HyperTextAccessibleBase::SelectionBoundsAt to return the wrong result for p1. This probably doesn't matter to clients, but it's certainly wrong.

Curiously, HyperTextAccessible::SelectionBoundsAt has the same bug, but it doesn't use TextRange::Crop.

I couldn't really understand the previous code well enough to fix it, so I reimplemented it to be easier to work with (I hope).

Attachment #9264924 - Attachment description: Bug 1756528: Reimplement TextRange::Crop to fix a bug with cropping of siblings. → Bug 1756528: Fix cropping of siblings in TextRange::Crop.
Pushed by jteh@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/325ad2f9160c
Fix cropping of siblings in TextRange::Crop. r=eeejay
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 99 Branch
Whiteboard: [ctw-m1]
Regressions: 1763451
No longer regressions: 1763451
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: