summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Dušek <me@dusek.me>2018-11-03 14:30:35 +0100
committerFrederik Gladhorn <frederik.gladhorn@qt.io>2018-11-23 06:43:04 +0000
commit6be4a67322403b44a39650f0dd3e6daf7eafe5c0 (patch)
tree11186e55887e5a1612c8674c7b32c93acb9f9b20
parent9dc19d6716f936e8b93a63fb2d27565e43ccb1ca (diff)
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>
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index 63233a0390..b826e821fc 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -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]) {