Skip to content
Snippets Groups Projects
Commit b17144e2 authored by James Teh's avatar James Teh
Browse files

Bug 1828295 part 2: When setting the fake a11y Windows caret, convert the...

Bug 1828295 part 2: When setting the fake a11y Windows caret, convert the screen coordinates to client coordinates. r=nlapre

Previously, we were making the screen coordinates relative to the window rect.
However, the window rect includes the non-client area of the window, which includes the title bar.
SetCaretPos expects client coordinates.
In Firefox, this normally doesn't matter because the title bar is disabled, so there is no non-client area.
However, when the title bar is disabled, the coordinates were previously incorrect.

Differential Revision: https://phabricator.services.mozilla.com/D176620
parent f34c3edf
No related branches found
No related tags found
No related merge requests found
......@@ -148,9 +148,8 @@ void AccessibleWrap::UpdateSystemCaretFor(
if (::CreateCaret(aCaretWnd, caretBitMap, 1,
aCaretRect.Height())) { // Also destroys the last caret
::ShowCaret(aCaretWnd);
RECT windowRect;
::GetWindowRect(aCaretWnd, &windowRect);
::SetCaretPos(aCaretRect.X() - windowRect.left,
aCaretRect.Y() - windowRect.top);
POINT clientPoint{aCaretRect.X(), aCaretRect.Y()};
::ScreenToClient(aCaretWnd, &clientPoint);
::SetCaretPos(clientPoint.x, clientPoint.y);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment