mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 06:48:38 +09:00
Bug 1344642 - Part 2: Add a new pref for input type=week, month and datetime-local
This commit is contained in:
parent
36d469a74f
commit
5622e56123
6 changed files with 73 additions and 24 deletions
|
|
@ -540,7 +540,8 @@ GetDOMFileOrDirectoryPath(const OwningFileOrDirectory& aData,
|
|||
bool
|
||||
HTMLInputElement::ValueAsDateEnabled(JSContext* cx, JSObject* obj)
|
||||
{
|
||||
return IsExperimentalFormsEnabled() || IsInputDateTimeEnabled();
|
||||
return IsExperimentalFormsEnabled() || IsInputDateTimeEnabled() ||
|
||||
IsInputDateTimeOthersEnabled();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
@ -5709,7 +5710,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
|
||||
|
|
@ -5785,6 +5786,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()
|
||||
{
|
||||
|
|
@ -5827,12 +5842,9 @@ HTMLInputElement::ParseAttribute(int32_t aNamespaceID,
|
|||
bool success = aResult.ParseEnumValue(aValue, kInputTypeTable, false);
|
||||
if (success) {
|
||||
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))) {
|
||||
newType = kInputDefaultType->value;
|
||||
aResult.SetTo(newType, &aValue);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue