Files
tubestation/accessible/windows/uia/UiaText.h
James Teh ef30c65925 Bug 1949920: Expose the UIA Text pattern on text leaves. Don't expose it on the root. r=nlapre
We need to support the Text pattern on text leaves to fix issues with Narrator.
Removing support on the root isn't strictly necessary, but the Text pattern isn't normally supported on a UIA Window and Chromium doesn't do this, so I think it's best to follow.

This change necessitated moving UiaText so that it is no longer inherited by ia2AccessibleHypertext.
I initially tried to inherit UiaText into uiaRawElmProvider, but that doesn't work because ITextProvider and ISelectionProvider both have a GetSelection method with the same signature.
This meant that the ISelectionProvider implementation of GetSelection in uiaRawElmProvider was overriding the implementation in UiaText.
Instead, UiaText has now been split into a separate object.

Differential Revision: https://phabricator.services.mozilla.com/D239811
2025-03-03 03:18:42 +00:00

62 lines
1.8 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#ifndef mozilla_a11y_UiaText_h__
#define mozilla_a11y_UiaText_h__
#include "objbase.h"
#include "uiautomation.h"
#include "IUnknownImpl.h"
#include "mozilla/Assertions.h"
#include "mozilla/RefPtr.h"
namespace mozilla::a11y {
class Accessible;
class MsaaAccessible;
/**
* ITextProvider implementation.
*/
class UiaText : public ITextProvider {
public:
explicit UiaText(MsaaAccessible* aMsaa);
// IUnknown
DECL_IUNKNOWN
// ITextProvider
virtual HRESULT STDMETHODCALLTYPE GetSelection(
/* [retval][out] */ __RPC__deref_out_opt SAFEARRAY** aRetVal);
virtual HRESULT STDMETHODCALLTYPE GetVisibleRanges(
/* [retval][out] */ __RPC__deref_out_opt SAFEARRAY** aRetVal);
virtual HRESULT STDMETHODCALLTYPE RangeFromChild(
/* [in] */ __RPC__in_opt IRawElementProviderSimple* aChildElement,
/* [retval][out] */ __RPC__deref_out_opt ITextRangeProvider** aRetVal);
virtual HRESULT STDMETHODCALLTYPE RangeFromPoint(
/* [in] */ struct UiaPoint aPoint,
/* [retval][out] */ __RPC__deref_out_opt ITextRangeProvider** aRetVal);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DocumentRange(
/* [retval][out] */ __RPC__deref_out_opt ITextRangeProvider** aRetVal);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SupportedTextSelection(
/* [retval][out] */ __RPC__out enum SupportedTextSelection* aRetVal);
private:
virtual ~UiaText() = default;
Accessible* Acc() const;
RefPtr<MsaaAccessible> mMsaa;
};
} // namespace mozilla::a11y
#endif