Bug 1642344 - convert HTMLInputElement VarCache prefs to StaticPrefs. r=geckoview-reviewers,agi.

converts:
* dom.experimental_forms
* dom.forms.datetime.others
* dom.forms.color

Differential Revision: https://phabricator.services.mozilla.com/D77850
This commit is contained in:
Alexis Beingessner 2020-06-09 14:45:50 +00:00
Родитель cc942b6af6
Коммит fc174e020d
5 изменённых файлов: 25 добавлений и 75 удалений

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

@ -437,8 +437,9 @@ void GetDOMFileOrDirectoryPath(const OwningFileOrDirectory& aData,
/* static */
bool HTMLInputElement::ValueAsDateEnabled(JSContext* cx, JSObject* obj) {
return IsExperimentalFormsEnabled() || StaticPrefs::dom_forms_datetime() ||
IsInputDateTimeOthersEnabled();
return StaticPrefs::dom_experimental_forms() ||
StaticPrefs::dom_forms_datetime() ||
StaticPrefs::dom_forms_datetime_others();
}
NS_IMETHODIMP
@ -5047,49 +5048,11 @@ bool HTMLInputElement::IsDateTimeTypeSupported(uint8_t aDateTimeInputType) {
return ((aDateTimeInputType == NS_FORM_INPUT_DATE ||
aDateTimeInputType == NS_FORM_INPUT_TIME) &&
(StaticPrefs::dom_forms_datetime() ||
IsExperimentalFormsEnabled())) ||
StaticPrefs::dom_experimental_forms())) ||
((aDateTimeInputType == NS_FORM_INPUT_MONTH ||
aDateTimeInputType == NS_FORM_INPUT_WEEK ||
aDateTimeInputType == NS_FORM_INPUT_DATETIME_LOCAL) &&
IsInputDateTimeOthersEnabled());
}
/* static */
bool HTMLInputElement::IsExperimentalFormsEnabled() {
static bool sExperimentalFormsEnabled = false;
static bool sExperimentalFormsPrefCached = false;
if (!sExperimentalFormsPrefCached) {
sExperimentalFormsPrefCached = true;
Preferences::AddBoolVarCache(&sExperimentalFormsEnabled,
"dom.experimental_forms", false);
}
return sExperimentalFormsEnabled;
}
/* static */
bool HTMLInputElement::IsInputDateTimeOthersEnabled() {
static bool sDateTimeOthersEnabled = false;
static bool sDateTimeOthersPrefCached = false;
if (!sDateTimeOthersPrefCached) {
sDateTimeOthersPrefCached = true;
Preferences::AddBoolVarCache(&sDateTimeOthersEnabled,
"dom.forms.datetime.others", false);
}
return sDateTimeOthersEnabled;
}
/* static */
bool HTMLInputElement::IsInputColorEnabled() {
static bool sInputColorEnabled = false;
static bool sInputColorPrefCached = false;
if (!sInputColorPrefCached) {
sInputColorPrefCached = true;
Preferences::AddBoolVarCache(&sInputColorEnabled, "dom.forms.color", false);
}
return sInputColorEnabled;
StaticPrefs::dom_forms_datetime_others());
}
bool HTMLInputElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
@ -5111,7 +5074,7 @@ bool HTMLInputElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
if (aAttribute == nsGkAtoms::type) {
aResult.ParseEnumValue(aValue, kInputTypeTable, false, kInputDefaultType);
int32_t newType = aResult.GetEnumValue();
if ((newType == NS_FORM_INPUT_COLOR && !IsInputColorEnabled()) ||
if ((newType == NS_FORM_INPUT_COLOR && !StaticPrefs::dom_forms_color()) ||
(IsDateTimeInputType(newType) && !IsDateTimeTypeSupported(newType))) {
// There's no public way to set an nsAttrValue to an enum value, but we
// can just re-parse with a table that doesn't have any types other than

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

@ -1592,24 +1592,6 @@ class HTMLInputElement final : public TextControlElement,
*/
static bool IsDateTimeTypeSupported(uint8_t aDateTimeInputType);
/**
* Checks preference "dom.experimental_forms" to determine if experimental
* implementation of input element should be enabled.
*/
static bool IsExperimentalFormsEnabled();
/**
* Checks preference "dom.forms.datetime.others" to determine if input week,
* month and datetime-local should be supported.
*/
static bool IsInputDateTimeOthersEnabled();
/**
* Checks preference "dom.forms.color" to determine if date/time related
* types should be supported.
*/
static bool IsInputColorEnabled();
struct nsFilePickerFilter {
nsFilePickerFilter() : mFilterMask(0) {}

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

@ -159,9 +159,6 @@ pref("browser.formfill.enable", true);
/* spellcheck */
pref("layout.spellcheckDefault", 0);
/* new html5 forms */
pref("dom.forms.datetime.others", true);
/* extension manager and xpinstall */
pref("xpinstall.whitelist.fileRequest", false);
pref("xpinstall.whitelist.add", "https://addons.mozilla.org");

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

@ -1983,12 +1983,31 @@
value: 0
mirror: always
# Don't use new input types.
- name: dom.experimental_forms
type: bool
value: false
mirror: always
# Enable <input type=color> by default. It will be turned off for remaining
# platforms which don't have a color picker implemented yet.
- name: dom.forms.color
type: bool
value: true
mirror: always
# Is support for input type=date and type=time enabled?
- name: dom.forms.datetime
type: bool
value: true
mirror: always
# Support for input type=month, type=week and type=datetime-local. By default,
# disabled.
- name: dom.forms.datetime.others
type: bool
value: @IS_ANDROID@
mirror: always
# Is support for HTMLElement.inputMode enabled?
- name: dom.forms.inputmode
type: bool

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

@ -1019,17 +1019,6 @@ pref("dom.storage.client_validation", true);
pref("dom.send_after_paint_to_content", false);
// Don't use new input types
pref("dom.experimental_forms", false);
// Enable <input type=color> by default. It will be turned off for remaining
// platforms which don't have a color picker implemented yet.
pref("dom.forms.color", true);
// Support for input type=month, type=week and type=datetime-local. By default,
// disabled.
pref("dom.forms.datetime.others", false);
// Enable time picker UI. By default, disabled.
pref("dom.forms.datetime.timepicker", false);