mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1642344 - convert converter.html2txt.always_include_ruby into a StaticPref. r=KrisWright
NOTE: this also removes a mysterious old comment that implied this code could run without libpref initializing the value, in which case they picked a different default. I assume this is no longer a real configuration? Differential Revision: https://phabricator.services.mozilla.com/D77848
This commit is contained in:
parent
cb65f6a9a6
commit
06069b14e3
@ -29,6 +29,7 @@
|
||||
#include "mozilla/dom/HTMLBRElement.h"
|
||||
#include "mozilla/dom/Text.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StaticPrefs_converter.h"
|
||||
#include "mozilla/BinarySearch.h"
|
||||
#include "nsComputedDOMStyle.h"
|
||||
|
||||
@ -41,7 +42,6 @@ using namespace mozilla::dom;
|
||||
|
||||
#define PREF_STRUCTS "converter.html2txt.structs"
|
||||
#define PREF_HEADER_STRATEGY "converter.html2txt.header_strategy"
|
||||
#define PREF_ALWAYS_INCLUDE_RUBY "converter.html2txt.always_include_ruby"
|
||||
|
||||
static const int32_t kTabSize = 4;
|
||||
static const int32_t kIndentSizeHeaders =
|
||||
@ -68,9 +68,6 @@ static int32_t GetUnicharStringWidth(const nsString& aString);
|
||||
// Someday may want to make this non-const:
|
||||
static const uint32_t TagStackSize = 500;
|
||||
|
||||
static bool gPreferenceInitialized = false;
|
||||
static bool gAlwaysIncludeRuby = false;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsPlainTextSerializer)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsPlainTextSerializer)
|
||||
|
||||
@ -265,12 +262,6 @@ nsPlainTextSerializer::nsPlainTextSerializer()
|
||||
mULCount = 0;
|
||||
|
||||
mIgnoredChildNodeLevel = 0;
|
||||
|
||||
if (!gPreferenceInitialized) {
|
||||
Preferences::AddBoolVarCache(&gAlwaysIncludeRuby, PREF_ALWAYS_INCLUDE_RUBY,
|
||||
true);
|
||||
gPreferenceInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
nsPlainTextSerializer::~nsPlainTextSerializer() {
|
||||
@ -321,11 +312,8 @@ void nsPlainTextSerializer::Settings::Init(const int32_t aFlags,
|
||||
mHeaderStrategy = Convert(headerStrategy);
|
||||
}
|
||||
|
||||
// The pref is default inited to false in libpref, but we use true
|
||||
// as fallback value because we don't want to affect behavior in
|
||||
// other places which use this serializer currently.
|
||||
mWithRubyAnnotation =
|
||||
gAlwaysIncludeRuby || (mFlags & nsIDocumentEncoder::OutputRubyAnnotation);
|
||||
mWithRubyAnnotation = StaticPrefs::converter_html2txt_always_include_ruby() ||
|
||||
(mFlags & nsIDocumentEncoder::OutputRubyAnnotation);
|
||||
|
||||
// XXX We should let the caller decide whether to do this or not
|
||||
mFlags &= ~nsIDocumentEncoder::OutputNoFramesContent;
|
||||
|
@ -1289,6 +1289,19 @@
|
||||
value: 0
|
||||
mirror: always
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "converter."
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# Whether we include ruby annotation in the text despite whether it
|
||||
# is requested. This was true because we didn't explicitly strip out
|
||||
# annotations. Set false by default to provide a better behavior, but
|
||||
# we want to be able to pref-off it if user doesn't like it.
|
||||
- name: converter.html2txt.always_include_ruby
|
||||
type: bool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "datareporting."
|
||||
#---------------------------------------------------------------------------
|
||||
|
@ -1982,11 +1982,6 @@ pref("network.mdns.use_js_fallback", false);
|
||||
|
||||
pref("converter.html2txt.structs", true); // Output structured phrases (strong, em, code, sub, sup, b, i, u)
|
||||
pref("converter.html2txt.header_strategy", 1); // 0 = no indention; 1 = indention, increased with header level; 2 = numbering and slight indention
|
||||
// Whether we include ruby annotation in the text despite whether it
|
||||
// is requested. This was true because we didn't explicitly strip out
|
||||
// annotations. Set false by default to provide a better behavior, but
|
||||
// we want to be able to pref-off it if user doesn't like it.
|
||||
pref("converter.html2txt.always_include_ruby", false);
|
||||
|
||||
pref("intl.accept_languages", "chrome://global/locale/intl.properties");
|
||||
pref("intl.menuitems.alwaysappendaccesskeys","chrome://global/locale/intl.properties");
|
||||
|
@ -35,6 +35,7 @@ pref_groups = [
|
||||
'channelclassifier',
|
||||
'clipboard',
|
||||
'content',
|
||||
'converter',
|
||||
'datareporting',
|
||||
'device',
|
||||
'devtools',
|
||||
|
Loading…
Reference in New Issue
Block a user