mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1881191 part 1: Don't include MsaaAccessible.h in AccessibleWrap.h. r=nlapre
In a subsequent patch, MsaaAccessible will inherit from uiaRawElmProvider, which is in a different directory. This causes problems for things outside the a11y module which include (either directly or indirectly) AccessibleWrap.h. While this could be fixed by exporting more headers, we also end up with type conflicts with Windows API headers. It's better if we can minimise what gets included anyway. 1. In AccessibleWrap.h, stop including MsaaAccessible.h and forward declare MsaaAccessible. 2. Move the definition of the AccessibleWrap destructor into the cpp. Otherwise, we run into compile errors due to the RefPtr<MsaaAccessible> destructor. 3. AccessibleWrap still has a private UpdateSystemCaretFor function which takes an HWND, which requires windows.h. To avoid including that in AccessibleWrap.h, move it to a static function only inside the cpp file. Rename it to prevent compiler overload confusion. 4. Since code outside the a11y module no longer needs to indirectly include MsaaAccessible, don't export MsaaAccessible.h any more. 5. While we're at it, don't export MsaaIdGenerator.h either, which is never used outside the Windows a11y code. There should be no functional change here. Differential Revision: https://phabricator.services.mozilla.com/D202549
This commit is contained in:
parent
5bcb89511a
commit
3ab0c41716
@ -11,6 +11,7 @@
|
||||
|
||||
#include "AccessibleWrap.h"
|
||||
#include "IUnknownImpl.h"
|
||||
#include "MsaaAccessible.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "AccessibleWrap.h"
|
||||
#include "States.h"
|
||||
#include "IUnknownImpl.h"
|
||||
#include "MsaaAccessible.h"
|
||||
|
||||
#include "nsIFrame.h"
|
||||
|
||||
|
@ -5,11 +5,14 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ia2AccessibleHyperlink.h"
|
||||
|
||||
#include "AccessibleHyperlink.h"
|
||||
#include "AccessibleHyperlink_i.c"
|
||||
|
||||
#include "AccessibleWrap.h"
|
||||
#include "IUnknownImpl.h"
|
||||
#include "MsaaAccessible.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "AccessibleWrap.h"
|
||||
#include "LocalAccessible-inl.h"
|
||||
#include "IUnknownImpl.h"
|
||||
#include "MsaaAccessible.h"
|
||||
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "LocalAccessible.h"
|
||||
#include "MsaaAccessible.h"
|
||||
#include "mozilla/a11y/RemoteAccessible.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/mscom/Utils.h"
|
||||
@ -20,6 +19,7 @@
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
class DocRemoteAccessibleWrap;
|
||||
class MsaaAccessible;
|
||||
|
||||
/**
|
||||
* Windows specific functionality for an accessibility tree node that originated
|
||||
@ -50,10 +50,6 @@ class AccessibleWrap : public LocalAccessible {
|
||||
static void UpdateSystemCaretFor(RemoteAccessible* aProxy,
|
||||
const LayoutDeviceIntRect& aCaretRect);
|
||||
|
||||
private:
|
||||
static void UpdateSystemCaretFor(HWND aCaretWnd,
|
||||
const LayoutDeviceIntRect& aCaretRect);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Determine whether this is the root accessible for its HWND.
|
||||
@ -64,7 +60,7 @@ class AccessibleWrap : public LocalAccessible {
|
||||
virtual void GetNativeInterface(void** aOutAccessible) override;
|
||||
|
||||
protected:
|
||||
virtual ~AccessibleWrap() = default;
|
||||
virtual ~AccessibleWrap();
|
||||
|
||||
RefPtr<MsaaAccessible> mMsaa;
|
||||
};
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "AccAttributes.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "mozilla/Components.h"
|
||||
#include "MsaaAccessible.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "ia2AccessibleHyperlink.h"
|
||||
#include "ia2AccessibleValue.h"
|
||||
#include "IUnknownImpl.h"
|
||||
#include "mozilla/a11y/MsaaIdGenerator.h"
|
||||
#include "MsaaIdGenerator.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -6,11 +6,11 @@
|
||||
|
||||
#include "MsaaIdGenerator.h"
|
||||
|
||||
#include "mozilla/a11y/MsaaAccessible.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "MsaaAccessible.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "sdnAccessible.h"
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "AccEvent.h"
|
||||
#include "Compatibility.h"
|
||||
#include "HyperTextAccessible.h"
|
||||
#include "MsaaAccessible.h"
|
||||
#include "nsWinUtils.h"
|
||||
#include "mozilla/a11y/DocAccessibleParent.h"
|
||||
#include "mozilla/a11y/RemoteAccessible.h"
|
||||
|
@ -12,8 +12,6 @@ EXPORTS.mozilla.a11y += [
|
||||
"AccessibleWrap.h",
|
||||
"Compatibility.h",
|
||||
"LazyInstantiator.h",
|
||||
"MsaaAccessible.h",
|
||||
"MsaaIdGenerator.h",
|
||||
"nsWinUtils.h",
|
||||
]
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "Compatibility.h"
|
||||
#include "DocAccessible.h"
|
||||
#include "MsaaAccessible.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsCoreUtils.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user