Bug 1660214 - Use CreatesDateTimeWidget() in two other places. r=smaug
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 20 Aug 2020 12:53:18 +0000
changeset 610146 999932e4d09c2b23553a850b85008d040a85355a
parent 610145 0961437b50990286c7acef14b8b9e2f01417cbc8
child 610147 2701ce7da115546a3012f9772626009abda735c1
push id13553
push userffxbld-merge
push dateMon, 24 Aug 2020 12:51:36 +0000
treeherdermozilla-beta@a54f8b5d0977 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1660214
milestone81.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 1660214 - Use CreatesDateTimeWidget() in two other places. r=smaug I had missed these two. The NUMBER condition is dead (we early-return in IsSingleLineTextControl above). Differential Revision: https://phabricator.services.mozilla.com/D87721
dom/html/HTMLInputElement.cpp
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -2650,18 +2650,17 @@ nsresult HTMLInputElement::SetValueInter
         if (setValueChanged) {
           SetValueChanged(true);
         }
         if (mType == NS_FORM_INPUT_RANGE) {
           nsRangeFrame* frame = do_QueryFrame(GetPrimaryFrame());
           if (frame) {
             frame->UpdateForValueChange();
           }
-        } else if ((mType == NS_FORM_INPUT_TIME ||
-                    mType == NS_FORM_INPUT_DATE) &&
+        } else if (CreatesDateTimeWidget() &&
                    !(aFlags & TextControlState::eSetValue_BySetUserInput)) {
           if (Element* dateTimeBoxElement = GetDateTimeBoxElement()) {
             AsyncEventDispatcher* dispatcher = new AsyncEventDispatcher(
                 dateTimeBoxElement, u"MozDateTimeValueChanged"_ns,
                 CanBubble::eNo, ChromeOnlyDispatch::eNo);
             dispatcher->RunDOMEventWhenSafe();
           }
         }
@@ -6092,18 +6091,17 @@ bool HTMLInputElement::IsHTMLFocusable(b
 
 #ifdef XP_MACOSX
   const bool defaultFocusable =
       !aWithMouse || nsFocusManager::sMouseFocusesFormControl;
 #else
   const bool defaultFocusable = true;
 #endif
 
-  if (mType == NS_FORM_INPUT_NUMBER || mType == NS_FORM_INPUT_TIME ||
-      mType == NS_FORM_INPUT_DATE) {
+  if (CreatesDateTimeWidget()) {
     if (aTabIndex) {
       // We only want our native anonymous child to be tabable to, not ourself.
       *aTabIndex = -1;
     }
     *aIsFocusable = true;
     return true;
   }