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>
This commit is contained in:
parent
6be4a67322
commit
18b1dc35e9
@ -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]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user