Closed Bug 1976137 Opened 6 months ago Closed 6 months ago

Clean up caret rect code

Categories

(Core :: Disability Access APIs, task)

task

Tracking

()

RESOLVED FIXED
143 Branch
Tracking Status
firefox142 + fixed
firefox143 --- fixed

People

(Reporter: Jamie, Assigned: Jamie)

References

(Blocks 1 open bug)

Details

Attachments

(5 files)

In bug 1966812, GetCaretRect is being unified into HyperTextAccessibleBase. That means we can clean up a bunch of things:

  1. On Windows, there are different versions of AccessibleWrap::UpdateSystemCaretFor for local and remote. These can be unified into a single function which uses HyperTextAccessibleBase::GetCaretRect. It might even make sense to just move this into Platform.cpp.
  2. PlatformFocusEvent and PlatformCaretEvent currently take a caret rect. For LocalAccessible, this is empty on all platforms. We should just get rid of this argument and have platforms call GetCaretRect if they need it.
  3. DocAccessibleChild::GetCaretRectFor should take a LocalAccessible, rather than an id. Calling ID() is a lot nicer than reinterpret_cast. This will require an equivalent change to SendFocusEvent and SendCaretMoveEvent.

If bug 1966812 doesn't do this, we should also probably make GetCaretRect return `std::pair<mozilla::LayoutDeviceIntRect, nsIWidget*> instead of taking nsIWidget as an out parameter.

Assignee: nobody → jteh

Previously, we had separate versions for LocalAccessible and RemoteAccessible.
Now that GetCaretRect is unified (bug 1966812), we can unify these into a single function.

This is only in AccessibleWrap for vestigial reasons.
These days, it has nothing to do with AccessibleWrap at all.
This just moves the code with no changes.

This argument was provided inconsistently.
it wasn't even used on Windows for LocalAccessible because we need the nsIWidget there.
Now that we have unified GetCaretRect, it isn't necessary, so just get rid of it.

Instead of overriding these with intermediate functions that get and pass the caret rect, just get and pass it directly.
This avoids indirection and thus makes the code easier to follow and reason about.
I think this indirection was originally added because the need for the caret rect was previously Windows specific, but it isn't any longer.

Flags: needinfo?(jteh)
QA Whiteboard: [qa-triage-done-c144/b143]
Blocks: 1984045

Previously, we had separate versions for LocalAccessible and RemoteAccessible.
Now that GetCaretRect is unified (bug 1966812), we can unify these into a single function.

Original Revision: https://phabricator.services.mozilla.com/D256563

Attachment #9508351 - Flags: approval-mozilla-release?

firefox-release Uplift Approval Request

  • User impact if declined: Breaks text entry with Windows Magnifier (bug 1984045).
  • Code covered by automated testing: yes
  • Fix verified in Nightly: yes
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing: not applicable
  • Risk associated with taking this patch: low
  • Explanation of risk level: Baked for almost a full Nightly cycle. Changes Windows specific code to use a cross-platform function which is well covered by automated tests.
  • String changes made/needed: none
  • Is Android affected?: no
Attachment #9508351 - Flags: approval-mozilla-release? → approval-mozilla-release+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: