vcl/source/accessibility/vclxaccessiblecomponent.cxx | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-)
New commits: commit 827da8833cccda2b51f99eb0257be8ee68232899 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Sat Mar 15 15:18:30 2025 -0700 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sun Mar 16 04:01:42 2025 +0100 tdf#163989 vcl a11y: Don't rely on Window a11y parent being Window In VCLXAccessibleComponent::implGetBounds, use Window::GetAccessibleParent introduced in commit 5ef30632ede4258f0c45194259567849cc172dab Author: Michael Weghorn <m.wegh...@posteo.de> Date: Mon Mar 3 17:05:16 2025 +0100 tdf#163989 a11y: Introduce Window::GetAccessibleParent to get the accessible parent of the vcl::Window instead of using vcl::Window::GetAccessibleParentWindow directly. The latter would give an incorrect result if the accessible parent is not a vcl::Window itself. This prepares for upcoming commit Change-Id: I3b2182ca953056a939670e73687f4568620a4087 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Mon Mar 3 17:42:03 2025 +0100 tdf#163989 vcl a11y: Rework toolbar item window a11y Change-Id: Iffa85bd9b6733eeed5357dd4937aac00966724c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182978 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/source/accessibility/vclxaccessiblecomponent.cxx b/vcl/source/accessibility/vclxaccessiblecomponent.cxx index c4f27e6e5381..225a42d8b8f9 100644 --- a/vcl/source/accessibility/vclxaccessiblecomponent.cxx +++ b/vcl/source/accessibility/vclxaccessiblecomponent.cxx @@ -659,12 +659,17 @@ awt::Rectangle VCLXAccessibleComponent::implGetBounds() AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute(); awt::Rectangle aBounds = vcl::unohelper::ConvertToAWTRect(aRect); - vcl::Window* pParent = pWindow->GetAccessibleParentWindow(); - if (!pParent) + + css::uno::Reference<css::accessibility::XAccessible> xParent = pWindow->GetAccessibleParent(); + if (!xParent.is()) + return aBounds; + + css::uno::Reference<css::accessibility::XAccessibleComponent> xParentComponent( + xParent->getAccessibleContext(), css::uno::UNO_QUERY); + if (!xParentComponent) return aBounds; - AbsoluteScreenPixelRectangle aParentRect = pParent->GetWindowExtentsAbsolute(); - awt::Point aParentScreenLoc = vcl::unohelper::ConvertToAWTPoint(aParentRect.TopLeft()); + awt::Point aParentScreenLoc = xParentComponent->getLocationOnScreen(); aBounds.X -= aParentScreenLoc.X; aBounds.Y -= aParentScreenLoc.Y; commit 02a4655d8a8f846eaae1527c9c350f40db8570f8 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Sat Mar 15 15:12:18 2025 -0700 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sun Mar 16 04:01:33 2025 +0100 vcl a11y: Flatten VCLXAccessibleComponent::implGetBounds Change-Id: I17936af21d34d56fe02d20a4ebe065a79786f92d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182977 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/source/accessibility/vclxaccessiblecomponent.cxx b/vcl/source/accessibility/vclxaccessiblecomponent.cxx index f16a06a3c569..c4f27e6e5381 100644 --- a/vcl/source/accessibility/vclxaccessiblecomponent.cxx +++ b/vcl/source/accessibility/vclxaccessiblecomponent.cxx @@ -653,22 +653,20 @@ uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessi // accessibility::XAccessibleComponent awt::Rectangle VCLXAccessibleComponent::implGetBounds() { - awt::Rectangle aBounds ( 0, 0, 0, 0 ); - VclPtr<vcl::Window> pWindow = GetWindow(); - if ( pWindow ) - { - AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute(); - aBounds = vcl::unohelper::ConvertToAWTRect(aRect); - vcl::Window* pParent = pWindow->GetAccessibleParentWindow(); - if ( pParent ) - { - AbsoluteScreenPixelRectangle aParentRect = pParent->GetWindowExtentsAbsolute(); - awt::Point aParentScreenLoc = vcl::unohelper::ConvertToAWTPoint(aParentRect.TopLeft()); - aBounds.X -= aParentScreenLoc.X; - aBounds.Y -= aParentScreenLoc.Y; - } - } + if (!pWindow) + return awt::Rectangle(); + + AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute(); + awt::Rectangle aBounds = vcl::unohelper::ConvertToAWTRect(aRect); + vcl::Window* pParent = pWindow->GetAccessibleParentWindow(); + if (!pParent) + return aBounds; + + AbsoluteScreenPixelRectangle aParentRect = pParent->GetWindowExtentsAbsolute(); + awt::Point aParentScreenLoc = vcl::unohelper::ConvertToAWTPoint(aParentRect.TopLeft()); + aBounds.X -= aParentScreenLoc.X; + aBounds.Y -= aParentScreenLoc.Y; return aBounds; }