From ae6f9d00a65de227dfb908672aa01a406a1c5c43 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 3 Apr 2013 21:34:07 +0200 Subject: Accessibility Mac: Enable ignoring of children MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ignored children do not show up in the hierarchy, this should improve performance significantly. Previously the code would ignore the grouping property which seems to break QGroupBox. Change-Id: I4535af9c95bce76ded65f6d40fe07f17f3acffad Reviewed-by: Gabriel de Dietrich Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoaaccessibility.mm | 8 +++++--- src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm index 34192e85b0..25780e79f4 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm @@ -180,7 +180,8 @@ bool shouldBeIgnored(QAccessibleInterface *interface) // state. Ignore interfaces with those flags set. const QAccessible::State state = interface->state(); if (state.invisible || - state.offscreen) + state.offscreen || + state.invalid) return true; // Some roles are not interesting. In particular, container roles should be @@ -189,12 +190,13 @@ bool shouldBeIgnored(QAccessibleInterface *interface) if (role == QAccessible::Border || // QFrame role == QAccessible::Application || // We use the system-provided application element. role == QAccessible::MenuItem || // The system also provides the menu items. - role == QAccessible::ToolBar) // Access the tool buttons directly. + role == QAccessible::ToolBar || // Access the tool buttons directly. + role == QAccessible::Pane || // Scroll areas. + role == QAccessible::Client) // The default for QWidget. return true; NSString *mac_role = macRole(interface); if (mac_role == NSAccessibilityWindowRole || // We use the system-provided window elements. - mac_role == NSAccessibilityGroupRole || mac_role == NSAccessibilityUnknownRole) return true; diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index 1d6797e51a..f7c945c50d 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -151,6 +151,7 @@ [kids addObject: element]; [element release]; } + // ### maybe we should use NSAccessibilityUnignoredChildren(kids); this needs more profiling return kids; } else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) { @@ -256,7 +257,7 @@ // misc - (BOOL)accessibilityIsIgnored { - return false; //QCocoaAccessible::shouldBeIgnored(QAccessible::accessibleInterface(id)); + return QCocoaAccessible::shouldBeIgnored(QAccessible::accessibleInterface(axid)); } - (id)accessibilityHitTest:(NSPoint)point { -- cgit v1.2.3