Bug 1743370 - Make extensions.spellcheck.inline.max-misspellings a static pref. r=masayuki

Differential Revision: https://phabricator.services.mozilla.com/D132341
This commit is contained in:
Emilio Cobos Álvarez 2021-11-29 10:38:16 +00:00
Родитель b8ea6dd142
Коммит bf6d4c633d
4 изменённых файлов: 11 добавлений и 15 удалений

Просмотреть файл

@ -44,6 +44,7 @@
#include "mozilla/Logging.h"
#include "mozilla/RangeUtils.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPrefs_extensions.h"
#include "mozilla/TextEvents.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/KeyboardEvent.h"
@ -93,8 +94,6 @@ using namespace mozilla::ipc;
static mozilla::LazyLogModule sInlineSpellCheckerLog("InlineSpellChecker");
static const char kMaxSpellCheckSelectionSize[] =
"extensions.spellcheck.inline.max-misspellings";
static const PRTime kMaxSpellCheckTimeInUsec =
INLINESPELL_CHECK_TIMEOUT * PR_USEC_PER_MSEC;
@ -564,18 +563,14 @@ mozInlineSpellChecker::SpellCheckingState
mozInlineSpellChecker::mozInlineSpellChecker()
: mNumWordsInSpellSelection(0),
mMaxNumWordsInSpellSelection(250),
mMaxNumWordsInSpellSelection(
StaticPrefs::extensions_spellcheck_inline_max_misspellings()),
mNumPendingSpellChecks(0),
mNumPendingUpdateCurrentDictionary(0),
mDisabledAsyncToken(0),
mNeedsCheckAfterNavigation(false),
mFullSpellCheckScheduled(false),
mIsListeningToEditSubActions(false) {
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefs)
prefs->GetIntPref(kMaxSpellCheckSelectionSize,
&mMaxNumWordsInSpellSelection);
}
mIsListeningToEditSubActions(false) {}
mozInlineSpellChecker::~mozInlineSpellChecker() {}

Просмотреть файл

@ -165,7 +165,7 @@ class mozInlineSpellChecker final : public nsIInlineSpellChecker,
RefPtr<mozilla::EditorSpellCheck> mPendingSpellCheck;
int32_t mNumWordsInSpellSelection;
int32_t mMaxNumWordsInSpellSelection;
const int32_t mMaxNumWordsInSpellSelection;
// we need to keep track of the current text position in the document
// so we can spell check the old word when the user clicks around the

Просмотреть файл

@ -4299,6 +4299,12 @@
value: false
mirror: once
# Maximum number of misspelled words in a text.
- name: extensions.spellcheck.inline.max-misspellings
type: int32_t
value: 500
mirror: always
# Whether the extensions can register a service worker on its own.
# NOTE: WebExtensions Framework ability to register a background service worker
# is not controlled by this pref, only the extension code ability to use

Просмотреть файл

@ -1004,11 +1004,6 @@ pref("print.print_edge_bottom", 0);
pref("print.print_in_color", true);
#endif
// Pref used by the spellchecker extension to control the
// maximum number of misspelled words that will be underlined
// in a document.
pref("extensions.spellcheck.inline.max-misspellings", 500);
// Whether inserting <div> when typing Enter in a block element which can
// contain <div>. If false, inserts <br> instead.
pref("editor.use_div_for_default_newlines", true);