From 96cc6ec069e13b7033a4819a3b0eed7109e087f2 Mon Sep 17 00:00:00 2001 From: James Teh Date: Fri, 4 Aug 2023 02:51:42 +0000 Subject: [PATCH] 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 --- accessible/interfaces/ia2/moz.build | 1 - accessible/windows/ia2/ia2Accessible.cpp | 48 ++--------------------- accessible/windows/ia2/ia2Accessible.h | 9 +---- other-licenses/ia2/Accessible2_3.idl | 50 ------------------------ 4 files changed, 5 insertions(+), 103 deletions(-) delete mode 100644 other-licenses/ia2/Accessible2_3.idl diff --git a/accessible/interfaces/ia2/moz.build b/accessible/interfaces/ia2/moz.build index 72160c48b304..6ac1730f8bc6 100644 --- a/accessible/interfaces/ia2/moz.build +++ b/accessible/interfaces/ia2/moz.build @@ -14,7 +14,6 @@ midl_enums = [ midl_interfaces = [ "Accessible2", "Accessible2_2", - "Accessible2_3", "AccessibleAction", "AccessibleApplication", "AccessibleComponent", diff --git a/accessible/windows/ia2/ia2Accessible.cpp b/accessible/windows/ia2/ia2Accessible.cpp index 55a40594a626..209273093240 100644 --- a/accessible/windows/ia2/ia2Accessible.cpp +++ b/accessible/windows/ia2/ia2Accessible.cpp @@ -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(this); - else if (IID_IAccessible2_2 == iid) + if (IID_IAccessible2_2 == iid) { *ppv = static_cast(this); - else if (IID_IAccessible2 == iid) + } else if (IID_IAccessible2 == iid) { *ppv = static_cast(this); + } if (*ppv) { (reinterpret_cast(*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 ranges; - acc->Document()->SelectionRanges(&ranges); - ranges.RemoveElementsBy([acc](auto& range) { return !range.Crop(acc); }); - - *aNRanges = ranges.Length(); - *aRanges = - static_cast(::CoTaskMemAlloc(sizeof(IA2Range) * *aNRanges)); - if (!*aRanges) return E_OUTOFMEMORY; - - for (uint32_t idx = 0; idx < static_cast(*aNRanges); idx++) { - RefPtr anchor = - MsaaAccessible::GetFrom(ranges[idx].StartContainer()); - anchor.forget(&(*aRanges)[idx].anchor); - - (*aRanges)[idx].anchorOffset = ranges[idx].StartOffset(); - - RefPtr active = - MsaaAccessible::GetFrom(ranges[idx].EndContainer()); - active.forget(&(*aRanges)[idx].active); - - (*aRanges)[idx].activeOffset = ranges[idx].EndOffset(); - } - - return S_OK; -} - //////////////////////////////////////////////////////////////////////////////// // Helpers diff --git a/accessible/windows/ia2/ia2Accessible.h b/accessible/windows/ia2/ia2Accessible.h index 0015a45c23d5..ba65d9fcf9d5 100644 --- a/accessible/windows/ia2/ia2Accessible.h +++ b/accessible/windows/ia2/ia2Accessible.h @@ -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); diff --git a/other-licenses/ia2/Accessible2_3.idl b/other-licenses/ia2/Accessible2_3.idl deleted file mode 100644 index f3a9b18962f0..000000000000 --- a/other-licenses/ia2/Accessible2_3.idl +++ /dev/null @@ -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 - ); -}