diff --git a/browser/base/content/browser-context.inc b/browser/base/content/browser-context.inc index dbdea393ca9f..72fd0547a12c 100644 --- a/browser/base/content/browser-context.inc +++ b/browser/base/content/browser-context.inc @@ -241,6 +241,10 @@ type="checkbox" accesskey="&spellEnable.accesskey;" oncommand="InlineSpellCheckerUI.toggleEnabled();"/> + diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index ee70b29f9d63..e3ddd343a2e1 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -4323,6 +4323,7 @@ function nsContextMenu( xulMenu ) { this.inDirList = false; this.shouldDisplay = true; this.isDesignMode = false; + this.possibleSpellChecking = false; // Initialize new menu. this.initMenu( xulMenu ); @@ -4470,7 +4471,7 @@ nsContextMenu.prototype = { var canSpell = InlineSpellCheckerUI.canSpellCheck; var onMisspelling = InlineSpellCheckerUI.overMisspelling; this.showItem("spell-check-enabled", canSpell); - this.showItem("spell-separator", canSpell); + this.showItem("spell-separator", canSpell || this.possibleSpellChecking); if (canSpell) document.getElementById("spell-check-enabled").setAttribute("checked", InlineSpellCheckerUI.enabled); @@ -4493,6 +4494,14 @@ nsContextMenu.prototype = { var dictMenu = document.getElementById("spell-dictionaries-menu"); var dictSep = document.getElementById("spell-language-separator"); InlineSpellCheckerUI.addDictionaryListToMenu(dictMenu, dictSep); + this.showItem("spell-add-dictionaries-main", false); + } else if (this.possibleSpellChecking) { + // 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); + } else { + this.showItem("spell-add-dictionaries-main", false); } }, initClipboardItems : function () { @@ -4562,6 +4571,7 @@ nsContextMenu.prototype = { this.inFrame = false; this.hasBGImage = false; this.bgImageURL = ""; + this.possibleSpellChecking = false; // Clear any old spellchecking items from the menu, this used to // be in the menu hiding code but wasn't getting called in all @@ -4598,6 +4608,7 @@ nsContextMenu.prototype = { this.onTextInput = this.isTargetATextBox(this.target); // allow spellchecking UI on all writable text boxes except passwords if (this.onTextInput && ! this.target.readOnly && this.target.type != "password") { + this.possibleSpellChecking = true; InlineSpellCheckerUI.init(this.target.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor); InlineSpellCheckerUI.initFromEvent(rangeParent, rangeOffset); } @@ -4605,6 +4616,7 @@ nsContextMenu.prototype = { } else if ( this.target instanceof HTMLTextAreaElement ) { this.onTextInput = true; if (! this.target.readOnly) { + this.possibleSpellChecking = true; InlineSpellCheckerUI.init(this.target.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor); InlineSpellCheckerUI.initFromEvent(rangeParent, rangeOffset); } @@ -4760,6 +4772,7 @@ nsContextMenu.prototype = { this.inFrame = false; this.hasBGImage = false; this.isDesignMode = true; + this.possibleSpellChecking = true; InlineSpellCheckerUI.init(editingSession.getEditorForWindow(win)); var canSpell = InlineSpellCheckerUI.canSpellCheck; InlineSpellCheckerUI.initFromEvent(rangeParent, rangeOffset);