diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-05-04 10:06:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-05-04 13:56:46 +0200 |
commit | 3b7db802731826b6cc3b55100470b0c61c1f2dfa (patch) | |
tree | 8b972dd3697e88a1d306626f28a177366b8de27a /vcl/unx/gtk3 | |
parent | fd02cdd4b5ef0fc96225501ba8f6758af8b6c69e (diff) |
tdf#105404 [API CHANGE] add index to accessiblity change event
Which shaves 80% off the time off breaking up a vector image on Linux.
Change-Id: Id8e7daad001b6120d1fb98e382357da5b55e92ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151352
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/unx/gtk3')
-rw-r--r-- | vcl/unx/gtk3/a11y/atklistener.cxx | 41 | ||||
-rw-r--r-- | vcl/unx/gtk3/a11y/atklistener.hxx | 6 |
2 files changed, 34 insertions, 13 deletions
diff --git a/vcl/unx/gtk3/a11y/atklistener.cxx b/vcl/unx/gtk3/a11y/atklistener.cxx index f850f450f199..b0f091142832 100644 --- a/vcl/unx/gtk3/a11y/atklistener.cxx +++ b/vcl/unx/gtk3/a11y/atklistener.cxx @@ -163,28 +163,40 @@ void AtkListener::updateChildList( void AtkListener::handleChildAdded( const uno::Reference< accessibility::XAccessibleContext >& rxParent, - const uno::Reference< accessibility::XAccessible>& rxAccessible) + const uno::Reference< accessibility::XAccessible>& rxAccessible, + sal_Int32 nIndexHint) { AtkObject * pChild = rxAccessible.is() ? atk_object_wrapper_ref( rxAccessible ) : nullptr; - if( pChild ) + if( !pChild ) + return; + + if (nIndexHint != -1) { + sal_Int64 nStateSet = rxParent->getAccessibleStateSet(); + if( !(nStateSet & accessibility::AccessibleStateType::DEFUNC) + || (nStateSet & accessibility::AccessibleStateType::MANAGES_DESCENDANTS) ) + { + m_aChildList.insert(m_aChildList.begin() + nIndexHint, rxAccessible); + } + } + else updateChildList(rxParent); - atk_object_wrapper_add_child( mpWrapper, pChild, - atk_object_get_index_in_parent( pChild )); + atk_object_wrapper_add_child( mpWrapper, pChild, + atk_object_get_index_in_parent( pChild )); - g_object_unref( pChild ); - } + g_object_unref( pChild ); } /*****************************************************************************/ void AtkListener::handleChildRemoved( const uno::Reference< accessibility::XAccessibleContext >& rxParent, - const uno::Reference< accessibility::XAccessible>& rxChild) + const uno::Reference< accessibility::XAccessible>& rxChild, + int nChildIndexHint) { - sal_Int32 nIndex = -1; + sal_Int32 nIndex = nChildIndexHint; // Locate the child in the children list const size_t nmax = m_aChildList.size(); @@ -231,7 +243,14 @@ void AtkListener::handleChildRemoved( xBroadcaster->removeAccessibleEventListener(xListener); } - updateChildList(rxParent); + // update child list + sal_Int64 nStateSet = rxParent->getAccessibleStateSet(); + if(!( (nStateSet & accessibility::AccessibleStateType::DEFUNC) + || (nStateSet & accessibility::AccessibleStateType::MANAGES_DESCENDANTS) )) + { + assert( m_aChildList[nIndex] == rxParent->getAccessibleChild(nIndex) ); + m_aChildList.erase(m_aChildList.begin() + nIndex); + } AtkObject * pChild = atk_object_wrapper_ref( rxChild, false ); if( pChild ) @@ -442,10 +461,10 @@ void AtkListener::notifyEvent( const accessibility::AccessibleEventObject& aEven g_return_if_fail( xParent.is() ); if( aEvent.OldValue >>= xChild ) - handleChildRemoved(xParent, xChild); + handleChildRemoved(xParent, xChild, aEvent.IndexHint); if( aEvent.NewValue >>= xChild ) - handleChildAdded(xParent, xChild); + handleChildAdded(xParent, xChild, aEvent.IndexHint); break; } diff --git a/vcl/unx/gtk3/a11y/atklistener.hxx b/vcl/unx/gtk3/a11y/atklistener.hxx index 7dcd78509b38..546c5e9456fb 100644 --- a/vcl/unx/gtk3/a11y/atklistener.hxx +++ b/vcl/unx/gtk3/a11y/atklistener.hxx @@ -53,12 +53,14 @@ private: // Process CHILD_EVENT notifications with a new child added void handleChildAdded( const css::uno::Reference< css::accessibility::XAccessibleContext >& rxParent, - const css::uno::Reference< css::accessibility::XAccessible>& rxChild); + const css::uno::Reference< css::accessibility::XAccessible>& rxChild, + int nIndexHint); // Process CHILD_EVENT notifications with a child removed void handleChildRemoved( const css::uno::Reference< css::accessibility::XAccessibleContext >& rxParent, - const css::uno::Reference< css::accessibility::XAccessible>& rxChild); + const css::uno::Reference< css::accessibility::XAccessible>& rxChild, + int nIndexHint); // Process INVALIDATE_ALL_CHILDREN notification void handleInvalidateChildren( |