Bug 1846660 part 1: Remove deprecated IAccessible2_3 implementation and interface. r=nlapre

No clients actually use this due to inherent flaws.

Differential Revision: https://phabricator.services.mozilla.com/D185132
This commit is contained in:
James Teh 2023-08-04 02:51:42 +00:00
parent decc95e13f
commit 96cc6ec069
4 changed files with 5 additions and 103 deletions

View File

@ -14,7 +14,6 @@ midl_enums = [
midl_interfaces = [
"Accessible2",
"Accessible2_2",
"Accessible2_3",
"AccessibleAction",
"AccessibleApplication",
"AccessibleComponent",

View File

@ -8,7 +8,6 @@
#include "Accessible2_i.c"
#include "Accessible2_2_i.c"
#include "Accessible2_3_i.c"
#include "AccessibleRole.h"
#include "AccessibleStates.h"
@ -43,12 +42,11 @@ ia2Accessible::QueryInterface(REFIID iid, void** ppv) {
// also be added to the IA2 Handler in
// /accessible/ipc/win/handler/AccessibleHandler.cpp
if (IID_IAccessible2_3 == iid)
*ppv = static_cast<IAccessible2_3*>(this);
else if (IID_IAccessible2_2 == iid)
if (IID_IAccessible2_2 == iid) {
*ppv = static_cast<IAccessible2_2*>(this);
else if (IID_IAccessible2 == iid)
} else if (IID_IAccessible2 == iid) {
*ppv = static_cast<IAccessible2*>(this);
}
if (*ppv) {
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
@ -519,46 +517,6 @@ ia2Accessible::get_relationTargetsOfType(BSTR aType, long aMaxTargets,
return S_OK;
}
STDMETHODIMP
ia2Accessible::get_selectionRanges(IA2Range** aRanges, long* aNRanges) {
if (!aRanges || !aNRanges) return E_INVALIDARG;
*aNRanges = 0;
if (!Acc()) {
return CO_E_OBJNOTCONNECTED;
}
AccessibleWrap* acc = LocalAcc();
if (!acc) {
return E_NOTIMPL; // XXX Not supported for RemoteAccessible yet.
}
AutoTArray<TextRange, 1> ranges;
acc->Document()->SelectionRanges(&ranges);
ranges.RemoveElementsBy([acc](auto& range) { return !range.Crop(acc); });
*aNRanges = ranges.Length();
*aRanges =
static_cast<IA2Range*>(::CoTaskMemAlloc(sizeof(IA2Range) * *aNRanges));
if (!*aRanges) return E_OUTOFMEMORY;
for (uint32_t idx = 0; idx < static_cast<uint32_t>(*aNRanges); idx++) {
RefPtr<IAccessible2> anchor =
MsaaAccessible::GetFrom(ranges[idx].StartContainer());
anchor.forget(&(*aRanges)[idx].anchor);
(*aRanges)[idx].anchorOffset = ranges[idx].StartOffset();
RefPtr<IAccessible2> active =
MsaaAccessible::GetFrom(ranges[idx].EndContainer());
active.forget(&(*aRanges)[idx].active);
(*aRanges)[idx].activeOffset = ranges[idx].EndOffset();
}
return S_OK;
}
////////////////////////////////////////////////////////////////////////////////
// Helpers

View File

@ -10,7 +10,7 @@
#include "nsISupports.h"
#include "nsTArray.h"
#include "Accessible2_3.h"
#include "Accessible2_2.h"
namespace mozilla {
namespace a11y {
@ -18,7 +18,7 @@ class Accessible;
class AccAttributes;
class AccessibleWrap;
class ia2Accessible : public IAccessible2_3 {
class ia2Accessible : public IAccessible2_2 {
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void**);
@ -105,11 +105,6 @@ class ia2Accessible : public IAccessible2_3 {
/* [out, size_is(,*nTargets)] */ IUnknown*** targets,
/* [out, retval] */ long* nTargets);
// IAccessible2_3
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selectionRanges(
/* [out, size_is(,*nRanges)] */ IA2Range** ranges,
/* [out, retval] */ long* nRanges);
// Helper method
static HRESULT ConvertToIA2Attributes(AccAttributes* aAttributes,
BSTR* aIA2Attributes);

View File

@ -1,50 +0,0 @@
import "objidl.idl";
import "oaidl.idl";
import "oleacc.idl";
import "Accessible2_2.idl";
/**
* This structure represents a directional range of the content. It is defined
* by two points in the content, where each one is defined by an accessible
* object and an offset relative to it. A typical case of a range point is
* a text accessible and text offset within it.
*
* The "anchor" is one point of the range and typically remains constant.
* The other point is the "active" point, which typically corresponds to
* the user's focus or point of interest. The user moves the active point to
* expand or collapse the range. In most cases, anchor is the start of the range
* and active is the end. However, in case of selection, when selecting
* backwards (e.g. pressing shift+left arrow in a text field), the start of
* the range is the active point, as the user moves this to manipulate
* the selection.
*/
typedef struct IA2Range {
IUnknown* anchor;
long anchorOffset;
IUnknown* active;
long activeOffset;
} IA2Range;
/**
* @brief This interface is an extension of IAccessible2_2 and IAccessible2
* interfaces.
*/
[object, uuid(5BE18059-762E-4E73-9476-ABA294FED411)]
interface IAccessible2_3 : IAccessible2_2
{
/**
* @brief Returns an array of ranges for selections within the accessible.
* @param [out] ranges
The array of selection ranges, allocated by the server. The client must
free it with CoTaskMemFree.
* @param [out] nRanges
the array length
* @retval S_OK
* @retval S_FALSE returned if there is no selection within the accessible
*/
[propget] HRESULT selectionRanges
(
[out, size_is(,*nRanges)] IA2Range **ranges,
[out, retval] long *nRanges
);
}