diff options
author | Frederik Gladhorn <frederik.gladhorn@nokia.com> | 2011-11-22 18:08:05 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-19 12:27:45 +0100 |
commit | 74c9f9d83f9f5cb934d0b62b468c74df5a3b9a0d (patch) | |
tree | ea5e783b8d025ce2d525dab5c524aaee298dd6b9 /src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | |
parent | 7e12d2d30f74b5fe1f80fac7192416cf6eb22d4d (diff) |
Accessibility: childAt returns interface
childAt used to return an integer.
Return an interface instead.
Not requiring a direct child to be returned allows optimizing
by bypassing iterating through the hierarchy of accessibles.
For QtQuick this is the only sensible way of implementing this.
The bridges are still responsible for finding the top-most element.
The default implementation in QAccessibleObject is sufficient
to return direct children. The implementation in
QAccessibleApplication is therfore no longer needed.
Change-Id: Id7100dd5bcc3a98de516a7f4a12eaaa41cb46d26
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index 332577d6e9..5ad9e57c31 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -197,21 +197,19 @@ static QAccessibleInterface *acast(void *ptr) } - (id)accessibilityHitTest:(NSPoint)point { - int index = acast(accessibleInterface)->childAt(point.x, qt_mac_flipYCoordinate(point.y)); - // hit outside - if (index == -1) { - return 0; - } + if (!accessibleInterface) + return NSAccessibilityUnignoredAncestor(self); + QAccessibleInterface *childInterface = acast(accessibleInterface)->childAt(point.x, qt_mac_flipYCoordinate(point.y)); - // hit this element - if (index == 0) { + // No child found, meaning we hit this element. + if (!childInterface) { return NSAccessibilityUnignoredAncestor(self); } // hit a child, forward to child accessible interface. - QAccessibleInterface *childInterface = acast(accessibleInterface)->child(index - 1); - QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithIndex:index - 1 parent:self accessibleInterface: childInterface]; + int childIndex = acast(accessibleInterface)->indexOfChild(childInterface); + QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement elementWithIndex:childIndex -1 parent:self accessibleInterface: childInterface]; return [accessibleElement accessibilityHitTest:point]; } |