Support getting character bounds for end of line insertion point
Categories
(Core :: Disability Access APIs, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox142 | --- | fixed |
People
(Reporter: Jamie, Assigned: eeejay, NeedInfo)
References
(Blocks 3 open bugs)
Details
Attachments
(1 file)
Some accessibility clients (e.g. Windows Text Cursor Indicator) need to be able to retrieve the rectangle for the character at the caret. In bug 1951833, I'm fixing this for line feed characters. However, TextLeafPoint::CharBounds doesn't properly support this for the end of line insertion point; i.e. when mIsEndOfLineInsertionPoint is true. Text Cursor Indicator seems to cope without this, but we should probably support it for completeness and/or better accuracy.
I think we can do this by getting the previous character's rectangle and then returning (prevX + prevW, prevY, 1, 1) or similar.
Reporter | ||
Updated•4 months ago
|
Reporter | ||
Comment 1•4 months ago
|
||
We're actually going to need this for UIA. STR:
- Enable Windows Text Cursor Indicator.
- Open this:
data:text/html,<textarea>a%0A%0A</textarea>
- Move to the final (blank) line.
- Expected: The Windows Text Cursor Indicator moves to the final line.
- Actual: Firefox's text insertion cursor moves to the final line. However, the Windows Text Cursor Indicator is on the first blank line.
Reporter | ||
Comment 2•4 months ago
|
||
I think we can do this by getting the previous character's rectangle and then returning (prevX + prevW, prevY, 1, 1) or similar.
That won't work for comment 1; that'll just result in the same problem. We need some way of getting the coordinates of the actual caret in this case. We do have HyperTextAccessible::GetCaretRect and we do send that to the parent process with caret events, but it's a bit messy for various reasons.
Reporter | ||
Comment 3•3 months ago
|
||
(In reply to James Teh [:Jamie] from comment #2)
We need some way of getting the coordinates of the actual caret in this case.
It'd be better if we could get the coordinates for where the caret would be if it landed here, since the caret might have actually moved somewhere else since this point was created. I'm not sure if that's possible though.
Reporter | ||
Comment 4•2 months ago
|
||
Eitan, based on our chat, are you planning to work on this? Totally fine either way. I just want to know so I don't put time into it if you're already on it (or will be soon).
Reporter | ||
Updated•2 months ago
|
Reporter | ||
Comment 5•2 months ago
|
||
(In reply to James Teh [:Jamie] from comment #3)
It'd be better if we could get the coordinates for where the caret would be if it landed [at the end of line insertion point], since the caret might have actually moved somewhere else since this point was created.
When mIsEndOfLineInsertionPoint is true, we could perhaps:
- If mOffset < TextLength(mAcc), Use (prevX + prevW, prevY, 1, 1) as suggested in comment 0.
- If mOffset == TextLength(mAcc), get the bounds of mAcc and use (accW - 1, accH - 1, 1, 1). That covers comment 1 (the line feed at end of input case). We could further restrict this so that we only do it if the character at mOffset - 1 is a line feed if that makes more sense.
Assignee | ||
Comment 6•2 months ago
|
||
I'm working on this, yes :)
Note, I'm not changing the width of the caret to align to the start of the character because it would be wrong for vertical or rtl text.
Reporter | ||
Updated•2 months ago
|
Reporter | ||
Comment 7•2 months ago
|
||
Per discussion with Eitan, we think the best thing to do here is to use the caret rect if mIsEndOfLineInsertionPoint && this == TextLeafPoint::GetCaret(mAcc)
. That means we need to cache the caret rect on the DocAccessibleParent and unify the way we query the caret rect.
I didn't do this unification in bug 1828295 because HyperTextAccessible::GetCaretRect takes a widget, which is weird for RemoteAccessible. It does this because Windows needs to set up the system caret in the correct OS widget (HWND) and pop-ups have separate OS widgets. However, it just occurred to me that RemoteAccessible::GetCaretRect can just return the widget for OuterDocOfRemoteAccessible(). That also means we can unify Windows AccessibleWrap::UpdateSystemCaretFor, since the unified GetCaretRect can return both a rect and a widget in all cases.
Assignee | ||
Comment 8•2 months ago
|
||
Moved GetCaretRect to HyperTextAccessibleBase. I could see this living
in TextLeafPoint, but it is a bit confusing when a point is a caret and
when it is a simple offset. I think we would need to either add an
mIsCaret field to the class, or have a special static CaretBounds
method.
Comment 10•2 months ago
|
||
Comment 11•2 months ago
|
||
Backed out for causing ba failures @ browser_caret_rect.js
Comment 12•2 months ago
|
||
Comment 13•2 months ago
|
||
bugherder |
Updated•1 month ago
|
Description
•