зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1556922. Stop using [array] in nsIEditorSpellCheck. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D33742 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3d0c73c202
Коммит
9b956f652d
|
@ -109,7 +109,7 @@ interface nsIEditorSpellCheck : nsISupports
|
|||
*
|
||||
* @see mozISpellCheckingEngine::GetDictionaryList
|
||||
*/
|
||||
void GetDictionaryList([array, size_is(count)] out wstring dictionaryList, out uint32_t count);
|
||||
Array<AString> GetDictionaryList();
|
||||
|
||||
/**
|
||||
* @see mozSpellChecker::GetCurrentDictionary
|
||||
|
|
|
@ -501,46 +501,10 @@ EditorSpellCheck::RemoveWordFromDictionary(const nsAString& aWord) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
EditorSpellCheck::GetDictionaryList(char16_t*** aDictionaryList,
|
||||
uint32_t* aCount) {
|
||||
EditorSpellCheck::GetDictionaryList(nsTArray<nsString>& aList) {
|
||||
NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
NS_ENSURE_TRUE(aDictionaryList && aCount, NS_ERROR_NULL_POINTER);
|
||||
|
||||
*aDictionaryList = 0;
|
||||
*aCount = 0;
|
||||
|
||||
nsTArray<nsString> dictList;
|
||||
|
||||
nsresult rv = mSpellChecker->GetDictionaryList(&dictList);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
char16_t** tmpPtr = 0;
|
||||
|
||||
if (dictList.IsEmpty()) {
|
||||
// If there are no dictionaries, return an array containing
|
||||
// one element and a count of one.
|
||||
|
||||
tmpPtr = (char16_t**)moz_xmalloc(sizeof(char16_t*));
|
||||
|
||||
*tmpPtr = 0;
|
||||
*aDictionaryList = tmpPtr;
|
||||
*aCount = 0;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
tmpPtr = (char16_t**)moz_xmalloc(sizeof(char16_t*) * dictList.Length());
|
||||
|
||||
*aDictionaryList = tmpPtr;
|
||||
*aCount = dictList.Length();
|
||||
|
||||
for (uint32_t i = 0; i < *aCount; i++) {
|
||||
tmpPtr[i] = ToNewUnicode(dictList[i]);
|
||||
}
|
||||
|
||||
return rv;
|
||||
return mSpellChecker->GetDictionaryList(&aList);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -31,11 +31,10 @@ function init() {
|
|||
textarea.focus();
|
||||
|
||||
onSpellCheck(textarea, function() {
|
||||
var list = {}, count = {};
|
||||
spellchecker.spellChecker.GetDictionaryList(list, count);
|
||||
ok(count.value > 0, "At least one dictionary should be present");
|
||||
var list = spellchecker.spellChecker.GetDictionaryList();
|
||||
ok(list.length > 0, "At least one dictionary should be present");
|
||||
|
||||
var lang = list.value[0];
|
||||
var lang = list[0];
|
||||
spellchecker.spellChecker.SetCurrentDictionary(lang);
|
||||
|
||||
onSpellCheck(textarea, function() {
|
||||
|
|
|
@ -21,9 +21,7 @@ function getMisspelledWords(editor) {
|
|||
|
||||
function getDictionaryList(editor) {
|
||||
var spellchecker = editor.getInlineSpellChecker(true).spellChecker;
|
||||
var o1 = {};
|
||||
spellchecker.GetDictionaryList(o1, {});
|
||||
return o1.value;
|
||||
return spellchecker.GetDictionaryList();
|
||||
}
|
||||
|
||||
function getCurrentDictionary(editor) {
|
||||
|
|
|
@ -193,9 +193,7 @@ InlineSpellChecker.prototype = {
|
|||
curlang = this.mRemote.currentDictionary;
|
||||
} else if (this.mInlineSpellChecker) {
|
||||
var spellchecker = this.mInlineSpellChecker.spellChecker;
|
||||
var o1 = {}, o2 = {};
|
||||
spellchecker.GetDictionaryList(o1, o2);
|
||||
list = o1.value;
|
||||
list = spellchecker.GetDictionaryList();
|
||||
try {
|
||||
curlang = spellchecker.GetCurrentDictionary();
|
||||
} catch (e) {}
|
||||
|
|
|
@ -52,9 +52,8 @@ var InlineSpellCheckerContent = {
|
|||
enableRealTimeSpell: true };
|
||||
}
|
||||
|
||||
let dictionaryList = {};
|
||||
let realSpellChecker = spellChecker.mInlineSpellChecker.spellChecker;
|
||||
realSpellChecker.GetDictionaryList(dictionaryList, {});
|
||||
let dictionaryList = realSpellChecker.GetDictionaryList();
|
||||
|
||||
return { canSpellCheck: spellChecker.canSpellCheck,
|
||||
initialSpellCheckPending: spellChecker.initialSpellCheckPending,
|
||||
|
@ -63,7 +62,7 @@ var InlineSpellCheckerContent = {
|
|||
misspelling: spellChecker.mMisspelling,
|
||||
spellSuggestions: this._generateSpellSuggestions(),
|
||||
currentDictionary: spellChecker.mInlineSpellChecker.spellChecker.GetCurrentDictionary(),
|
||||
dictionaryList: dictionaryList.value };
|
||||
dictionaryList };
|
||||
},
|
||||
|
||||
uninitContextMenu() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче