Bug 1443902 - Part 2. Update spellcheck status on focused element after turning off contenteditable. r?masayuki draft
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Tue, 10 Jul 2018 14:17:50 +0900
changeset 816383 7131d59a2fd607494600cc3f51ca40c0024760d7
parent 815883 9d90c12b3c93e4dfd95095ce29a26e5fdd83f952
push id115825
push userbmo:m_kato@ga2.so-net.ne.jp
push dateWed, 11 Jul 2018 04:24:36 +0000
reviewersmasayuki
bugs1443902
milestone63.0a1
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
editor/libeditor/EditorBase.cpp
--- 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);
 }