Align implementation of LineForIndex with InsertionPointLineNumber

On macOS, the accessibility implementation of InsertionPointLineNumber
currently reflects a fix for issue (QTBUG-49437). While it seems from
testing this issue no longer requires such a fix, it still is a nice
optimization for single-line edits. So we hereby bring the same
optimization to LineForIndex parameterized attribute as well, and
makes the code for both attributes consistent.

Change-Id: I18b8cc249b6c65a25150f4e503999b04437e0306
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Boris Dušek 2018-11-03 14:30:35 +01:00 committed by Frederik Gladhorn
parent 9dc19d6716
commit 6be4a67322

View File

@ -424,8 +424,11 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
int index = [parameter intValue];
if (index < 0 || index > iface->textInterface()->characterCount())
return nil;
int line = -1;
convertLineOffset(iface->textInterface(), &line, &index);
int line = 0; // true for all single line edits
if (iface->state().multiLine) {
line = -1;
convertLineOffset(iface->textInterface(), &line, &index);
}
return @(line);
}
if ([attribute isEqualToString: NSAccessibilityRangeForLineParameterizedAttribute]) {