Bug 718627 - Part 5: fix the missing implementations of the text protocol. r=surkov

This commit is contained in:
Hub Figuière 2012-04-02 10:16:12 -07:00
parent b20b0faf57
commit ced4ea20e1

View File

@ -240,7 +240,24 @@ ToNSString(id aValue)
}
if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute]) {
// XXX to do
NSString* stringValue = ToNSString(value);
if (!stringValue)
return;
PRInt32 start = 0;
PRInt32 end = 0;
nsresult rv = mGeckoTextAccessible->GetSelectionBounds(0, &start, &end);
NS_ENSURE_SUCCESS(rv,);
rv = mGeckoTextAccessible->DeleteText(start, end - start);
NS_ENSURE_SUCCESS(rv,);
nsString text;
nsCocoaUtils::GetStringForNSString(stringValue, text);
rv = mGeckoTextAccessible->InsertText(text, start);
NS_ENSURE_SUCCESS(rv,);
return;
}