зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1005268 - Remove "datetime" UI from Fennec and fix capitalization issue r=jchen
`<input type=datetime>` was dropped from the spec many years ago, and is not supported by the platform. To JS code, it looks like a regular text input box. With removed support for "datetime" inputs, we can also fix a bug in the InputWidgetHelper. Due to the use of getAttribute, if the attribute value was capitalized, then the special date/time picker UI would not be shown. This is corrected by using the "type" property instead. I verified on Android Nougat that all other input types (date, datetime-local, week, month, time) still work as intended. Depends on D8668 Differential Revision: https://phabricator.services.mozilla.com/D8666 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
273436ab20
Коммит
b72d2fe05f
|
@ -178,7 +178,6 @@ public abstract class PromptInput {
|
|||
"week",
|
||||
"time",
|
||||
"datetime-local",
|
||||
"datetime",
|
||||
"month"
|
||||
};
|
||||
|
||||
|
@ -241,7 +240,7 @@ public abstract class PromptInput {
|
|||
input.setCurrentHour(calendar.get(GregorianCalendar.HOUR_OF_DAY));
|
||||
input.setCurrentMinute(calendar.get(GregorianCalendar.MINUTE));
|
||||
mView = (View)input;
|
||||
} else if (mType.equals("datetime-local") || mType.equals("datetime")) {
|
||||
} else if (mType.equals("datetime-local")) {
|
||||
DateTimePicker input = new DateTimePicker(context, "yyyy-MM-dd'T'HH:mm:ss",
|
||||
formatDateTimeSeconds(mValue),
|
||||
mSecondEnabled ? DateTimePicker.PickersState.DATETIME_WITH_SECOND : DateTimePicker.PickersState.DATETIME,
|
||||
|
@ -267,9 +266,6 @@ public abstract class PromptInput {
|
|||
// Reformat the datetime value so that it can be parsed by
|
||||
// SimpleDateFormat ending with "HH:mm:ss".
|
||||
|
||||
// datetime may contain a 'Z' at the end.
|
||||
dateString = dateString.replace("Z", "");
|
||||
|
||||
int i = dateString.indexOf(":"); // Separator in "HH:mm".
|
||||
if (i == -1) {
|
||||
// Unparseable input.
|
||||
|
@ -319,10 +315,6 @@ public abstract class PromptInput {
|
|||
return formatDateString("yyyy-MM-dd'T'HH:mm:ss", calendar);
|
||||
}
|
||||
return formatDateString("yyyy-MM-dd'T'HH:mm", calendar);
|
||||
} else if (mType.equals("datetime")) {
|
||||
calendar.set(GregorianCalendar.ZONE_OFFSET, 0);
|
||||
calendar.setTimeInMillis(dp.getTimeInMillis());
|
||||
return formatDateString("yyyy-MM-dd'T'HH:mm'Z'", calendar);
|
||||
} else if (mType.equals("month")) {
|
||||
return formatDateString("yyyy-MM", calendar);
|
||||
}
|
||||
|
|
|
@ -344,7 +344,6 @@ selectHelper.closeMultipleSelectDialog=Done
|
|||
|
||||
#Input widgets UI
|
||||
inputWidgetHelper.date=Pick a date
|
||||
inputWidgetHelper.datetime=Pick a date and a time
|
||||
inputWidgetHelper.datetime-local=Pick a date and a time
|
||||
inputWidgetHelper.time=Pick a time
|
||||
inputWidgetHelper.week=Pick a week
|
||||
|
|
|
@ -39,10 +39,10 @@ var InputWidgetHelper = {
|
|||
},
|
||||
|
||||
show: function(aElement) {
|
||||
let type = aElement.getAttribute("type");
|
||||
let type = aElement.type;
|
||||
new Prompt({
|
||||
window: aElement.ownerGlobal,
|
||||
title: this.strings().GetStringFromName("inputWidgetHelper." + aElement.getAttribute("type")),
|
||||
title: this.strings().GetStringFromName("inputWidgetHelper." + type),
|
||||
buttons: [
|
||||
this.strings().GetStringFromName("inputWidgetHelper.set"),
|
||||
this.strings().GetStringFromName("inputWidgetHelper.clear"),
|
||||
|
@ -85,8 +85,8 @@ var InputWidgetHelper = {
|
|||
if (!(aElement instanceof win.HTMLInputElement))
|
||||
return false;
|
||||
|
||||
let type = aElement.getAttribute("type");
|
||||
if (type == "date" || type == "datetime" || type == "datetime-local" ||
|
||||
let type = aElement.type;
|
||||
if (type == "date" || type == "datetime-local" ||
|
||||
type == "week" || type == "month" || type == "time") {
|
||||
return true;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче