Bug 1320225: [DateTimeInput] Integration of input type=date input box with picker (part 2)

This commit is contained in:
janekptacijarabaci 2018-02-14 14:45:58 +01:00 committed by Roy Tam
commit 753a28d239
4 changed files with 21 additions and 6 deletions

View file

@ -238,6 +238,9 @@ partial interface HTMLInputElement {
dictionary DateTimeValue {
long hour;
long minute;
long year;
long month;
long day;
};
partial interface HTMLInputElement {

View file

@ -1737,6 +1737,7 @@ let DateTimePickerListener = {
}
case "MozUpdateDateTimePicker": {
let value = this._inputElement.getDateTimeInputBoxValue();
value.type = this._inputElement.type;
sendAsyncMessage("FormDateTime:UpdatePicker", { value });
break;
}

View file

@ -199,10 +199,24 @@
</method>
<method name="setFieldsFromPicker">
<parameter name="aValue"/>
<body>
<![CDATA[
// TODO: Bug 1320225 - [DateTimeInput] Integration of input type=date
// input box with picker.
let year = aValue.year;
let month = aValue.month;
let day = aValue.day;
if (!this.isEmpty(year)) {
this.setFieldValue(this.mYearField, year);
}
if (!this.isEmpty(month)) {
this.setFieldValue(this.mMonthField, month);
}
if (!this.isEmpty(day)) {
this.setFieldValue(this.mDayField, day);
}
]]>
</body>
</method>

View file

@ -97,13 +97,10 @@ this.DateTimePickerHelper = {
// Called when picker value has changed, notify input box about it.
updateInputBoxValue: function(aEvent) {
// TODO: parse data based on input type.
const { hour, minute } = aEvent.detail;
debug("hour: " + hour + ", minute: " + minute);
let browser = this.weakBrowser ? this.weakBrowser.get() : null;
if (browser) {
browser.messageManager.sendAsyncMessage(
"FormDateTime:PickerValueChanged", { hour, minute });
"FormDateTime:PickerValueChanged", aEvent.detail);
}
},