#375: M1330912 (sync patch only)

This commit is contained in:
Cameron Kaiser 2017-05-08 17:22:01 -07:00
parent 7da09aa4e0
commit bea84e5072
2 changed files with 10 additions and 1 deletions

View File

@ -146,6 +146,7 @@ nsEditor::nsEditor()
, mDispatchInputEvent(true)
, mIsInEditAction(false)
, mHidingCaret(false)
, mSpellCheckerDictionaryUpdated(true)
{
}
@ -1309,6 +1310,11 @@ NS_IMETHODIMP nsEditor::SyncRealTimeSpell()
GetInlineSpellChecker(enable, getter_AddRefs(spellChecker));
if (mInlineSpellChecker) {
if (!mSpellCheckerDictionaryUpdated && enable) {
mInlineSpellChecker->UpdateCurrentDictionary();
mSpellCheckerDictionaryUpdated = true;
}
// We might have a mInlineSpellChecker even if there are no dictionaries
// available since we don't destroy the mInlineSpellChecker when the last
// dictionariy is removed, but in that case spellChecker is null
@ -5122,8 +5128,10 @@ void
nsEditor::OnFocus(nsIDOMEventTarget* aFocusEventTarget)
{
InitializeSelection(aFocusEventTarget);
if (mInlineSpellChecker) {
mSpellCheckerDictionaryUpdated = false;
if (mInlineSpellChecker && CanEnableSpellCheck()) {
mInlineSpellChecker->UpdateCurrentDictionary();
mSpellCheckerDictionaryUpdated = true;
}
}

View File

@ -883,6 +883,7 @@ protected:
bool mDispatchInputEvent;
bool mIsInEditAction; // true while the instance is handling an edit action
bool mHidingCaret; // whether caret is hidden forcibly.
bool mSpellCheckerDictionaryUpdated; // Whether spellchecker dictionary is initialized after focused.
friend bool NSCanUnload(nsISupports* serviceMgr);
friend class nsAutoTxnsConserveSelection;