macOS accessibility: fix crash for NSAccessibilityVisibleCharacterRangeAttribute
VoiceOver or other tools may query this property even when there is no text interface. Make sure not to crash by verifying that the interface is supported. Found while using AccessibilityInspector to verify other changes. Change-Id: If7ee21b7616f091b71e86bab03a871ddbabe9200 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>bb10
parent
736dfc3c63
commit
bc1678c618
|
|
@ -345,8 +345,9 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
|
|||
return [NSValue valueWithRange: NSMakeRange(0, 0)];
|
||||
} else if ([attribute isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute]) {
|
||||
// FIXME This is not correct and may impact performance for big texts
|
||||
return [NSValue valueWithRange: NSMakeRange(0, iface->textInterface()->characterCount())];
|
||||
|
||||
if (QAccessibleTextInterface *text = iface->textInterface())
|
||||
return [NSValue valueWithRange: NSMakeRange(0, text->characterCount())];
|
||||
return [NSValue valueWithRange: NSMakeRange(0, iface->text(QAccessible::Name).length())];
|
||||
} else if ([attribute isEqualToString:NSAccessibilityInsertionPointLineNumberAttribute]) {
|
||||
if (QAccessibleTextInterface *text = iface->textInterface()) {
|
||||
int line = 0; // true for all single line edits
|
||||
|
|
|
|||
Loading…
Reference in New Issue