diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-15 14:52:09 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-15 14:52:09 +0200 |
commit | c55addfa6422cd6fd3886f914b71139c4dd0edcc (patch) | |
tree | 2c5406fb382e855d74d939ff90d4d5b0fb50d316 /dom/html/HTMLInputElement.cpp | |
parent | 054dde272820f12b4f3c60ee4c8b7ede47126aa6 (diff) | |
download | UXP-c55addfa6422cd6fd3886f914b71139c4dd0edcc.tar UXP-c55addfa6422cd6fd3886f914b71139c4dd0edcc.tar.gz UXP-c55addfa6422cd6fd3886f914b71139c4dd0edcc.tar.lz UXP-c55addfa6422cd6fd3886f914b71139c4dd0edcc.tar.xz UXP-c55addfa6422cd6fd3886f914b71139c4dd0edcc.zip |
Bug 1344642 - Part 2: Add a new pref for input type=week, month and datetime-local
Diffstat (limited to 'dom/html/HTMLInputElement.cpp')
-rw-r--r-- | dom/html/HTMLInputElement.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index 3a3136a60..52062c4b9 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -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 @@ -5786,6 +5787,20 @@ HTMLInputElement::IsInputDateTimeEnabled() } /* 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() { static bool sInputNumberEnabled = false; @@ -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); } |