Implement `accessibilityIdentifier` [1] for macOS/NSAccessibility by retrieving the accessible ID via `XAccessibleContext2::getAccessibleId` if that interface is implemented. This is the macOS equivalent of commit c64b823b74cbd3063d6e87643bd68ea5343b2f54 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Tue Jul 16 13:57:41 2024 +0200 tdf#155447 qt a11y: Report accessible ID [1] https://developer.apple.com/documentation/appkit/nsaccessibilityprotocol/1527792-accessibilityidentifier Change-Id: I43c40f5309467ddb00911297fadb6716500c2dcb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170624 Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomacdev@gmail.com> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Found the following memory leaks using Xcode's Instruments application: 1. Posting an NSAccessibilityUIElementDestroyedNotification notification causes [ AquaA11yWrapper isAccessibilityElement ] to be called on the object so mark the object as disposed before posting the destroyed notification and test for disposed in all of the standard NSAccessibility selectors to prevent any calls to likely disposed C++ accessibility objects. 2. In [ AquaA11yWrapper accessibilityHitTest: ], [ AquaA11yFactory wrapperForAccessibleContext: ] already retains the returned object so retaining it until the next call to this selector can lead to a memory leak when dragging selected cells in Calc to a new location. So autorelease the object so that transient objects stay alive but not past the next clearing of the autorelease pool. 3. [ AquaA11ySelectionWrapper selectedChildrenAttributeForElement: ] is expected to return an autoreleased object. 4. [ AquaA11yFactory wrapperForAccessible: ] is not a getter. It expects the caller to release the returned object. 5. CreateNSString() is not a getter. It expects the caller to release the returned string. Change-Id: I824740d7e3851b0c3e31e2c009860aa822c94222 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168034 Reviewed-by: Patrick Luby <guibomacdev@gmail.com> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
On macOS, accessibility is implemented by creating a native NSView for each C++ accessible element. The problem with using an NSView for each element is that NSViews are very slow to add to or remove from an NSWindow once the number of NSViews is more than a thousand or so. Fortunately, Apple added a protocol that allows adding a native accessible element using the lightweight NSAccessiblityElement class. The topmost NSAccessiblityElement elements are connected to the single SalFrameView in each NSWindow but since NSAccessiblityElements are not NSViews, they are not connected to any of NSWindow's event or draw dispatching. This makes NSAccessiblityElements significantly faster to add to or remove from an NSWindow with no apparent loss in functionality. Note: this change is a subset of the LibreOffice 4.4 code changes that I wrote for NeoOffice. Change-Id: I408108d57217db407512dfa3457fe26d2ab455de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152717 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Patrick Luby <plubius@neooffice.org>
we can allocate this internally, which reduces the number of heap allocations we need to do Change-Id: Id5298e70b6816cd65d8285ceea846dc8e9e4b39d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152489 Reviewed-by: Patrick Luby <plubius@neooffice.org> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Change-Id: I483d494a11b951fd415a314fddd4823db11dcb44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120295 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>