Bug 1569749 - Update spellcheck context menu - Port Bug 908570 "Don't show the 'Add Dictionaries...' menu item for contenteditable elements with spellcheck=false". r=frg a=frg
authorIan Neal <iann_cvs@blueyonder.co.uk>
Wed, 31 Jul 2019 21:56:04 +0200
changeset 32254 a73b3a81a817f34e124aed51433f7f4a98664574
parent 32253 6809d06a5b834fe052308762dca91a275816ae8d
child 32255 fefca2976fee13e40bc01466a3f24fba76c28ad2
push id208
push userfrgrahl@gmx.net
push dateWed, 31 Jul 2019 19:58:37 +0000
treeherdercomm-esr60@2375c07411d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrg, frg
bugs1569749, 908570
Bug 1569749 - Update spellcheck context menu - Port Bug 908570 "Don't show the 'Add Dictionaries...' menu item for contenteditable elements with spellcheck=false". r=frg a=frg
suite/base/content/nsContextMenu.js
--- a/suite/base/content/nsContextMenu.js
+++ b/suite/base/content/nsContextMenu.js
@@ -346,20 +346,21 @@ nsContextMenu.prototype = {
     this.showItem("context-bidi-page-direction-toggle",
                   !this.onTextInput && gShowBiDi);
   },
 
   initSpellingItems: function() {
     var canSpell = InlineSpellCheckerUI.canSpellCheck &&
                    !InlineSpellCheckerUI.initialSpellCheckPending &&
                    this.canSpellCheck;
+    let showDictionaries = canSpell && InlineSpellCheckerUI.enabled;
     var onMisspelling = InlineSpellCheckerUI.overMisspelling;
     var showUndo = canSpell && InlineSpellCheckerUI.canUndo();
     this.showItem("spell-check-enabled", canSpell);
-    this.showItem("spell-separator", canSpell || this.onEditableArea);
+    this.showItem("spell-separator", canSpell);
     if (canSpell)
       this.setItemAttr("spell-check-enabled", "checked", InlineSpellCheckerUI.enabled);
     this.showItem("spell-add-to-dictionary", onMisspelling);
     this.showItem("spell-undo-add-to-dictionary", showUndo);
     this.showItem("spell-ignore-word", onMisspelling);
 
     // suggestion list
     this.showItem("spell-add-separator", onMisspelling);
@@ -368,28 +369,29 @@ nsContextMenu.prototype = {
       var suggestionsSeparator = document.getElementById("spell-add-separator");
       var numsug = InlineSpellCheckerUI.addSuggestionsToMenu(suggestionsSeparator.parentNode, suggestionsSeparator, 5);
       this.showItem("spell-no-suggestions", numsug == 0);
     } else {
       this.showItem("spell-no-suggestions", false);
     }
 
     // dictionary list
-    this.showItem("spell-dictionaries", canSpell && InlineSpellCheckerUI.enabled);
+    this.showItem("spell-dictionaries", showDictionaries);
     var dictMenu = document.getElementById("spell-dictionaries-menu");
     if (canSpell && dictMenu) {
       var dictSep = document.getElementById("spell-language-separator");
       InlineSpellCheckerUI.addDictionaryListToMenu(dictMenu, dictSep);
       this.showItem("spell-add-dictionaries-main", false);
     }
     else if (this.onEditableArea) {
       // when there is no spellchecker but we might be able to spellcheck
       // add the add to dictionaries item. This will ensure that people
       // with no dictionaries will be able to download them
-      this.showItem("spell-add-dictionaries-main", true);
+      this.showItem("spell-language-separator", showDictionaries);
+      this.showItem("spell-add-dictionaries-main", showDictionaries);
     }
     else
       this.showItem("spell-add-dictionaries-main", false);
   },
 
   initClipboardItems: function() {
     // Copy depends on whether there is selected text.
     // Enabling this context menu item is now done through the global