diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /accessible/windows/msaa/AccessibleWrap.cpp | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-upstream/125.0.1.tar.xz firefox-upstream/125.0.1.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessible/windows/msaa/AccessibleWrap.cpp')
-rw-r--r-- | accessible/windows/msaa/AccessibleWrap.cpp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/accessible/windows/msaa/AccessibleWrap.cpp b/accessible/windows/msaa/AccessibleWrap.cpp index abab007775..d681e8e658 100644 --- a/accessible/windows/msaa/AccessibleWrap.cpp +++ b/accessible/windows/msaa/AccessibleWrap.cpp @@ -31,6 +31,8 @@ using namespace mozilla::a11y; AccessibleWrap::AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) : LocalAccessible(aContent, aDoc) {} +AccessibleWrap::~AccessibleWrap() = default; + NS_IMPL_ISUPPORTS_INHERITED0(AccessibleWrap, LocalAccessible) void AccessibleWrap::Shutdown() { @@ -75,6 +77,24 @@ bool AccessibleWrap::IsRootForHWND() { return thisHwnd != parentHwnd; } +static void UpdateSystemCaretForHwnd(HWND aCaretWnd, + const LayoutDeviceIntRect& aCaretRect) { + if (!aCaretWnd || aCaretRect.IsEmpty()) { + return; + } + + // Create invisible bitmap for caret, otherwise its appearance interferes + // with Gecko caret + nsAutoBitmap caretBitMap(CreateBitmap(1, aCaretRect.Height(), 1, 1, nullptr)); + if (::CreateCaret(aCaretWnd, caretBitMap, 1, + aCaretRect.Height())) { // Also destroys the last caret + ::ShowCaret(aCaretWnd); + POINT clientPoint{aCaretRect.X(), aCaretRect.Y()}; + ::ScreenToClient(aCaretWnd, &clientPoint); + ::SetCaretPos(clientPoint.x, clientPoint.y); + } +} + /* static */ void AccessibleWrap::UpdateSystemCaretFor( Accessible* aAccessible, const LayoutDeviceIntRect& aCaretRect) { @@ -106,7 +126,7 @@ void AccessibleWrap::UpdateSystemCaretFor(LocalAccessible* aAccessible) { HWND caretWnd = reinterpret_cast<HWND>(widget->GetNativeData(NS_NATIVE_WINDOW)); - UpdateSystemCaretFor(caretWnd, caretRect); + UpdateSystemCaretForHwnd(caretWnd, caretRect); } /* static */ @@ -117,24 +137,5 @@ void AccessibleWrap::UpdateSystemCaretFor( // The HWND should be the real widget HWND, not an emulated HWND. // We get the HWND from the proxy's outer doc to bypass window emulation. LocalAccessible* outerDoc = aProxy->OuterDocOfRemoteBrowser(); - UpdateSystemCaretFor(MsaaAccessible::GetHWNDFor(outerDoc), aCaretRect); -} - -/* static */ -void AccessibleWrap::UpdateSystemCaretFor( - HWND aCaretWnd, const LayoutDeviceIntRect& aCaretRect) { - if (!aCaretWnd || aCaretRect.IsEmpty()) { - return; - } - - // Create invisible bitmap for caret, otherwise its appearance interferes - // with Gecko caret - nsAutoBitmap caretBitMap(CreateBitmap(1, aCaretRect.Height(), 1, 1, nullptr)); - if (::CreateCaret(aCaretWnd, caretBitMap, 1, - aCaretRect.Height())) { // Also destroys the last caret - ::ShowCaret(aCaretWnd); - POINT clientPoint{aCaretRect.X(), aCaretRect.Y()}; - ::ScreenToClient(aCaretWnd, &clientPoint); - ::SetCaretPos(clientPoint.x, clientPoint.y); - } + UpdateSystemCaretForHwnd(MsaaAccessible::GetHWNDFor(outerDoc), aCaretRect); } |