diff options
author | Boris Dušek <me@dusek.me> | 2018-11-05 10:22:12 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2018-11-23 06:43:10 +0000 |
commit | 18b1dc35e90a6a3946e9e88c8cfa1ced3a00b1fa (patch) | |
tree | 8025e9786fd7445cc2bdc3cd3844834bf647aa2c /src | |
parent | 6be4a67322403b44a39650f0dd3e6daf7eafe5c0 (diff) |
macOS a11y: Implement AXInsertionPointLineNumber with AXLineForIndex
Follow DRY and do not repeat implementation of basically the same
thing, especially now that the implementation is no longer completely
trivial.
AXLineForIndex can be considered a primitive attribute, and
AXInsertionPointLineNumber a derived attribute, hence this opportunity
to not repeat oneself.
Change-Id: I64b596d8351e681f4438b91400a767407612c118
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index b826e821fc..1a3c7793c0 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -362,13 +362,8 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of } else if ([attribute isEqualToString:NSAccessibilityInsertionPointLineNumberAttribute]) { if (QAccessibleTextInterface *text = iface->textInterface()) { - int line = 0; // true for all single line edits - if (iface->state().multiLine) { - line = -1; - int position = text->cursorPosition(); - convertLineOffset(text, &line, &position); - } - return @(line); + int position = text->cursorPosition(); + return [self accessibilityAttributeValue:NSAccessibilityLineForIndexParameterizedAttribute forParameter:@(position)]; } return nil; } else if ([attribute isEqualToString:NSAccessibilityMinValueAttribute]) { |