Bug 1357191 - 1. Use Gecko controls for Fennec date/time fields; r=jessica r=nechen
authorJim Chen <nchen@mozilla.com>
Thu, 12 Oct 2017 12:20:14 -0400
changeset 385998 27116489ad3dcb06c42996146750bbf3ccdcff0d
parent 385997 b04a41cfa8122680ace5ea03aebc41e144e38463
child 385999 cc2f40bc1b130431cb6ae4b575fad8a9db5d5873
push id32673
push userarchaeopteryx@coole-files.de
push dateFri, 13 Oct 2017 09:13:17 +0000
treeherdermozilla-central@196dadb2fe50 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjessica, nechen
bugs1357191
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1357191 - 1. Use Gecko controls for Fennec date/time fields; r=jessica r=nechen Right now, date/time fields in Fennec appear as regular text fields, which display the date/time values without formatting. This patch makes the fields use the Gecko controls, which do support formatting. This only changes the appearance of the fields; we still display the native date/time pickers when the fields are tapped on. The reset button is hidden in the controls because the Fennec date/time picker provides a separate "clear" button. MozReview-Commit-ID: 75QyKmolNuf
dom/html/nsIFormControl.h
layout/base/nsCSSFrameConstructor.cpp
mobile/android/app/mobile.js
mobile/android/themes/geckoview/content.css
--- a/dom/html/nsIFormControl.h
+++ b/dom/html/nsIFormControl.h
@@ -284,21 +284,16 @@ bool
 nsIFormControl::IsSingleLineTextControl(bool aExcludePassword, uint32_t aType)
 {
   return aType == NS_FORM_INPUT_TEXT ||
          aType == NS_FORM_INPUT_EMAIL ||
          aType == NS_FORM_INPUT_SEARCH ||
          aType == NS_FORM_INPUT_TEL ||
          aType == NS_FORM_INPUT_URL ||
          // TODO: those are temporary until bug 773205 is fixed.
-#if defined(MOZ_WIDGET_ANDROID)
-         // On Android/B2G, date/time input appears as a normal text box.
-         aType == NS_FORM_INPUT_TIME ||
-         aType == NS_FORM_INPUT_DATE ||
-#endif
          aType == NS_FORM_INPUT_MONTH ||
          aType == NS_FORM_INPUT_WEEK ||
          aType == NS_FORM_INPUT_DATETIME_LOCAL ||
          (!aExcludePassword && aType == NS_FORM_INPUT_PASSWORD);
 }
 
 bool
 nsIFormControl::IsSubmittableControl() const
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -3814,24 +3814,18 @@ nsCSSFrameConstructor::FindInputData(Ele
     SIMPLE_INT_CREATE(NS_FORM_INPUT_URL, NS_NewTextControlFrame),
     SIMPLE_INT_CREATE(NS_FORM_INPUT_RANGE, NS_NewRangeFrame),
     SIMPLE_INT_CREATE(NS_FORM_INPUT_PASSWORD, NS_NewTextControlFrame),
     { NS_FORM_INPUT_COLOR,
       FCDATA_WITH_WRAPPING_BLOCK(0, NS_NewColorControlFrame,
                                  nsCSSAnonBoxes::buttonContent) },
     // TODO: this is temporary until a frame is written: bug 635240.
     SIMPLE_INT_CREATE(NS_FORM_INPUT_NUMBER, NS_NewNumberControlFrame),
-#if defined(MOZ_WIDGET_ANDROID)
-    // On Android, date/time input appears as a normal text box.
-    SIMPLE_INT_CREATE(NS_FORM_INPUT_TIME, NS_NewTextControlFrame),
-    SIMPLE_INT_CREATE(NS_FORM_INPUT_DATE, NS_NewTextControlFrame),
-#else
     SIMPLE_INT_CREATE(NS_FORM_INPUT_TIME, NS_NewDateTimeControlFrame),
     SIMPLE_INT_CREATE(NS_FORM_INPUT_DATE, NS_NewDateTimeControlFrame),
-#endif
     // TODO: this is temporary until a frame is written: bug 888320
     SIMPLE_INT_CREATE(NS_FORM_INPUT_MONTH, NS_NewTextControlFrame),
     // TODO: this is temporary until a frame is written: bug 888320
     SIMPLE_INT_CREATE(NS_FORM_INPUT_WEEK, NS_NewTextControlFrame),
     // TODO: this is temporary until a frame is written: bug 888320
     SIMPLE_INT_CREATE(NS_FORM_INPUT_DATETIME_LOCAL, NS_NewTextControlFrame),
     { NS_FORM_INPUT_SUBMIT,
       FCDATA_WITH_WRAPPING_BLOCK(0, NS_NewGfxButtonControlFrame,
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -176,17 +176,18 @@ pref("findhelper.autozoom", true);
 
 /* autocomplete */
 pref("browser.formfill.enable", true);
 
 /* spellcheck */
 pref("layout.spellcheckDefault", 0);
 
 /* new html5 forms */
-pref("dom.experimental_forms", true);
+pref("dom.forms.datetime", true);
+pref("dom.forms.datetime.others", true);
 pref("dom.forms.number", true);
 
 /* extension manager and xpinstall */
 pref("xpinstall.whitelist.directRequest", false);
 pref("xpinstall.whitelist.fileRequest", false);
 pref("xpinstall.whitelist.add", "https://addons.mozilla.org,https://testpilot.firefox.com");
 
 pref("xpinstall.signatures.required", true);
--- a/mobile/android/themes/geckoview/content.css
+++ b/mobile/android/themes/geckoview/content.css
@@ -300,16 +300,20 @@ input[type="submit"]:active:hover {
   padding-inline-start: 7px;
 }
 
 input[type=number] > div > div, /* work around bug 946184 */
 input[type=number]::-moz-number-spin-box {
   display: none;
 }
 
+button:-moz-native-anonymous.datetime-reset-button {
+  display: none;
+}
+
 /* Override accessiblecaret css in layout/style/ua.css */
 div:-moz-native-anonymous.moz-accessiblecaret > #text-overlay,
 div:-moz-native-anonymous.moz-accessiblecaret > #image {
   /* border: 0.1px solid red; */ /* Uncomment border to see the touch target. */
   padding-left: 59%; /* Enlarge the touch area. ((48-22)/2)px / 22px ~= 59% */
   padding-right: 59%; /* Enlarge the touch area. */
   left: -59%;
 }