Bug 1351860 - Move mType from HTMLInputElement to nsIFormControl and make GetType non-virtual inlined, r=jessica
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Fri, 31 Mar 2017 13:13:36 -0400
changeset 350725 a220553b86db49be6280ce56702b0da34130cd6e
parent 350724 3b920caf08cec95491458a5d49ecd206ba1b0069
child 350726 30fe7c61b5db9725031edf9378ef8cb7df05b532
push id88702
push useropettay@mozilla.com
push dateFri, 31 Mar 2017 19:45:44 +0000
treeherdermozilla-inbound@30fe7c61b5db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjessica
bugs1351860
milestone55.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 1351860 - Move mType from HTMLInputElement to nsIFormControl and make GetType non-virtual inlined, r=jessica
docshell/base/nsDocShellTreeOwner.cpp
dom/base/nsContentAreaDragDrop.cpp
dom/base/nsContentUtils.cpp
dom/base/nsCopySupport.cpp
dom/base/nsFocusManager.cpp
dom/events/EventStateManager.cpp
dom/events/IMEStateManager.cpp
dom/html/HTMLButtonElement.cpp
dom/html/HTMLButtonElement.h
dom/html/HTMLFieldSetElement.cpp
dom/html/HTMLFieldSetElement.h
dom/html/HTMLFormControlsCollection.cpp
dom/html/HTMLFormElement.cpp
dom/html/HTMLInputElement.cpp
dom/html/HTMLInputElement.h
dom/html/HTMLObjectElement.cpp
dom/html/HTMLObjectElement.h
dom/html/HTMLOutputElement.cpp
dom/html/HTMLOutputElement.h
dom/html/HTMLSelectElement.cpp
dom/html/HTMLSelectElement.h
dom/html/HTMLTextAreaElement.cpp
dom/html/HTMLTextAreaElement.h
dom/html/RadioNodeList.cpp
dom/html/nsGenericHTMLElement.cpp
dom/html/nsGenericHTMLElement.h
dom/html/nsIFormControl.h
dom/html/nsTextEditorState.cpp
dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
editor/libeditor/EditorEventListener.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/forms/nsColorControlFrame.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsDateTimeControlFrame.cpp
layout/forms/nsGfxButtonControlFrame.cpp
layout/forms/nsRangeFrame.cpp
toolkit/components/satchel/nsFormFillController.cpp
--- a/docshell/base/nsDocShellTreeOwner.cpp
+++ b/docshell/base/nsDocShellTreeOwner.cpp
@@ -1552,17 +1552,17 @@ ChromeContextMenuListener::HandleEvent(n
         flags |= nsIContextMenuListener::CONTEXT_IMAGE;
         flags2 |= nsIContextMenuListener2::CONTEXT_IMAGE;
         targetDOMnode = node;
       }
     }
 
     nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(node));
     if (formControl) {
-      if (formControl->GetType() == NS_FORM_TEXTAREA) {
+      if (formControl->ControlType() == NS_FORM_TEXTAREA) {
         flags |= nsIContextMenuListener::CONTEXT_TEXT;
         flags2 |= nsIContextMenuListener2::CONTEXT_TEXT;
         targetDOMnode = node;
       } else {
         nsCOMPtr<nsIDOMHTMLInputElement> inputElement(
           do_QueryInterface(formControl));
         if (inputElement) {
           flags |= nsIContextMenuListener::CONTEXT_INPUT;
--- a/dom/base/nsContentAreaDragDrop.cpp
+++ b/dom/base/nsContentAreaDragDrop.cpp
@@ -461,17 +461,17 @@ DragDataProducer::Produce(DataTransfer* 
 
     {
       // only drag form elements by using the alt key,
       // otherwise buttons and select widgets are hard to use
 
       // Note that while <object> elements implement nsIFormControl, we should
       // really allow dragging them if they happen to be images.
       nsCOMPtr<nsIFormControl> form(do_QueryInterface(mTarget));
-      if (form && !mIsAltKeyPressed && form->GetType() != NS_FORM_OBJECT) {
+      if (form && !mIsAltKeyPressed && form->ControlType() != NS_FORM_OBJECT) {
         *aCanDrag = false;
         return NS_OK;
       }
 
       draggedNode = mTarget;
     }
 
     nsCOMPtr<nsIDOMHTMLAreaElement>   area;   // client-side image map
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -2758,17 +2758,17 @@ nsContentUtils::GenerateStateKey(nsICont
     //
     // XXX We don't need to use index if name is there
     // XXXbz We don't?  Why not?  I don't follow.
     //
     nsCOMPtr<nsIFormControl> control(do_QueryInterface(aContent));
     if (control && htmlFormControls && htmlForms) {
 
       // Append the control type
-      KeyAppendInt(control->GetType(), aKey);
+      KeyAppendInt(control->ControlType(), aKey);
 
       // If in a form, add form name / index of form / index in form
       int32_t index = -1;
       Element *formElement = control->GetFormElement();
       if (formElement) {
         if (IsAutocompleteOff(formElement)) {
           aKey.Truncate();
           return NS_OK;
--- a/dom/base/nsCopySupport.cpp
+++ b/dom/base/nsCopySupport.cpp
@@ -864,17 +864,17 @@ nsCopySupport::FireClipboardEvent(EventM
     nsCOMPtr<nsIContent> srcNode = content;
     if (content->IsInNativeAnonymousSubtree()) {
       srcNode = content->FindFirstNonChromeOnlyAccessContent();
     }
 
     // check if we are looking at a password input
     nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(srcNode);
     if (formControl) {
-      if (formControl->GetType() == NS_FORM_INPUT_PASSWORD) {
+      if (formControl->ControlType() == NS_FORM_INPUT_PASSWORD) {
         return false;
       }
     }
 
     // when cutting non-editable content, do nothing
     // XXX this is probably the wrong editable flag to check
     if (originalEventMessage != eCut || content->IsEditable()) {
       // get the data from the selection if any
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -313,17 +313,17 @@ nsFocusManager::GetFocusedDescendant(nsP
 
 // static
 nsIContent*
 nsFocusManager::GetRedirectedFocus(nsIContent* aContent)
 {
   // For input number, redirect focus to our anonymous text control.
   if (aContent->IsHTMLElement(nsGkAtoms::input)) {
     bool typeIsNumber =
-      static_cast<dom::HTMLInputElement*>(aContent)->GetType() ==
+      static_cast<dom::HTMLInputElement*>(aContent)->ControlType() ==
         NS_FORM_INPUT_NUMBER;
 
     if (typeIsNumber) {
       nsNumberControlFrame* numberControlFrame =
         do_QueryFrame(aContent->GetPrimaryFrame());
 
       if (numberControlFrame) {
         HTMLInputElement* textControl =
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -1529,17 +1529,17 @@ EventStateManager::FireContextClick()
         }
       }
     }
     else if (mGestureDownContent->IsHTMLElement()) {
       nsCOMPtr<nsIFormControl> formCtrl(do_QueryInterface(mGestureDownContent));
 
       if (formCtrl) {
         allowedToDispatch = formCtrl->IsTextOrNumberControl(/*aExcludePassword*/ false) ||
-                            formCtrl->GetType() == NS_FORM_INPUT_FILE;
+                            formCtrl->ControlType() == NS_FORM_INPUT_FILE;
       }
       else if (mGestureDownContent->IsAnyOfHTMLElements(nsGkAtoms::applet,
                                                         nsGkAtoms::embed,
                                                         nsGkAtoms::object,
                                                         nsGkAtoms::label)) {
         allowedToDispatch = false;
       }
     }
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -1030,17 +1030,17 @@ IMEStateManager::SetIMEState(const IMESt
         // is this an html form and does it only have a single text input element?
         } else if (formElement && formElement->IsHTMLElement(nsGkAtoms::form) &&
                    !static_cast<dom::HTMLFormElement*>(formElement)->
                      ImplicitSubmissionIsDisabled()) {
           willSubmit = true;
         }
       }
       context.mActionHint.Assign(
-        willSubmit ? (control->GetType() == NS_FORM_INPUT_SEARCH ?
+        willSubmit ? (control->ControlType() == NS_FORM_INPUT_SEARCH ?
                        NS_LITERAL_STRING("search") : NS_LITERAL_STRING("go")) :
                      (formElement ?
                        NS_LITERAL_STRING("next") : EmptyString()));
     }
   }
 
   // XXX I think that we should use nsContentUtils::IsCallerChrome() instead
   //     of the process type.
--- a/dom/html/HTMLButtonElement.cpp
+++ b/dom/html/HTMLButtonElement.cpp
@@ -52,18 +52,17 @@ static const nsAttrValue::EnumTable kBut
 
 // Default type is 'submit'.
 static const nsAttrValue::EnumTable* kButtonDefaultType = &kButtonTypeTable[2];
 
 
 // Construction, destruction
 HTMLButtonElement::HTMLButtonElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                                      FromParser aFromParser)
-  : nsGenericHTMLFormElementWithState(aNodeInfo),
-    mType(kButtonDefaultType->value),
+  : nsGenericHTMLFormElementWithState(aNodeInfo, kButtonDefaultType->value),
     mDisabledChanged(false),
     mInInternalActivate(false),
     mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT))
 {
   // Set up our default state: enabled
   AddStatesSilently(NS_EVENT_STATE_ENABLED);
 }
 
--- a/dom/html/HTMLButtonElement.h
+++ b/dom/html/HTMLButtonElement.h
@@ -42,17 +42,16 @@ public:
   {
     return true;
   }
 
   // nsIDOMHTMLButtonElement
   NS_DECL_NSIDOMHTMLBUTTONELEMENT
 
   // overriden nsIFormControl methods
-  NS_IMETHOD_(uint32_t) GetType() const override { return mType; }
   NS_IMETHOD Reset() override;
   NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
   NS_IMETHOD SaveState() override;
   bool RestoreState(nsPresState* aState) override;
   virtual bool IsDisabledForEvents(EventMessage aMessage) override;
 
   virtual void FieldSetDisabledChanged(bool aNotify) override;
 
--- a/dom/html/HTMLFieldSetElement.cpp
+++ b/dom/html/HTMLFieldSetElement.cpp
@@ -13,17 +13,17 @@
 #include "nsQueryObject.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(FieldSet)
 
 namespace mozilla {
 namespace dom {
 
 HTMLFieldSetElement::HTMLFieldSetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
-  : nsGenericHTMLFormElement(aNodeInfo)
+  : nsGenericHTMLFormElement(aNodeInfo, NS_FORM_FIELDSET)
   , mElements(nullptr)
   , mFirstLegend(nullptr)
   , mInvalidElementsCount(0)
 {
   // <fieldset> is always barred from constraint validation.
   SetBarredFromConstraintValidation(true);
 
   // We start out enabled and valid.
--- a/dom/html/HTMLFieldSetElement.h
+++ b/dom/html/HTMLFieldSetElement.h
@@ -45,17 +45,16 @@ public:
   virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
                                 const nsAttrValue* aValue, bool aNotify) override;
 
   virtual nsresult InsertChildAt(nsIContent* aChild, uint32_t aIndex,
                                      bool aNotify) override;
   virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
 
   // nsIFormControl
-  NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_FIELDSET; }
   NS_IMETHOD Reset() override;
   NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
   virtual bool IsDisabledForEvents(EventMessage aMessage) override;
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
 
   const nsIContent* GetFirstLegend() const { return mFirstLegend; }
 
   void AddElement(nsGenericHTMLFormElement* aElement);
--- a/dom/html/HTMLFormControlsCollection.cpp
+++ b/dom/html/HTMLFormControlsCollection.cpp
@@ -24,17 +24,17 @@ namespace dom {
 
 /* static */ bool
 HTMLFormControlsCollection::ShouldBeInElements(nsIFormControl* aFormControl)
 {
   // For backwards compatibility (with 4.x and IE) we must not add
   // <input type=image> elements to the list of form controls in a
   // form.
 
-  switch (aFormControl->GetType()) {
+  switch (aFormControl->ControlType()) {
   case NS_FORM_BUTTON_BUTTON :
   case NS_FORM_BUTTON_RESET :
   case NS_FORM_BUTTON_SUBMIT :
   case NS_FORM_INPUT_BUTTON :
   case NS_FORM_INPUT_CHECKBOX :
   case NS_FORM_INPUT_COLOR :
   case NS_FORM_INPUT_EMAIL :
   case NS_FORM_INPUT_FILE :
--- a/dom/html/HTMLFormElement.cpp
+++ b/dom/html/HTMLFormElement.cpp
@@ -1246,17 +1246,17 @@ HTMLFormElement::AddElement(nsGenericHTM
       mControls->mElements : mControls->mNotInElements;
 
   bool lastElement = AddElementToList(controlList, aChild, this);
 
 #ifdef DEBUG
   AssertDocumentOrder(controlList, this);
 #endif
 
-  int32_t type = aChild->GetType();
+  int32_t type = aChild->ControlType();
 
   //
   // If it is a password control, and the password manager has not yet been
   // initialized, initialize the password manager
   //
   if (type == NS_FORM_INPUT_PASSWORD) {
     if (!gPasswordManagerInitialized) {
       gPasswordManagerInitialized = true;
@@ -1347,17 +1347,17 @@ HTMLFormElement::RemoveElement(nsGeneric
                                bool aUpdateValidity)
 {
   RemoveElementFromPastNamesMap(aChild);
 
   //
   // Remove it from the radio group if it's a radio button
   //
   nsresult rv = NS_OK;
-  if (aChild->GetType() == NS_FORM_INPUT_RADIO) {
+  if (aChild->ControlType() == NS_FORM_INPUT_RADIO) {
     RefPtr<HTMLInputElement> radio =
       static_cast<HTMLInputElement*>(aChild);
     radio->WillRemoveFromRadioGroup();
   }
 
   // Determine whether to remove the child from the elements list
   // or the not in elements list.
   bool childInElements = HTMLFormControlsCollection::ShouldBeInElements(aChild);
@@ -1813,17 +1813,17 @@ HTMLFormElement::IsDefaultSubmitElement(
 bool
 HTMLFormElement::ImplicitSubmissionIsDisabled() const
 {
   // Input text controls are always in the elements list.
   uint32_t numDisablingControlsFound = 0;
   uint32_t length = mControls->mElements.Length();
   for (uint32_t i = 0; i < length && numDisablingControlsFound < 2; ++i) {
     if (mControls->mElements[i]->IsSingleLineTextControl(false) ||
-        mControls->mElements[i]->GetType() == NS_FORM_INPUT_NUMBER) {
+        mControls->mElements[i]->ControlType() == NS_FORM_INPUT_NUMBER) {
       numDisablingControlsFound++;
     }
   }
   return numDisablingControlsFound != 1;
 }
 
 NS_IMETHODIMP
 HTMLFormElement::GetEncoding(nsAString& aEncoding)
@@ -2019,17 +2019,17 @@ One should be implemented!");
 bool
 HTMLFormElement::SubmissionCanProceed(Element* aSubmitter)
 {
 #ifdef DEBUG
   if (aSubmitter) {
     nsCOMPtr<nsIFormControl> fc = do_QueryInterface(aSubmitter);
     MOZ_ASSERT(fc);
 
-    uint32_t type = fc->GetType();
+    uint32_t type = fc->ControlType();
     MOZ_ASSERT(type == NS_FORM_INPUT_SUBMIT ||
                type == NS_FORM_INPUT_IMAGE ||
                type == NS_FORM_BUTTON_SUBMIT,
                "aSubmitter is not a submit control?");
   }
 #endif
 
   // Modified step 2 of
@@ -2220,17 +2220,17 @@ HTMLFormElement::GetNextRadioButton(cons
       if (--index < 0) {
         index = numRadios -1;
       }
     }
     else if (++index >= (int32_t)numRadios) {
       index = 0;
     }
     radio = HTMLInputElement::FromContentOrNull(radioGroup->Item(index));
-    isRadio = radio && radio->GetType() == NS_FORM_INPUT_RADIO;
+    isRadio = radio && radio->ControlType() == NS_FORM_INPUT_RADIO;
     if (!isRadio) {
       continue;
     }
 
     nsAutoString name;
     radio->GetName(name);
     isRadio = aName.Equals(name);
   } while (!isRadio || (radio->Disabled() && radio != currentRadio));
@@ -2248,17 +2248,17 @@ HTMLFormElement::WalkRadioGroup(const ns
     //
     // XXX If the name is empty, it's not stored in the control list.  There
     // *must* be a more efficient way to do this.
     //
     nsCOMPtr<nsIFormControl> control;
     uint32_t len = GetElementCount();
     for (uint32_t i = 0; i < len; i++) {
       control = GetElementAt(i);
-      if (control->GetType() == NS_FORM_INPUT_RADIO) {
+      if (control->ControlType() == NS_FORM_INPUT_RADIO) {
         nsCOMPtr<nsIContent> controlContent = do_QueryInterface(control);
         if (controlContent &&
             controlContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name,
                                         EmptyString(), eCaseMatters) &&
             !aVisitor->Visit(control)) {
           break;
         }
       }
@@ -2270,33 +2270,33 @@ HTMLFormElement::WalkRadioGroup(const ns
   nsCOMPtr<nsISupports> item = DoResolveName(aName, aFlushContent);
   if (!item) {
     return NS_ERROR_FAILURE;
   }
 
   // If it's just a lone radio button, then select it.
   nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(item);
   if (formControl) {
-    if (formControl->GetType() == NS_FORM_INPUT_RADIO) {
+    if (formControl->ControlType() == NS_FORM_INPUT_RADIO) {
       aVisitor->Visit(formControl);
     }
     return NS_OK;
   }
 
   nsCOMPtr<nsIDOMNodeList> nodeList = do_QueryInterface(item);
   if (!nodeList) {
     return NS_OK;
   }
   uint32_t length = 0;
   nodeList->GetLength(&length);
   for (uint32_t i = 0; i < length; i++) {
     nsCOMPtr<nsIDOMNode> node;
     nodeList->Item(i, getter_AddRefs(node));
     nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(node);
-    if (formControl && formControl->GetType() == NS_FORM_INPUT_RADIO &&
+    if (formControl && formControl->ControlType() == NS_FORM_INPUT_RADIO &&
         !aVisitor->Visit(formControl)) {
       break;
     }
   }
   return NS_OK;
 }
 
 void
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -1049,18 +1049,17 @@ static nsresult FireEventForAccessibilit
 #endif
 
 //
 // construction, destruction
 //
 
 HTMLInputElement::HTMLInputElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                                    FromParser aFromParser, FromClone aFromClone)
-  : nsGenericHTMLFormElementWithState(aNodeInfo)
-  , mType(kInputDefaultType->value)
+  : nsGenericHTMLFormElementWithState(aNodeInfo, kInputDefaultType->value)
   , mAutocompleteAttrState(nsContentUtils::eAutocompleteAttrState_Unknown)
   , mDisabledChanged(false)
   , mValueChanged(false)
   , mLastValueChangeWasInteractive(false)
   , mCheckedChanged(false)
   , mChecked(false)
   , mHandlingSelectEvent(false)
   , mShouldInitChecked(false)
@@ -3509,17 +3508,17 @@ HTMLInputElement::Focus(ErrorResult& aEr
   // being two buttons (when the picker is a directory picker) the user can
   // tab to the next one.
   nsIFrame* frame = GetPrimaryFrame();
   if (frame) {
     for (nsIFrame* childFrame : frame->PrincipalChildList()) {
       // See if the child is a button control.
       nsCOMPtr<nsIFormControl> formCtrl =
         do_QueryInterface(childFrame->GetContent());
-      if (formCtrl && formCtrl->GetType() == NS_FORM_BUTTON_BUTTON) {
+      if (formCtrl && formCtrl->ControlType() == NS_FORM_BUTTON_BUTTON) {
         nsCOMPtr<nsIDOMElement> element = do_QueryInterface(formCtrl);
         nsIFocusManager* fm = nsFocusManager::GetFocusManager();
         if (fm && element) {
           fm->SetFocus(element, 0);
         }
         break;
       }
     }
--- a/dom/html/HTMLInputElement.h
+++ b/dom/html/HTMLInputElement.h
@@ -159,17 +159,16 @@ public:
   NS_IMETHOD GetEditor(nsIEditor** aEditor) override
   {
     return nsGenericHTMLElement::GetEditor(aEditor);
   }
 
   NS_IMETHOD SetUserInput(const nsAString& aInput) override;
 
   // Overriden nsIFormControl methods
-  NS_IMETHOD_(uint32_t) GetType() const override { return mType; }
   NS_IMETHOD Reset() override;
   NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
   NS_IMETHOD SaveState() override;
   virtual bool RestoreState(nsPresState* aState) override;
   virtual bool AllowDrop() override;
   virtual bool IsDisabledForEvents(EventMessage aMessage) override;
 
   virtual void FieldSetDisabledChanged(bool aNotify) override;
@@ -1604,22 +1603,16 @@ protected:
   static const double kMaximumDayInMaximumYear;
   // Maximum valid month is 275760-09.
   static const double kMaximumMonthInMaximumYear;
   // Long years in a ISO calendar have 53 weeks in them.
   static const double kMaximumWeekInYear;
   // Milliseconds in a day.
   static const double kMsPerDay;
 
-
-  /**
-   * The type of this input (<input type=...>) as an integer.
-   * @see nsIFormControl.h (specifically NS_FORM_INPUT_*)
-   */
-  uint8_t                  mType;
   nsContentUtils::AutocompleteAttrState mAutocompleteAttrState;
   bool                     mDisabledChanged     : 1;
   bool                     mValueChanged        : 1;
   bool                     mLastValueChangeWasInteractive : 1;
   bool                     mCheckedChanged      : 1;
   bool                     mChecked             : 1;
   bool                     mHandlingSelectEvent : 1;
   bool                     mShouldInitChecked   : 1;
--- a/dom/html/HTMLObjectElement.cpp
+++ b/dom/html/HTMLObjectElement.cpp
@@ -25,17 +25,17 @@
 #include "nsFocusManager.h"
 #endif
 
 namespace mozilla {
 namespace dom {
 
 HTMLObjectElement::HTMLObjectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                                      FromParser aFromParser)
-  : nsGenericHTMLFormElement(aNodeInfo),
+  : nsGenericHTMLFormElement(aNodeInfo, NS_FORM_OBJECT),
     mIsDoneAddingChildren(!aFromParser)
 {
   RegisterActivityObserver();
   SetIsNetworkCreated(aFromParser == FROM_PARSER_NETWORK);
 
   // <object> is always barred from constraint validation.
   SetBarredFromConstraintValidation(true);
 
--- a/dom/html/HTMLObjectElement.h
+++ b/dom/html/HTMLObjectElement.h
@@ -64,21 +64,16 @@ public:
                            bool aNotify) override;
   virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
                              bool aNotify) override;
 
   virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) override;
   virtual IMEState GetDesiredIMEState() override;
 
   // Overriden nsIFormControl methods
-  NS_IMETHOD_(uint32_t) GetType() const override
-  {
-    return NS_FORM_OBJECT;
-  }
-
   NS_IMETHOD Reset() override;
   NS_IMETHOD SubmitNamesValues(HTMLFormSubmission *aFormSubmission) override;
 
   virtual bool IsDisabled() const override { return false; }
 
   virtual void DoneAddingChildren(bool aHaveNotified) override;
   virtual bool IsDoneAddingChildren() override;
 
--- a/dom/html/HTMLOutputElement.cpp
+++ b/dom/html/HTMLOutputElement.cpp
@@ -16,17 +16,17 @@
 
 NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Output)
 
 namespace mozilla {
 namespace dom {
 
 HTMLOutputElement::HTMLOutputElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                                      FromParser aFromParser)
-  : nsGenericHTMLFormElement(aNodeInfo)
+  : nsGenericHTMLFormElement(aNodeInfo, NS_FORM_OUTPUT)
   , mValueModeFlag(eModeDefault)
   , mIsDoneAddingChildren(!aFromParser)
 {
   AddMutationObserver(this);
 
   // We start out valid and ui-valid (since we have no form).
   AddStatesSilently(NS_EVENT_STATE_VALID | NS_EVENT_STATE_MOZ_UI_VALID);
 }
--- a/dom/html/HTMLOutputElement.h
+++ b/dom/html/HTMLOutputElement.h
@@ -26,17 +26,16 @@ public:
 
   explicit HTMLOutputElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                              FromParser aFromParser = NOT_FROM_PARSER);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIFormControl
-  NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_OUTPUT; }
   NS_IMETHOD Reset() override;
   NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
 
   virtual bool IsDisabled() const override { return false; }
 
   nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult) const override;
 
   bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
--- a/dom/html/HTMLSelectElement.cpp
+++ b/dom/html/HTMLSelectElement.cpp
@@ -112,17 +112,17 @@ SafeOptionListMutation::~SafeOptionListM
 // HTMLSelectElement
 //
 
 // construction, destruction
 
 
 HTMLSelectElement::HTMLSelectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                                      FromParser aFromParser)
-  : nsGenericHTMLFormElementWithState(aNodeInfo),
+  : nsGenericHTMLFormElementWithState(aNodeInfo, NS_FORM_SELECT),
     mOptions(new HTMLOptionsCollection(this)),
     mAutocompleteAttrState(nsContentUtils::eAutocompleteAttrState_Unknown),
     mIsDoneAddingChildren(!aFromParser),
     mDisabledChanged(false),
     mMutating(false),
     mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT)),
     mSelectionHasChanged(false),
     mDefaultSelectionSet(false),
--- a/dom/html/HTMLSelectElement.h
+++ b/dom/html/HTMLSelectElement.h
@@ -291,17 +291,16 @@ public:
                      EventChainPostVisitor& aVisitor) override;
 
   virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable, int32_t* aTabIndex) override;
   virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
                                  bool aNotify) override;
   virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) override;
 
   // Overriden nsIFormControl methods
-  NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_SELECT; }
   NS_IMETHOD Reset() override;
   NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
   NS_IMETHOD SaveState() override;
   virtual bool RestoreState(nsPresState* aState) override;
   virtual bool IsDisabledForEvents(EventMessage aMessage) override;
 
   virtual void FieldSetDisabledChanged(bool aNotify) override;
 
--- a/dom/html/HTMLTextAreaElement.cpp
+++ b/dom/html/HTMLTextAreaElement.cpp
@@ -48,17 +48,17 @@ static NS_DEFINE_CID(kXULControllersCID,
 
 NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(TextArea)
 
 namespace mozilla {
 namespace dom {
 
 HTMLTextAreaElement::HTMLTextAreaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                                          FromParser aFromParser)
-  : nsGenericHTMLFormElementWithState(aNodeInfo),
+  : nsGenericHTMLFormElementWithState(aNodeInfo, NS_FORM_TEXTAREA),
     mValueChanged(false),
     mLastValueChangeWasInteractive(false),
     mHandlingSelect(false),
     mDoneAddingChildren(!aFromParser),
     mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT)),
     mDisabledChanged(false),
     mCanShowInvalidUI(true),
     mCanShowValidUI(true),
--- a/dom/html/HTMLTextAreaElement.h
+++ b/dom/html/HTMLTextAreaElement.h
@@ -67,17 +67,16 @@ public:
   // nsIDOMNSEditableElement
   NS_IMETHOD GetEditor(nsIEditor** aEditor) override
   {
     return nsGenericHTMLElement::GetEditor(aEditor);
   }
   NS_IMETHOD SetUserInput(const nsAString& aInput) override;
 
   // nsIFormControl
-  NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_TEXTAREA; }
   NS_IMETHOD Reset() override;
   NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
   NS_IMETHOD SaveState() override;
   virtual bool RestoreState(nsPresState* aState) override;
   virtual bool IsDisabledForEvents(EventMessage aMessage) override;
 
   virtual void FieldSetDisabledChanged(bool aNotify) override;
 
--- a/dom/html/RadioNodeList.cpp
+++ b/dom/html/RadioNodeList.cpp
@@ -20,17 +20,17 @@ RadioNodeList::WrapObject(JSContext* aCx
 {
   return RadioNodeListBinding::Wrap(aCx, this, aGivenProto);
 }
 
 HTMLInputElement*
 GetAsRadio(nsIContent* node)
 {
   HTMLInputElement* el = HTMLInputElement::FromContent(node);
-  if (el && el->GetType() == NS_FORM_INPUT_RADIO) {
+  if (el && el->ControlType() == NS_FORM_INPUT_RADIO) {
     return el;
   }
   return nullptr;
 }
 
 void
 RadioNodeList::GetValue(nsString& retval, CallerType aCallerType)
 {
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -398,17 +398,17 @@ nsGenericHTMLElement::Spellcheck()
 
   // Anything else that's not a form control is not spellchecked by default
   nsCOMPtr<nsIFormControl> formControl = do_QueryObject(this);
   if (!formControl) {
     return false;                       // Not spellchecked by default
   }
 
   // Is this a multiline plaintext input?
-  int32_t controlType = formControl->GetType();
+  int32_t controlType = formControl->ControlType();
   if (controlType == NS_FORM_TEXTAREA) {
     return true;             // Spellchecked by default
   }
 
   // Is this anything other than an input text?
   // Other inputs are not spellchecked.
   if (controlType != NS_FORM_INPUT_TEXT) {
     return false;                       // Not spellchecked by default
@@ -1725,18 +1725,20 @@ nsGenericHTMLElement::IsInteractiveHTMLC
 bool
 nsGenericHTMLElement::TouchEventsEnabled(JSContext* aCx, JSObject* aGlobal)
 {
   return TouchEvent::PrefEnabled(aCx, aGlobal);
 }
 
 //----------------------------------------------------------------------
 
-nsGenericHTMLFormElement::nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
+nsGenericHTMLFormElement::nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+                                                   uint8_t aType)
   : nsGenericHTMLElement(aNodeInfo)
+  , nsIFormControl(aType)
   , mForm(nullptr)
   , mFieldSet(nullptr)
 {
   // We should add the NS_EVENT_STATE_ENABLED bit here as needed, but
   // that depends on our type, which is not initialized yet.  So we
   // have to do this in subclasses.
 }
 
@@ -2085,17 +2087,17 @@ nsGenericHTMLFormElement::ForgetFieldSet
   if (mFieldSet == aFieldset) {
     mFieldSet = nullptr;
   }
 }
 
 bool
 nsGenericHTMLFormElement::CanBeDisabled() const
 {
-  int32_t type = GetType();
+  int32_t type = ControlType();
   // It's easier to test the types that _cannot_ be disabled
   return
     type != NS_FORM_OBJECT &&
     type != NS_FORM_OUTPUT;
 }
 
 bool
 nsGenericHTMLFormElement::IsHTMLFocusable(bool aWithMouse,
@@ -2398,17 +2400,17 @@ nsGenericHTMLFormElement::FieldSetDisabl
 {
   UpdateState(aNotify);
 }
 
 bool
 nsGenericHTMLFormElement::IsLabelable() const
 {
   // TODO: keygen should be in that list, see bug 101019.
-  uint32_t type = GetType();
+  uint32_t type = ControlType();
   return (type & NS_FORM_INPUT_ELEMENT && type != NS_FORM_INPUT_HIDDEN) ||
          type & NS_FORM_BUTTON_ELEMENT ||
          // type == NS_FORM_KEYGEN ||
          type == NS_FORM_OUTPUT ||
          type == NS_FORM_SELECT ||
          type == NS_FORM_TEXTAREA;
 }
 
@@ -2725,19 +2727,19 @@ nsGenericHTMLElement::ChangeEditableStat
   nsAutoScriptBlocker scriptBlocker;
   MakeContentDescendantsEditable(this, document);
 }
 
 
 //----------------------------------------------------------------------
 
 nsGenericHTMLFormElementWithState::nsGenericHTMLFormElementWithState(
-    already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo
+    already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo, uint8_t aType
   )
-  : nsGenericHTMLFormElement(aNodeInfo)
+  : nsGenericHTMLFormElement(aNodeInfo, aType)
 {
   mStateKey.SetIsVoid(true);
 }
 
 nsresult
 nsGenericHTMLFormElementWithState::GenerateStateKey()
 {
   // Keep the key if already computed
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -1203,17 +1203,18 @@ ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPE
 
 /**
  * A helper class for form elements that can contain children
  */
 class nsGenericHTMLFormElement : public nsGenericHTMLElement,
                                  public nsIFormControl
 {
 public:
-  explicit nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  nsGenericHTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+                           uint8_t aType);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   nsINode* GetScopeChainParent() const override;
 
   virtual bool IsNodeOfType(uint32_t aFlags) const override;
   virtual void SaveSubtreeState() override;
 
@@ -1363,17 +1364,18 @@ protected:
 
   /* This is a pointer to our closest fieldset parent if any */
   mozilla::dom::HTMLFieldSetElement* mFieldSet;
 };
 
 class nsGenericHTMLFormElementWithState : public nsGenericHTMLFormElement
 {
 public:
-  explicit nsGenericHTMLFormElementWithState(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
+  nsGenericHTMLFormElementWithState(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
+                                    uint8_t aType);
 
   /**
    * Get the presentation state for a piece of content, or create it if it does
    * not exist.  Generally used by SaveState().
    */
   nsPresState* GetPrimaryPresState();
 
   /**
--- a/dom/html/nsIFormControl.h
+++ b/dom/html/nsIFormControl.h
@@ -87,16 +87,20 @@ static_assert(static_cast<uint32_t>(eInp
 /**
  * Interface which all form controls (e.g. buttons, checkboxes, text,
  * radio buttons, select, etc) implement in addition to their dom specific
  * interface.
  */
 class nsIFormControl : public nsISupports
 {
 public:
+  nsIFormControl(uint8_t aType)
+  : mType(aType)
+  {
+  }
 
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFORMCONTROL_IID)
 
   /**
    * Get the fieldset for this form control.
    * @return the fieldset
    */
   virtual mozilla::dom::HTMLFieldSetElement *GetFieldSet() = 0;
@@ -125,17 +129,17 @@ public:
    *        from the form.  (Used by nsFormControlList::Clear())
    */
   virtual void ClearForm(bool aRemoveFromForm) = 0;
 
   /**
    * Get the type of this control as an int (see NS_FORM_* above)
    * @return the type of this control
    */
-  NS_IMETHOD_(uint32_t) GetType() const = 0 ;
+  uint32_t ControlType() const { return mType; }
 
   /**
    * Reset this form control (as it should be when the user clicks the Reset
    * button)
    */
   NS_IMETHOD Reset() = 0;
 
   /**
@@ -221,45 +225,47 @@ protected:
    */
   inline static bool IsSingleLineTextControl(bool aExcludePassword, uint32_t aType);
 
   /**
    * Returns whether this is a auto-focusable form control.
    * @return whether this is a auto-focusable form control.
    */
   inline bool IsAutofocusable() const;
+
+  uint8_t                  mType;
 };
 
 bool
 nsIFormControl::IsSubmitControl() const
 {
-  uint32_t type = GetType();
+  uint32_t type = ControlType();
   return type == NS_FORM_INPUT_SUBMIT ||
          type == NS_FORM_INPUT_IMAGE ||
          type == NS_FORM_BUTTON_SUBMIT;
 }
 
 bool
 nsIFormControl::IsTextControl(bool aExcludePassword) const
 {
-  uint32_t type = GetType();
+  uint32_t type = ControlType();
   return type == NS_FORM_TEXTAREA ||
          IsSingleLineTextControl(aExcludePassword, type);
 }
 
 bool
 nsIFormControl::IsTextOrNumberControl(bool aExcludePassword) const
 {
-  return IsTextControl(aExcludePassword) || GetType() == NS_FORM_INPUT_NUMBER;
+  return IsTextControl(aExcludePassword) || ControlType() == NS_FORM_INPUT_NUMBER;
 }
 
 bool
 nsIFormControl::IsSingleLineTextControl(bool aExcludePassword) const
 {
-  return IsSingleLineTextControl(aExcludePassword, GetType());
+  return IsSingleLineTextControl(aExcludePassword, ControlType());
 }
 
 /*static*/
 bool
 nsIFormControl::IsSingleLineTextControl(bool aExcludePassword, uint32_t aType)
 {
   return aType == NS_FORM_INPUT_TEXT ||
          aType == NS_FORM_INPUT_EMAIL ||
@@ -277,38 +283,38 @@ nsIFormControl::IsSingleLineTextControl(
          aType == NS_FORM_INPUT_DATETIME_LOCAL ||
          (!aExcludePassword && aType == NS_FORM_INPUT_PASSWORD);
 }
 
 bool
 nsIFormControl::IsSubmittableControl() const
 {
   // TODO: keygen should be in that list, see bug 101019.
-  uint32_t type = GetType();
+  uint32_t type = ControlType();
   return type == NS_FORM_OBJECT ||
          type == NS_FORM_TEXTAREA ||
          type == NS_FORM_SELECT ||
          // type == NS_FORM_KEYGEN ||
          type & NS_FORM_BUTTON_ELEMENT ||
          type & NS_FORM_INPUT_ELEMENT;
 }
 
 bool
 nsIFormControl::AllowDraggableChildren() const
 {
-  uint32_t type = GetType();
+  uint32_t type = ControlType();
   return type == NS_FORM_OBJECT ||
          type == NS_FORM_FIELDSET ||
          type == NS_FORM_OUTPUT;
 }
 
 bool
 nsIFormControl::IsAutofocusable() const
 {
-  uint32_t type = GetType();
+  uint32_t type = ControlType();
   return type & NS_FORM_INPUT_ELEMENT ||
          type & NS_FORM_BUTTON_ELEMENT ||
          type == NS_FORM_TEXTAREA ||
          type == NS_FORM_SELECT;
 }
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIFormControl, NS_IFORMCONTROL_IID)
 
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -1974,17 +1974,17 @@ nsTextEditorState::GetParentNumberContro
   }
   HTMLInputElement* input = HTMLInputElement::FromContent(parentOfParent);
   if (input) {
     // This function might be called during frame reconstruction as a result
     // of changing the input control's type from number to something else. In
     // that situation, the type of the control has changed, but its frame has
     // not been reconstructed yet.  So we need to check the type of the input
     // control in addition to the type of the frame.
-    return (input->GetType() == NS_FORM_INPUT_NUMBER) ? input : nullptr;
+    return (input->ControlType() == NS_FORM_INPUT_NUMBER) ? input : nullptr;
   }
 
   return nullptr;
 }
 
 void
 nsTextEditorState::DestroyEditor()
 {
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -1203,17 +1203,17 @@ PersistNodeFixup::FixupNode(nsIDOMNode *
 
             nsAutoString valueStr;
             NS_NAMED_LITERAL_STRING(valueAttr, "value");
             // Update element node attributes with user-entered form state
             nsCOMPtr<nsIContent> content = do_QueryInterface(*aNodeOut);
             RefPtr<dom::HTMLInputElement> outElt =
               dom::HTMLInputElement::FromContentOrNull(content);
             nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(*aNodeOut);
-            switch (formControl->GetType()) {
+            switch (formControl->ControlType()) {
                 case NS_FORM_INPUT_EMAIL:
                 case NS_FORM_INPUT_SEARCH:
                 case NS_FORM_INPUT_TEXT:
                 case NS_FORM_INPUT_TEL:
                 case NS_FORM_INPUT_URL:
                 case NS_FORM_INPUT_NUMBER:
                 case NS_FORM_INPUT_RANGE:
                 case NS_FORM_INPUT_DATE:
--- a/editor/libeditor/EditorEventListener.cpp
+++ b/editor/libeditor/EditorEventListener.cpp
@@ -1203,17 +1203,17 @@ EditorEventListener::IsFileControlTextBo
   if (!root || !root->ChromeOnlyAccess()) {
     return false;
   }
   nsIContent* parent = root->FindFirstNonChromeOnlyAccessContent();
   if (!parent || !parent->IsHTMLElement(nsGkAtoms::input)) {
     return false;
   }
   nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(parent);
-  return formControl->GetType() == NS_FORM_INPUT_FILE;
+  return formControl->ControlType() == NS_FORM_INPUT_FILE;
 }
 
 bool
 EditorEventListener::ShouldHandleNativeKeyBindings(
                        WidgetKeyboardEvent* aKeyboardEvent)
 {
   MOZ_ASSERT(!DetachedFromEditor());
 
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -3723,17 +3723,17 @@ nsCSSFrameConstructor::FindInputData(Ele
                                  nsCSSAnonBoxes::buttonContent) }
     // Keeping hidden inputs out of here on purpose for so they get frames by
     // display (in practice, none).
   };
 
   nsCOMPtr<nsIFormControl> control = do_QueryInterface(aElement);
   NS_ASSERTION(control, "input doesn't implement nsIFormControl?");
 
-  auto controlType = control->GetType();
+  auto controlType = control->ControlType();
 
   // Note that Android/Gonk widgets don't have theming support and thus
   // appearance:none is the same as any other appearance value.
   // So this chunk doesn't apply there:
 #if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_GONK)
   // radio and checkbox inputs with appearance:none should be constructed
   // by display type.  (Note that we're not checking that appearance is
   // not (respectively) NS_THEME_RADIO and NS_THEME_CHECKBOX.)
--- a/layout/forms/nsColorControlFrame.cpp
+++ b/layout/forms/nsColorControlFrame.cpp
@@ -116,17 +116,17 @@ nsColorControlFrame::AttributeChanged(in
                                       int32_t  aModType)
 {
   NS_ASSERTION(mColorContent, "The color div must exist");
 
   // If the value attribute is set, update the color box, but only if we're
   // still a color control, which might not be the case if the type attribute
   // was removed/changed.
   nsCOMPtr<nsIFormControl> fctrl = do_QueryInterface(GetContent());
-  if (fctrl->GetType() == NS_FORM_INPUT_COLOR &&
+  if (fctrl->ControlType() == NS_FORM_INPUT_COLOR &&
       aNameSpaceID == kNameSpaceID_None && nsGkAtoms::value == aAttribute) {
     UpdateColor();
   }
   return nsHTMLButtonControlFrame::AttributeChanged(aNameSpaceID, aAttribute,
                                                     aModType);
 }
 
 nsContainerFrame*
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -1445,17 +1445,17 @@ nsComboboxControlFrame::SetInitialChildL
                                             nsFrameList&    aChildList)
 {
   if (kSelectPopupList == aListID) {
     mPopupFrames.SetFrames(aChildList);
   } else {
     for (nsFrameList::Enumerator e(aChildList); !e.AtEnd(); e.Next()) {
       nsCOMPtr<nsIFormControl> formControl =
         do_QueryInterface(e.get()->GetContent());
-      if (formControl && formControl->GetType() == NS_FORM_BUTTON_BUTTON) {
+      if (formControl && formControl->ControlType() == NS_FORM_BUTTON_BUTTON) {
         mButtonFrame = e.get();
         break;
       }
     }
     NS_ASSERTION(mButtonFrame, "missing button frame in initial child list");
     nsBlockFrame::SetInitialChildList(aListID, aChildList);
   }
 }
--- a/layout/forms/nsDateTimeControlFrame.cpp
+++ b/layout/forms/nsDateTimeControlFrame.cpp
@@ -378,18 +378,18 @@ nsDateTimeControlFrame::AttributeChanged
   if (aNameSpaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::value ||
         aAttribute == nsGkAtoms::readonly ||
         aAttribute == nsGkAtoms::tabindex) {
       MOZ_ASSERT(mContent->IsHTMLElement(nsGkAtoms::input), "bad cast");
       auto contentAsInputElem = static_cast<dom::HTMLInputElement*>(mContent);
       // If script changed the <input>'s type before setting these attributes
       // then we don't need to do anything since we are going to be reframed.
-      if (contentAsInputElem->GetType() == NS_FORM_INPUT_TIME ||
-          contentAsInputElem->GetType() == NS_FORM_INPUT_DATE) {
+      if (contentAsInputElem->ControlType() == NS_FORM_INPUT_TIME ||
+          contentAsInputElem->ControlType() == NS_FORM_INPUT_DATE) {
         nsCOMPtr<nsIDateTimeInputArea> inputAreaContent =
           do_QueryInterface(mInputAreaContent);
         if (aAttribute == nsGkAtoms::value) {
           if (inputAreaContent) {
             nsContentUtils::AddScriptRunner(NewRunnableMethod(inputAreaContent,
               &nsIDateTimeInputArea::NotifyInputElementValueChanged));
           }
         } else {
--- a/layout/forms/nsGfxButtonControlFrame.cpp
+++ b/layout/forms/nsGfxButtonControlFrame.cpp
@@ -89,17 +89,17 @@ NS_QUERYFRAME_TAIL_INHERITING(nsHTMLButt
 // label from a string bundle as is done for all other UI strings.
 // See bug 16999 for further details.
 nsresult
 nsGfxButtonControlFrame::GetDefaultLabel(nsXPIDLString& aString) const
 {
   nsCOMPtr<nsIFormControl> form = do_QueryInterface(mContent);
   NS_ENSURE_TRUE(form, NS_ERROR_UNEXPECTED);
 
-  int32_t type = form->GetType();
+  int32_t type = form->ControlType();
   const char *prop;
   if (type == NS_FORM_INPUT_RESET) {
     prop = "Reset";
   }
   else if (type == NS_FORM_INPUT_SUBMIT) {
     prop = "Submit";
   }
   else {
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -484,17 +484,17 @@ nsRangeFrame::AccessibleType()
 #endif
 
 double
 nsRangeFrame::GetValueAsFractionOfRange()
 {
   MOZ_ASSERT(mContent->IsHTMLElement(nsGkAtoms::input), "bad cast");
   dom::HTMLInputElement* input = static_cast<dom::HTMLInputElement*>(mContent);
 
-  MOZ_ASSERT(input->GetType() == NS_FORM_INPUT_RANGE);
+  MOZ_ASSERT(input->ControlType() == NS_FORM_INPUT_RANGE);
 
   Decimal value = input->GetValueAsDecimal();
   Decimal minimum = input->GetMinimum();
   Decimal maximum = input->GetMaximum();
 
   MOZ_ASSERT(value.isFinite() && minimum.isFinite() && maximum.isFinite(),
              "type=range should have a default maximum/minimum");
   
@@ -513,17 +513,17 @@ nsRangeFrame::GetValueAtEventPoint(Widge
 {
   MOZ_ASSERT(aEvent->mClass == eMouseEventClass ||
              aEvent->mClass == eTouchEventClass,
              "Unexpected event type - aEvent->mRefPoint may be meaningless");
 
   MOZ_ASSERT(mContent->IsHTMLElement(nsGkAtoms::input), "bad cast");
   dom::HTMLInputElement* input = static_cast<dom::HTMLInputElement*>(mContent);
 
-  MOZ_ASSERT(input->GetType() == NS_FORM_INPUT_RANGE);
+  MOZ_ASSERT(input->ControlType() == NS_FORM_INPUT_RANGE);
 
   Decimal minimum = input->GetMinimum();
   Decimal maximum = input->GetMaximum();
   MOZ_ASSERT(minimum.isFinite() && maximum.isFinite(),
              "type=range should have a default maximum/minimum");
   if (maximum <= minimum) {
     return minimum;
   }
@@ -745,17 +745,18 @@ nsRangeFrame::AttributeChanged(int32_t  
       // SetAttr(..., nsGkAtoms::value, ...) call in HTMLInputElement::
       // HandleTypeChange. In that case the HTMLInputElement's type will
       // already have changed, and if we call UpdateForValueChange()
       // we'll fail the asserts under that call that check the type of our
       // HTMLInputElement. Given that we're changing away from being a range
       // and this frame will shortly be destroyed, there's no point in calling
       // UpdateForValueChange() anyway.
       MOZ_ASSERT(mContent->IsHTMLElement(nsGkAtoms::input), "bad cast");
-      bool typeIsRange = static_cast<dom::HTMLInputElement*>(mContent)->GetType() ==
+      bool typeIsRange =
+        static_cast<dom::HTMLInputElement*>(mContent)->ControlType() ==
                            NS_FORM_INPUT_RANGE;
       // If script changed the <input>'s type before setting these attributes
       // then we don't need to do anything since we are going to be reframed.
       if (typeIsRange) {
         UpdateForValueChange();
       }
     } else if (aAttribute == nsGkAtoms::orient) {
       PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eResize,
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -735,18 +735,19 @@ nsFormFillController::StartSearch(const 
                                   nsIAutoCompleteResult *aPreviousResult, nsIAutoCompleteObserver *aListener)
 {
   nsresult rv;
   nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(mFocusedInputNode);
 
   // If the login manager has indicated it's responsible for this field, let it
   // handle the autocomplete. Otherwise, handle with form history.
   // This method is sometimes called in unit tests and from XUL without a focused node.
-  if (mFocusedInputNode && (mPwmgrInputs.Get(mFocusedInputNode) ||
-                            formControl->GetType() == NS_FORM_INPUT_PASSWORD)) {
+  if (mFocusedInputNode &&
+      (mPwmgrInputs.Get(mFocusedInputNode) ||
+       formControl->ControlType() == NS_FORM_INPUT_PASSWORD)) {
 
     // Handle the case where a password field is focused but
     // MarkAsLoginManagerField wasn't called because password manager is disabled.
     if (!mLoginManager) {
       mLoginManager = do_GetService("@mozilla.org/login-manager;1");
     }
 
     if (NS_WARN_IF(!mLoginManager)) {
@@ -1028,32 +1029,32 @@ nsFormFillController::MaybeStartControll
   bool autocomplete = nsContentUtils::IsAutocompleteEnabled(aInput);
 
   nsCOMPtr<nsIDOMHTMLElement> datalist;
   aInput->GetList(getter_AddRefs(datalist));
   bool hasList = datalist != nullptr;
 
   bool isPwmgrInput = false;
   if (mPwmgrInputs.Get(inputNode) ||
-      formControl->GetType() == NS_FORM_INPUT_PASSWORD) {
+      formControl->ControlType() == NS_FORM_INPUT_PASSWORD) {
     isPwmgrInput = true;
   }
 
   if (isPwmgrInput || hasList || autocomplete) {
     StartControllingInput(aInput);
   }
 }
 
 void
 nsFormFillController::FocusEventDelayedCallback(nsIFormControl* aFormControl)
 {
   nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(mFocusedInputNode);
 
   if (!formControl || formControl != aFormControl ||
-      formControl->GetType() != NS_FORM_INPUT_PASSWORD) {
+      formControl->ControlType() != NS_FORM_INPUT_PASSWORD) {
     return;
   }
 
   // If we have not seen a context menu call yet, just show the popup.
   if (mLastContextMenuEventTimeStamp.IsNull()) {
    ShowPopup();
    return;
   }