From e25430117a67f5c898e5e9388ebd44b185d469ab Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Fri, 30 Mar 2018 12:17:17 +0200 Subject: moebius#92: HTML - input - datetime + native in moebius: Bug 1317600: https://bugzilla.mozilla.org/show_bug.cgi?id=1317600 A note - not implemented: Bug 1282768: https://bugzilla.mozilla.org/show_bug.cgi?id=1282768 *.css: filter: url("chrome://global/skin/filters.svg#fill");, fill: Bug 1283385: https://bugzilla.mozilla.org/show_bug.cgi?id=1283385 Bug 1323109: https://bugzilla.mozilla.org/show_bug.cgi?id=1323109 Bug 1314544: https://bugzilla.mozilla.org/show_bug.cgi?id=1314544 Bug 1286182: https://bugzilla.mozilla.org/show_bug.cgi?id=1286182 Bug 1325922: https://bugzilla.mozilla.org/show_bug.cgi?id=1325922 A note - not implemented: Bug 1282768: https://bugzilla.mozilla.org/show_bug.cgi?id=1282768 *.css: filter: url("chrome://global/skin/filters.svg#fill");, fill: Bug 1320225: https://bugzilla.mozilla.org/show_bug.cgi?id=1320225 Bug 1341190: https://bugzilla.mozilla.org/show_bug.cgi?id=1341190 --- dom/html/HTMLInputElement.h | 66 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) (limited to 'dom/html/HTMLInputElement.h') diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h index 9ca876aee..9baaffb63 100644 --- a/dom/html/HTMLInputElement.h +++ b/dom/html/HTMLInputElement.h @@ -1632,9 +1632,73 @@ private: return IsSingleLineTextControl(false, aType) || aType == NS_FORM_INPUT_RANGE || aType == NS_FORM_INPUT_NUMBER || - aType == NS_FORM_INPUT_TIME; + aType == NS_FORM_INPUT_TIME || + aType == NS_FORM_INPUT_DATE; } + /** + * Checks if aDateTimeInputType should be supported based on "dom.forms.datetime", + * "dom.forms.datepicker" and "dom.experimental_forms". + */ + static bool + IsDateTimeTypeSupported(uint8_t aDateTimeInputType); + + /** + * Checks preference "dom.webkitBlink.dirPicker.enabled" to determine if + * webkitdirectory should be supported. + */ + static bool + IsWebkitDirPickerEnabled(); + + /** + * Checks preference "dom.webkitBlink.filesystem.enabled" to determine if + * webkitEntries should be supported. + */ + static bool + IsWebkitFileSystemEnabled(); + + /** + * Checks preference "dom.input.dirpicker" to determine if file and directory + * entries API should be supported. + */ + static bool + IsDirPickerEnabled(); + + /** + * Checks preference "dom.forms.datepicker" to determine if date picker should + * be supported. + */ + static bool + IsDatePickerEnabled(); + + /** + * Checks preference "dom.experimental_forms" to determine if experimental + * implementation of input element should be enabled. + */ + static bool + IsExperimentalFormsEnabled(); + + /** + * Checks preference "dom.forms.datetime" to determine if input date/time + * related types should be supported. + */ + static bool + IsInputDateTimeEnabled(); + + /** + * Checks preference "dom.forms.number" to determine if input type=number + * should be supported. + */ + static bool + IsInputNumberEnabled(); + + /** + * Checks preference "dom.forms.color" to determine if date/time related + * types should be supported. + */ + static bool + IsInputColorEnabled(); + struct nsFilePickerFilter { nsFilePickerFilter() : mFilterMask(0) {} -- cgit v1.2.3 From a77308735f50fb1735bca82ffd0ffaf12a5c9f62 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Fri, 30 Mar 2018 19:11:11 +0200 Subject: Bug 1310078 - Implement valueAsNumber and valueAsDate for --- dom/html/HTMLInputElement.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'dom/html/HTMLInputElement.h') diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h index 9baaffb63..56f40a60a 100644 --- a/dom/html/HTMLInputElement.h +++ b/dom/html/HTMLInputElement.h @@ -1075,11 +1075,7 @@ protected: /** * Returns if valueAsNumber attribute applies for the current type. */ - bool DoesValueAsNumberApply() const - { - // TODO: this is temporary until bug 888331 is fixed. - return DoesMinMaxApply() && mType != NS_FORM_INPUT_DATETIME_LOCAL; - } + bool DoesValueAsNumberApply() const { return DoesMinMaxApply(); } /** * Returns if autocomplete attribute applies for the current type. @@ -1287,6 +1283,7 @@ protected: * https://html.spec.whatwg.org/multipage/infrastructure.html#valid-normalised-local-date-and-time-string */ void NormalizeDateTimeLocal(nsAString& aValue) const; + /** * This methods returns the number of days since epoch for a given year and * week. @@ -1317,6 +1314,13 @@ protected: */ uint32_t MaximumWeekInYear(uint32_t aYear) const; + /** + * This method converts aValue (milliseconds within a day) to hours, minutes, + * seconds and milliseconds. + */ + bool GetTimeFromMs(double aValue, uint16_t* aHours, uint16_t* aMinutes, + uint16_t* aSeconds, uint16_t* aMilliseconds) const; + /** * This methods returns true if it's a leap year. */ -- cgit v1.2.3 From 7f21e9c0cd6ec3178ea38f61c6c64c63fcef36b8 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Fri, 30 Mar 2018 20:33:02 +0200 Subject: Bug 1310080 - Implement the step attribute for --- dom/html/HTMLInputElement.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'dom/html/HTMLInputElement.h') diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h index 56f40a60a..fde12b817 100644 --- a/dom/html/HTMLInputElement.h +++ b/dom/html/HTMLInputElement.h @@ -1061,11 +1061,7 @@ protected: /** * Returns if the step attribute apply for the current type. */ - bool DoesStepApply() const - { - // TODO: this is temporary until bug 888331 is fixed. - return DoesMinMaxApply() && mType != NS_FORM_INPUT_DATETIME_LOCAL; - } + bool DoesStepApply() const { return DoesMinMaxApply(); } /** * Returns if stepDown and stepUp methods apply for the current type. -- cgit v1.2.3 From 5e69b904229a13b423b6a2a1f3be4c50ffd2c505 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Fri, 30 Mar 2018 21:13:59 +0200 Subject: Bug 1364026 - (Part 1) Expose HTMLInputElement.getMinimum/getMaximum methods via webidl --- dom/html/HTMLInputElement.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'dom/html/HTMLInputElement.h') diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h index fde12b817..2321b7338 100644 --- a/dom/html/HTMLInputElement.h +++ b/dom/html/HTMLInputElement.h @@ -796,6 +796,13 @@ public: void UpdateDateTimePicker(const DateTimeValue& aValue); void CloseDateTimePicker(); + /* + * The following are called from datetime input box binding to get the + * corresponding computed values. + */ + double GetMinimumAsDouble() { return GetMinimum().toDouble(); } + double GetMaximumAsDouble() { return GetMaximum().toDouble(); } + HTMLInputElement* GetOwnerNumberControl(); HTMLInputElement* GetOwnerDateTimeControl(); -- cgit v1.2.3 From 77fbaff2faf6fc341e30a309f7e68458f2864ad9 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Fri, 30 Mar 2018 23:25:42 +0200 Subject: Bug 1363672 - Add step support to date picker (follow up) Bug 1374967: https://bugzilla.mozilla.org/show_bug.cgi?id=1374967 (partially - implement getStep/getStepBase) --- dom/html/HTMLInputElement.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'dom/html/HTMLInputElement.h') diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h index 2321b7338..adab663c3 100644 --- a/dom/html/HTMLInputElement.h +++ b/dom/html/HTMLInputElement.h @@ -800,6 +800,8 @@ public: * The following are called from datetime input box binding to get the * corresponding computed values. */ + double GetStepAsDouble() { return GetStep().toDouble(); } + double GetStepBaseAsDouble() { return GetStepBase().toDouble(); } double GetMinimumAsDouble() { return GetMinimum().toDouble(); } double GetMaximumAsDouble() { return GetMaximum().toDouble(); } -- cgit v1.2.3 From 054dde272820f12b4f3c60ee4c8b7ede47126aa6 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 15 Apr 2018 14:39:19 +0200 Subject: Bug 1344642 - Part 1: Cleanup dom.forms.datepicker related code --- dom/html/HTMLInputElement.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'dom/html/HTMLInputElement.h') diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h index adab663c3..305b76556 100644 --- a/dom/html/HTMLInputElement.h +++ b/dom/html/HTMLInputElement.h @@ -1451,7 +1451,6 @@ protected: }; nsresult InitFilePicker(FilePickerType aType); nsresult InitColorPicker(); - nsresult InitDatePicker(); /** * Use this function before trying to open a picker. @@ -1647,7 +1646,7 @@ private: /** * Checks if aDateTimeInputType should be supported based on "dom.forms.datetime", - * "dom.forms.datepicker" and "dom.experimental_forms". + * and "dom.experimental_forms". */ static bool IsDateTimeTypeSupported(uint8_t aDateTimeInputType); @@ -1673,13 +1672,6 @@ private: static bool IsDirPickerEnabled(); - /** - * Checks preference "dom.forms.datepicker" to determine if date picker should - * be supported. - */ - static bool - IsDatePickerEnabled(); - /** * Checks preference "dom.experimental_forms" to determine if experimental * implementation of input element should be enabled. -- cgit v1.2.3 From c55addfa6422cd6fd3886f914b71139c4dd0edcc Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 15 Apr 2018 14:52:09 +0200 Subject: Bug 1344642 - Part 2: Add a new pref for input type=week, month and datetime-local --- dom/html/HTMLInputElement.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'dom/html/HTMLInputElement.h') diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h index 305b76556..98a590443 100644 --- a/dom/html/HTMLInputElement.h +++ b/dom/html/HTMLInputElement.h @@ -1680,12 +1680,19 @@ private: IsExperimentalFormsEnabled(); /** - * Checks preference "dom.forms.datetime" to determine if input date/time - * related types should be supported. + * Checks preference "dom.forms.datetime" to determine if input date and time + * should be supported. */ static bool IsInputDateTimeEnabled(); + /** + * Checks preference "dom.forms.datetime.others" to determine if input week, + * month and datetime-local should be supported. + */ + static bool + IsInputDateTimeOthersEnabled(); + /** * Checks preference "dom.forms.number" to determine if input type=number * should be supported. -- cgit v1.2.3