summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-11-26 11:53:13 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-11-27 16:49:19 +0100
commit6b5c7f8e5eb548b25c6119fe10cd8919f5275274 (patch)
tree956aa8bc16c3b9d9688e8a612e227a0c3c534449 /vcl
parent78400d8f0b3906f9835b0cbb70a907625f213ebf (diff)
tdf#108642 load accessibility children faster
Reduces the cost of repeatedly iterating over the page objects, by adding a new XAccessibleContext3 interface to return accesibility children in one call. This takes the load time from 5.6s to 3.2s. Change-Id: Ifcc20fa7e7ab8ad50417073882c8c3a2405d1eaa Reviewed-on: https://gerrit.libreoffice.org/83850 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit 980c859480be431311ba803c5251694160dcb3d5) Reviewed-on: https://gerrit.libreoffice.org/83887
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/gtk3/a11y/gtk3atklistener.cxx58
1 files changed, 34 insertions, 24 deletions
diff --git a/vcl/unx/gtk3/a11y/gtk3atklistener.cxx b/vcl/unx/gtk3/a11y/gtk3atklistener.cxx
index f690edfe62e3..d951c9bf7179 100644
--- a/vcl/unx/gtk3/a11y/gtk3atklistener.cxx
+++ b/vcl/unx/gtk3/a11y/gtk3atklistener.cxx
@@ -29,10 +29,12 @@
#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
#include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext3.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include "atklistener.hxx"
#include "atkwrapper.hxx"
+#include <comphelper/sequence.hxx>
#include <vcl/svapp.hxx>
#include <sal/log.hxx>
@@ -129,30 +131,38 @@ void AtkListener::updateChildList(
css::uno::Reference<css::accessibility::XAccessibleContext> const &
pContext)
{
- m_aChildList.clear();
-
- uno::Reference< accessibility::XAccessibleStateSet > xStateSet = pContext->getAccessibleStateSet();
- if( xStateSet.is()
- && !xStateSet->contains(accessibility::AccessibleStateType::DEFUNC)
- && !xStateSet->contains(accessibility::AccessibleStateType::MANAGES_DESCENDANTS) )
- {
- sal_Int32 nChildren = pContext->getAccessibleChildCount();
- m_aChildList.resize(nChildren);
- for(sal_Int32 n = 0; n < nChildren; n++)
- {
- try
- {
- m_aChildList[n] = pContext->getAccessibleChild(n);
- }
- catch (lang::IndexOutOfBoundsException const&)
- {
- sal_Int32 nChildren2 = pContext->getAccessibleChildCount();
- assert(nChildren2 <= n && "consistency?");
- m_aChildList.resize(std::min(nChildren2, n));
- break;
- }
- }
- }
+ m_aChildList.clear();
+
+ uno::Reference< accessibility::XAccessibleStateSet > xStateSet = pContext->getAccessibleStateSet();
+ if( xStateSet.is()
+ && !xStateSet->contains(accessibility::AccessibleStateType::DEFUNC)
+ && !xStateSet->contains(accessibility::AccessibleStateType::MANAGES_DESCENDANTS) )
+ {
+ css::uno::Reference<css::accessibility::XAccessibleContext3> xContext3(pContext, css::uno::UNO_QUERY);
+ if (xContext3.is())
+ {
+ m_aChildList = comphelper::sequenceToContainer<std::vector<css::uno::Reference< css::accessibility::XAccessible >>>(xContext3->getAccessibleChildren());
+ }
+ else
+ {
+ sal_Int32 nChildren = pContext->getAccessibleChildCount();
+ m_aChildList.resize(nChildren);
+ for(sal_Int32 n = 0; n < nChildren; n++)
+ {
+ try
+ {
+ m_aChildList[n] = pContext->getAccessibleChild(n);
+ }
+ catch (lang::IndexOutOfBoundsException const&)
+ {
+ sal_Int32 nChildren2 = pContext->getAccessibleChildCount();
+ assert(nChildren2 <= n && "consistency?");
+ m_aChildList.resize(std::min(nChildren2, n));
+ break;
+ }
+ }
+ }
+ }
}
/*****************************************************************************/