Bug 1344642 - Part 2: Add a new pref for input type=week, month and datetime-local. r=smaug
This commit is contained in:
@@ -544,7 +544,8 @@ GetDOMFileOrDirectoryPath(const OwningFileOrDirectory& aData,
|
||||
bool
|
||||
HTMLInputElement::ValueAsDateEnabled(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
return IsExperimentalFormsEnabled() || IsInputDateTimeEnabled();
|
||||
return IsExperimentalFormsEnabled() || IsInputDateTimeEnabled() ||
|
||||
IsInputDateTimeOthersEnabled();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@@ -5710,7 +5711,7 @@ HTMLInputElement::IsDateTimeTypeSupported(uint8_t aDateTimeInputType)
|
||||
((aDateTimeInputType == NS_FORM_INPUT_MONTH ||
|
||||
aDateTimeInputType == NS_FORM_INPUT_WEEK ||
|
||||
aDateTimeInputType == NS_FORM_INPUT_DATETIME_LOCAL) &&
|
||||
IsInputDateTimeEnabled());
|
||||
IsInputDateTimeOthersEnabled());
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
@@ -5786,6 +5787,20 @@ HTMLInputElement::IsInputDateTimeEnabled()
|
||||
return sDateTimeEnabled;
|
||||
}
|
||||
|
||||
/* 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::IsInputNumberEnabled()
|
||||
{
|
||||
@@ -5835,12 +5850,9 @@ HTMLInputElement::ParseAttribute(int32_t aNamespaceID,
|
||||
if (aAttribute == nsGkAtoms::type) {
|
||||
aResult.ParseEnumValue(aValue, kInputTypeTable, false, kInputDefaultType);
|
||||
int32_t newType = aResult.GetEnumValue();
|
||||
if ((IsExperimentalMobileType(newType) &&
|
||||
!IsExperimentalFormsEnabled()) ||
|
||||
(newType == NS_FORM_INPUT_NUMBER && !IsInputNumberEnabled()) ||
|
||||
if ((newType == NS_FORM_INPUT_NUMBER && !IsInputNumberEnabled()) ||
|
||||
(newType == NS_FORM_INPUT_COLOR && !IsInputColorEnabled()) ||
|
||||
(IsDateTimeInputType(newType) &&
|
||||
!IsDateTimeTypeSupported(newType))) {
|
||||
(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
|
||||
// "text" in it.
|
||||
|
||||
Reference in New Issue
Block a user