diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2022-08-05 11:41:53 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2022-08-05 16:38:18 +0200 |
commit | f03b908e285ad65fa4518f26862454c51efb54a8 (patch) | |
tree | c3c7307f8488b02b07169c55e7587509a19961ce /winaccessibility | |
parent | 0c3a159807965fa7db548a943a8d67d8bad5b208 (diff) |
wina11y: Drop extra location bookkeeping
The location is already retrieved on demand from the
underlying `XAccessible` in `CMAccessible::accLocation`
and the separately remembered location was just used
as fallback in case `m_xAccessible` was not (no more)
set.
However, when there is no valid associated `XAccessible`,
there is probably no value in returning any location
anyway, so just return `S_FALSE` for that case, as
other `CMAccessible` methods also do.
Whether the separately remembered `m_sLocation`
was up to date is also questionable, s.a.
Change-Id I04d0230d3599466aaa92082caba54da22a3b1a28,
"wina11y: Drop AccObjectManagerAgent::UpdateLocation".
This is also in line with what's mentioned in
commit fcf4a26275d7503835f9aa23cb94938809840300
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Wed Jan 5 13:41:53 2022 +0000
tdf#146306 wina11y: Retrieve accessible desc on demand
> Querying up-to-date values from the underlying
> UNO interfaces on demand instead of doing extra
> manual bookkeeping in the winaccessibility code
> may be possible for more a11y attributes in addition
> to the accessible description handled in this commit,
> but each one will have to be looked at separately.
Change-Id: I2fc51939a5db1896e02efacb1cf5fbc90ce87c04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137858
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'winaccessibility')
-rw-r--r-- | winaccessibility/inc/AccObject.hxx | 1 | ||||
-rw-r--r-- | winaccessibility/source/UAccCOM/MAccessible.cxx | 59 | ||||
-rw-r--r-- | winaccessibility/source/UAccCOM/MAccessible.h | 2 | ||||
-rw-r--r-- | winaccessibility/source/UAccCOMIDL/UAccCOM.idl | 1 | ||||
-rw-r--r-- | winaccessibility/source/UAccCOMIDL/defines.idl | 7 | ||||
-rw-r--r-- | winaccessibility/source/service/AccObject.cxx | 31 |
6 files changed, 16 insertions, 85 deletions
diff --git a/winaccessibility/inc/AccObject.hxx b/winaccessibility/inc/AccObject.hxx index 5a538b315dcd..0b34f076b5d6 100644 --- a/winaccessibility/inc/AccObject.hxx +++ b/winaccessibility/inc/AccObject.hxx @@ -122,7 +122,6 @@ public: void UpdateValue(); void UpdateAction(); void UpdateValidWindow(); - void UpdateLocation(); void setFocus(); void unsetFocus(); diff --git a/winaccessibility/source/UAccCOM/MAccessible.cxx b/winaccessibility/source/UAccCOM/MAccessible.cxx index 9543624b6bf0..eaf3e12b4484 100644 --- a/winaccessibility/source/UAccCOM/MAccessible.cxx +++ b/winaccessibility/source/UAccCOM/MAccessible.cxx @@ -198,10 +198,6 @@ m_dFocusChildID(UACC_NO_FOCUS), m_hwnd(nullptr), m_isDestroy(false) { - m_sLocation.m_dLeft=0; - m_sLocation.m_dTop = 0; - m_sLocation.m_dWidth=0; - m_sLocation.m_dHeight=0; CEnumVariant::Create(&m_pEnumVar); m_containedObjects.clear(); } @@ -892,35 +888,25 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::accLocation(long *pxLeft, long * { if(varChild.lVal==CHILDID_SELF) { + if (!m_xAccessible.is()) + return S_FALSE; - if (m_xAccessible.is()) - { - Reference<XAccessibleContext> const pRContext = - m_xAccessible->getAccessibleContext(); - if( !pRContext.is() ) - return S_FALSE; - Reference< XAccessibleComponent > pRComponent(pRContext,UNO_QUERY); - if( !pRComponent.is() ) - return S_FALSE; + Reference<XAccessibleContext> const pRContext = + m_xAccessible->getAccessibleContext(); + if( !pRContext.is() ) + return S_FALSE; + Reference< XAccessibleComponent > pRComponent(pRContext,UNO_QUERY); + if( !pRComponent.is() ) + return S_FALSE; - css::awt::Point pCPoint = pRComponent->getLocationOnScreen(); - css::awt::Size pCSize = pRComponent->getSize(); - *pxLeft = pCPoint.X; - *pyTop = pCPoint.Y; - *pcxWidth = pCSize.Width; - *pcyHeight = pCSize.Height; - return S_OK; - } - else - { - *pxLeft = m_sLocation.m_dLeft; - *pyTop = m_sLocation.m_dTop; - *pcxWidth = m_sLocation.m_dWidth; - *pcyHeight = m_sLocation.m_dHeight; - return S_OK; - } + css::awt::Point pCPoint = pRComponent->getLocationOnScreen(); + css::awt::Size pCSize = pRComponent->getSize(); + *pxLeft = pCPoint.X; + *pyTop = pCPoint.Y; + *pcxWidth = pCSize.Width; + *pcyHeight = pCSize.Height; + return S_OK; } - } return S_FALSE; @@ -1243,19 +1229,6 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::Put_XAccFocus(long dChildID) } /** -*Set accessible object location for the current COM object -* @param sLocation, the location of the current object. -* @return S_OK if successful and E_FAIL if failure. -*/ -COM_DECLSPEC_NOTHROW STDMETHODIMP CMAccessible::Put_XAccLocation(const Location sLocation) -{ - // internal IMAccessible - no mutex meeded - - this->m_sLocation = sLocation; - return S_OK; -} - -/** * Set accessible parent object for the current COM object if * the current object is a child of some COM object * @param pIParent, the parent of the current object. diff --git a/winaccessibility/source/UAccCOM/MAccessible.h b/winaccessibility/source/UAccCOM/MAccessible.h index 5d18d74abf84..8a239fd16340 100644 --- a/winaccessibility/source/UAccCOM/MAccessible.h +++ b/winaccessibility/source/UAccCOM/MAccessible.h @@ -141,7 +141,6 @@ public: STDMETHOD(IncreaseState)(DWORD pXSate) override; STDMETHOD(SetState)(DWORD pXSate) override; STDMETHOD(Put_XAccValue)(const OLECHAR __RPC_FAR *pszAccValue) override; - STDMETHOD(Put_XAccLocation)(const Location sLocation) override; STDMETHOD(Put_XAccFocus)(long dChildID) override; STDMETHOD(Put_XAccParent)(IMAccessible __RPC_FAR *pIParent) override; STDMETHOD(Put_XAccWindowHandle)(HWND hwnd) override; @@ -160,7 +159,6 @@ private: unsigned short m_iRole; DWORD m_dState; IMAccessible* m_pIParent; - Location m_sLocation; // identify a COM object/Acc object uniquely long m_dChildID; diff --git a/winaccessibility/source/UAccCOMIDL/UAccCOM.idl b/winaccessibility/source/UAccCOMIDL/UAccCOM.idl index f48b66ddd227..4befd13de0bc 100644 --- a/winaccessibility/source/UAccCOMIDL/UAccCOM.idl +++ b/winaccessibility/source/UAccCOMIDL/UAccCOM.idl @@ -38,7 +38,6 @@ import "defines.idl"; [id(4), helpstring("method IncreaseState")] HRESULT IncreaseState(DWORD pXSate); [id(6), helpstring("method Put_XAccValue")] HRESULT Put_XAccValue(const OLECHAR* pszAccValue); [id(7), helpstring("method SetState")] HRESULT SetState(DWORD pXSate); - [id(8), helpstring("method Put_XAccLocation")] HRESULT Put_XAccLocation(const Location sLocation); [id(9), helpstring("method Put_XAccFocus")] HRESULT Put_XAccFocus(long dChildID); [id(10), helpstring("method Put_XAccParent")] HRESULT Put_XAccParent(IMAccessible* pIParent); [id(13), helpstring("method Put_XAccWindowHandle")] HRESULT Put_XAccWindowHandle(HWND hwnd); diff --git a/winaccessibility/source/UAccCOMIDL/defines.idl b/winaccessibility/source/UAccCOMIDL/defines.idl index 2902b4f920ff..844262cb017c 100644 --- a/winaccessibility/source/UAccCOMIDL/defines.idl +++ b/winaccessibility/source/UAccCOMIDL/defines.idl @@ -30,11 +30,4 @@ typedef struct { IMAccessible* m_pIMAccessible; }AccChildNode; -typedef struct Location { - long m_dLeft; - long m_dTop; - long m_dWidth; - long m_dHeight; -}Location; - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/source/service/AccObject.cxx b/winaccessibility/source/service/AccObject.cxx index bd11ef719a43..7b3f1e6fc1db 100644 --- a/winaccessibility/source/service/AccObject.cxx +++ b/winaccessibility/source/service/AccObject.cxx @@ -928,35 +928,6 @@ void AccObject::UpdateState() } /** - * update location information from uno to com - * @param - * @return - */ -void AccObject::UpdateLocation() -{ - if (!m_pIMAcc) - { - return; - } - XAccessibleContext* pContext = m_xAccContextRef.get(); - - Reference< XAccessibleComponent > pRComponent(pContext,UNO_QUERY); - if( pRComponent.is() ) - { - css::awt::Point pCPoint = pRComponent->getLocationOnScreen(); - css::awt::Size pCSize = pRComponent->getSize(); - Location tempLocation; - tempLocation.m_dLeft = pCPoint.X; - tempLocation.m_dTop = pCPoint.Y; - tempLocation.m_dWidth = pCSize.Width; - tempLocation.m_dHeight = pCSize.Height; - m_pIMAcc->Put_XAccLocation( tempLocation ); - } - -} - - -/** * Public method to mapping information between MSAA and UNO. * @param * @return If the method is correctly processed. @@ -977,8 +948,6 @@ bool AccObject::UpdateAccessibleInfoFromUnoToMSAA() UpdateRole(); - UpdateLocation(); - UpdateState(); return true; |