Bug 1443902 - Part 2. Update spellcheck status on focused element after turning off contenteditable. r?masayuki
Spellchecker of <input> element is off by default, however, if it's in a
contenteditable element, spellchecker is on by default.
When turning off contenteditable, we have to update spellcheck status if
focused editor is in this contenteditable.
MozReview-Commit-ID: 6Y9mUWTIWRn
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -4803,16 +4803,20 @@ void
EditorBase::ReinitializeSelection(Element& aElement)
{
if (NS_WARN_IF(Destroyed())) {
return;
}
OnFocus(&aElement);
+ // If previous focused editor turn on spellcheck and this editor doesn't
+ // turn on it, spellcheck state is mismatched. So we need to re-sync it.
+ SyncRealTimeSpell();
+
nsPresContext* context = GetPresContext();
if (NS_WARN_IF(!context)) {
return;
}
nsCOMPtr<nsIContent> focusedContent = GetFocusedContentForIME();
IMEStateManager::OnFocusInEditor(context, focusedContent, *this);
}