Bug 1439751 - Remove all members from nsIDOMHTMLInputElement. r?qdot draft
authorAdrian Wielgosik <adrian.wielgosik@gmail.com>
Tue, 20 Feb 2018 23:10:44 +0100
changeset 757964 d22940dcef43957dca515e1f96ff929531f34ff5
parent 757574 861067332bac96a44bbf41ef366f58a30476057b
child 757965 4d1eaec5ca2f0007b494db920a73d0e0110074f3
push id99901
push userbmo:adrian.wielgosik@gmail.com
push dateWed, 21 Feb 2018 17:42:18 +0000
reviewersqdot
bugs1439751
milestone60.0a1
Bug 1439751 - Remove all members from nsIDOMHTMLInputElement. r?qdot MozReview-Commit-ID: JVagEzvSONN
docshell/base/nsDocShellTreeOwner.cpp
dom/base/nsContentUtils.cpp
dom/base/nsContentUtils.h
dom/base/nsDocument.cpp
dom/base/nsWindowRoot.cpp
dom/html/HTMLFormElement.cpp
dom/html/HTMLInputElement.cpp
dom/html/HTMLInputElement.h
dom/html/nsTextEditorState.cpp
dom/interfaces/html/nsIDOMHTMLInputElement.idl
dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
dom/xbl/nsXBLPrototypeHandler.cpp
editor/libeditor/HTMLEditorDataTransfer.cpp
layout/forms/nsCheckboxRadioFrame.cpp
layout/forms/nsDateTimeControlFrame.cpp
layout/forms/nsGfxButtonControlFrame.cpp
widget/android/nsNativeThemeAndroid.cpp
widget/gtk/nsNativeThemeGTK.cpp
widget/nsNativeTheme.cpp
widget/windows/nsNativeThemeWin.cpp
--- a/docshell/base/nsDocShellTreeOwner.cpp
+++ b/docshell/base/nsDocShellTreeOwner.cpp
@@ -30,17 +30,16 @@
 #include "nsIDOMElement.h"
 #include "Link.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/SVGTitleElement.h"
 #include "nsIDOMEvent.h"
 #include "nsIDOMFileList.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIFormControl.h"
-#include "nsIDOMHTMLInputElement.h"
 #include "nsIImageLoadingContent.h"
 #include "nsIWebNavigation.h"
 #include "nsIPresShell.h"
 #include "nsIStringBundle.h"
 #include "nsPIDOMWindow.h"
 #include "nsPIWindowRoot.h"
 #include "nsIDOMWindowCollection.h"
 #include "nsIWindowWatcher.h"
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -130,17 +130,16 @@
 #include "nsIDocShellTreeOwner.h"
 #include "nsIDocument.h"
 #include "nsIDocumentEncoder.h"
 #include "nsIDOMChromeWindow.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentType.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMHTMLFormElement.h"
-#include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMWindowUtils.h"
 #include "nsIDragService.h"
 #include "nsIFormControl.h"
 #include "nsIForm.h"
 #include "nsIFragmentContentSink.h"
 #include "nsContainerFrame.h"
@@ -1051,26 +1050,25 @@ nsContentUtils::Atob(const nsAString& aA
 
   if (NS_FAILED(rv) && rv == NS_ERROR_INVALID_ARG) {
     return NS_ERROR_DOM_INVALID_CHARACTER_ERR;
   }
   return rv;
 }
 
 bool
-nsContentUtils::IsAutocompleteEnabled(nsIDOMHTMLInputElement* aInput)
+nsContentUtils::IsAutocompleteEnabled(mozilla::dom::HTMLInputElement* aInput)
 {
   NS_PRECONDITION(aInput, "aInput should not be null!");
 
   nsAutoString autocomplete;
   aInput->GetAutocomplete(autocomplete);
 
   if (autocomplete.IsEmpty()) {
-    nsCOMPtr<nsIDOMHTMLFormElement> form;
-    aInput->GetForm(getter_AddRefs(form));
+    auto* form = aInput->GetForm();
     if (!form) {
       return true;
     }
 
     form->GetAutocomplete(autocomplete);
   }
 
   return !autocomplete.EqualsLiteral("off");
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -68,17 +68,16 @@ class nsIConsoleService;
 class nsIContent;
 class nsIContentPolicy;
 class nsIContentSecurityPolicy;
 class nsIDocShellTreeItem;
 class nsIDocumentLoaderFactory;
 class nsIDOMDocument;
 class nsIDOMDocumentFragment;
 class nsIDOMEvent;
-class nsIDOMHTMLInputElement;
 class nsIDOMNode;
 class nsIDragSession;
 class nsIEventTarget;
 class nsIFragmentContentSink;
 class nsIFrame;
 class nsIImageLoadingContent;
 class nsIInterfaceRequestor;
 class nsIIOService;
@@ -130,16 +129,17 @@ class ErrorResult;
 class EventListenerManager;
 class HTMLEditor;
 
 namespace dom {
 struct CustomElementDefinition;
 class DocumentFragment;
 class Element;
 class EventTarget;
+class HTMLInputElement;
 class IPCDataTransfer;
 class IPCDataTransferItem;
 struct LifecycleCallbackArgs;
 struct LifecycleAdoptedCallbackArgs;
 class NodeInfo;
 class nsIContentChild;
 class nsIContentParent;
 class TabChild;
@@ -2621,17 +2621,17 @@ public:
    * Returns whether the input element passed in parameter has the autocomplete
    * functionality enabled. It is taking into account the form owner.
    * NOTE: the caller has to make sure autocomplete makes sense for the
    * element's type.
    *
    * @param aInput the input element to check. NOTE: aInput can't be null.
    * @return whether the input element has autocomplete enabled.
    */
-  static bool IsAutocompleteEnabled(nsIDOMHTMLInputElement* aInput);
+  static bool IsAutocompleteEnabled(mozilla::dom::HTMLInputElement* aInput);
 
   enum AutocompleteAttrState : uint8_t
   {
     eAutocompleteAttrState_Unknown = 1,
     eAutocompleteAttrState_Invalid,
     eAutocompleteAttrState_Valid,
   };
   /**
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -110,17 +110,16 @@
 #include "NullPrincipal.h"
 
 #include "nsIDOMWindow.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMElement.h"
 #include "nsFocusManager.h"
 
 // for radio group stuff
-#include "nsIDOMHTMLInputElement.h"
 #include "nsIRadioVisitor.h"
 #include "nsIFormControl.h"
 
 #include "nsBidiUtils.h"
 
 #include "nsContentCreatorFunctions.h"
 
 #include "nsIScriptContext.h"
--- a/dom/base/nsWindowRoot.cpp
+++ b/dom/base/nsWindowRoot.cpp
@@ -13,23 +13,23 @@
 #include "nsPIDOMWindow.h"
 #include "nsPresContext.h"
 #include "nsLayoutCID.h"
 #include "nsContentCID.h"
 #include "nsString.h"
 #include "nsGlobalWindow.h"
 #include "nsFocusManager.h"
 #include "nsIContent.h"
-#include "nsIDOMHTMLInputElement.h"
 #include "nsIControllers.h"
 #include "nsIController.h"
 #include "xpcpublic.h"
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/dom/TabParent.h"
 #include "mozilla/dom/HTMLTextAreaElement.h"
+#include "mozilla/dom/HTMLInputElement.h"
 
 #ifdef MOZ_XUL
 #include "nsXULElement.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
@@ -233,18 +233,18 @@ nsWindowRoot::GetControllers(bool aForVi
     }
 #endif
 
     HTMLTextAreaElement* htmlTextArea =
       HTMLTextAreaElement::FromContent(focusedContent);
     if (htmlTextArea)
       return htmlTextArea->GetControllers(aResult);
 
-    nsCOMPtr<nsIDOMHTMLInputElement> htmlInputElement =
-      do_QueryInterface(focusedContent);
+    HTMLInputElement* htmlInputElement =
+      HTMLInputElement::FromContent(focusedContent);
     if (htmlInputElement)
       return htmlInputElement->GetControllers(aResult);
 
     if (focusedContent->IsEditable() && focusedWindow)
       return focusedWindow->GetControllers(aResult);
   }
   else {
     return focusedWindow->GetControllers(aResult);
--- a/dom/html/HTMLFormElement.cpp
+++ b/dom/html/HTMLFormElement.cpp
@@ -1632,17 +1632,17 @@ HTMLFormElement::GetActionURL(nsIURI** a
   if (aOriginatingElement &&
       aOriginatingElement->HasAttr(kNameSpaceID_None, nsGkAtoms::formaction)) {
 #ifdef DEBUG
     nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(aOriginatingElement);
     NS_ASSERTION(formControl && formControl->IsSubmitControl(),
                  "The originating element must be a submit form control!");
 #endif // DEBUG
 
-    nsCOMPtr<nsIDOMHTMLInputElement> inputElement = do_QueryInterface(aOriginatingElement);
+    HTMLInputElement* inputElement = HTMLInputElement::FromContent(aOriginatingElement);
     if (inputElement) {
       inputElement->GetFormAction(action);
     } else {
       auto buttonElement = HTMLButtonElement::FromContent(aOriginatingElement);
       if (buttonElement) {
         buttonElement->GetFormAction(action);
       } else {
         NS_ERROR("Originating element must be an input or button element!");
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -1543,42 +1543,29 @@ HTMLInputElement::AfterClearForm(bool aU
 
   // Do not add back to radio group if we are releasing or unbinding from tree.
   if (mType == NS_FORM_INPUT_RADIO && !aUnbindOrDelete) {
     AddedToRadioGroup();
     UpdateValueMissingValidityStateForRadio(false);
   }
 }
 
-// nsIDOMHTMLInputElement
-
-NS_IMETHODIMP
-HTMLInputElement::GetForm(nsIDOMHTMLFormElement** aForm)
-{
-  return nsGenericHTMLFormElementWithState::GetForm(aForm);
-}
-
-NS_IMPL_ACTION_ATTR(HTMLInputElement, FormAction, formaction)
-NS_IMPL_STRING_ATTR(HTMLInputElement, Name, name)
-NS_IMPL_BOOL_ATTR(HTMLInputElement, ReadOnly, readonly)
-
-NS_IMETHODIMP
+void
 HTMLInputElement::GetAutocomplete(nsAString& aValue)
 {
   if (!DoesAutocompleteApply()) {
-    return NS_OK;
+    return;
   }
 
   aValue.Truncate();
   const nsAttrValue* attributeVal = GetParsedAttr(nsGkAtoms::autocomplete);
 
   mAutocompleteAttrState =
     nsContentUtils::SerializeAutocompleteAttribute(attributeVal, aValue,
                                                    mAutocompleteAttrState);
-  return NS_OK;
 }
 
 void
 HTMLInputElement::GetAutocompleteInfo(Nullable<AutocompleteInfo>& aInfo)
 {
   if (!DoesAutocompleteApply()) {
     aInfo.SetNull();
     return;
@@ -1625,44 +1612,36 @@ uint32_t
 HTMLInputElement::Height()
 {
   if (mType != NS_FORM_INPUT_IMAGE) {
     return 0;
   }
   return GetWidthHeightForImage(mCurrentRequest).height;
 }
 
-NS_IMETHODIMP
-HTMLInputElement::GetIndeterminate(bool* aValue)
-{
-  *aValue = Indeterminate();
-  return NS_OK;
-}
-
 void
 HTMLInputElement::SetIndeterminateInternal(bool aValue,
                                            bool aShouldInvalidate)
 {
   mIndeterminate = aValue;
 
   if (aShouldInvalidate) {
     // Repaint the frame
     nsIFrame* frame = GetPrimaryFrame();
     if (frame)
       frame->InvalidateFrameSubtree();
   }
 
   UpdateState(true);
 }
 
-NS_IMETHODIMP
+void
 HTMLInputElement::SetIndeterminate(bool aValue)
 {
   SetIndeterminateInternal(aValue, true);
-  return NS_OK;
 }
 
 uint32_t
 HTMLInputElement::Width()
 {
   if (mType != NS_FORM_INPUT_IMAGE) {
     return 0;
   }
@@ -3105,23 +3084,16 @@ HTMLInputElement::SetValueChanged(bool a
 
   if (valueChangedBefore != aValueChanged) {
     UpdateState(true);
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
-HTMLInputElement::GetChecked(bool* aChecked)
-{
-  *aChecked = Checked();
-  return NS_OK;
-}
-
 void
 HTMLInputElement::SetCheckedChanged(bool aCheckedChanged)
 {
   DoSetCheckedChanged(aCheckedChanged, true);
 }
 
 void
 HTMLInputElement::DoSetCheckedChanged(bool aCheckedChanged,
@@ -3147,21 +3119,20 @@ HTMLInputElement::SetCheckedChangedInter
 
   // This method can't be called when we are not authorized to notify
   // so we do not need a aNotify parameter.
   if (checkedChangedBefore != aCheckedChanged) {
     UpdateState(true);
   }
 }
 
-NS_IMETHODIMP
+void
 HTMLInputElement::SetChecked(bool aChecked)
 {
   DoSetChecked(aChecked, true, true);
-  return NS_OK;
 }
 
 void
 HTMLInputElement::DoSetChecked(bool aChecked, bool aNotify,
                                bool aSetValueChanged)
 {
   // If the user or JS attempts to set checked, whether it actually changes the
   // value or not, we say the value was changed so that defaultValue don't
@@ -3623,17 +3594,17 @@ HTMLInputElement::GetEventTargetParent(E
       case NS_FORM_INPUT_CHECKBOX:
         {
           if (mIndeterminate) {
             // indeterminate is always set to FALSE when the checkbox is toggled
             SetIndeterminateInternal(false, false);
             aVisitor.mItemFlags |= NS_ORIGINAL_INDETERMINATE_VALUE;
           }
 
-          GetChecked(&originalCheckedValue);
+          originalCheckedValue = Checked();
           DoSetChecked(!originalCheckedValue, true, true);
           mCheckedIsToggled = true;
         }
         break;
 
       case NS_FORM_INPUT_RADIO:
         {
           nsCOMPtr<nsIDOMHTMLInputElement> selectedRadioButton = GetSelectedRadioButton();
@@ -4266,18 +4237,19 @@ HTMLInputElement::PostHandleEvent(EventC
 
   // now check to see if the event was "cancelled"
   if (mCheckedIsToggled && outerActivateEvent) {
     if (aVisitor.mEventStatus == nsEventStatus_eConsumeNoDefault) {
       // if it was cancelled and a radio button, then set the old
       // selected btn to TRUE. if it is a checkbox then set it to its
       // original value
       if (oldType == NS_FORM_INPUT_RADIO) {
-        nsCOMPtr<nsIDOMHTMLInputElement> selectedRadioButton =
-          do_QueryInterface(aVisitor.mItemData);
+        nsCOMPtr<nsIContent> content = do_QueryInterface(aVisitor.mItemData);
+        HTMLInputElement* selectedRadioButton =
+          HTMLInputElement::FromContentOrNull(content);
         if (selectedRadioButton) {
           selectedRadioButton->SetChecked(true);
         }
         // If there was no checked radio button or this one is no longer a
         // radio button we must reset it back to false to cancel the action.
         // See how the web of hack grows?
         if (!selectedRadioButton || mType != NS_FORM_INPUT_RADIO) {
           DoSetChecked(false, true, true);
@@ -4301,18 +4273,19 @@ HTMLInputElement::PostHandleEvent(EventC
       // Fire an event to notify accessibility
       if (mType == NS_FORM_INPUT_CHECKBOX) {
         FireEventForAccessibility(this, aVisitor.mPresContext,
                                   eFormCheckboxStateChange);
       } else {
         FireEventForAccessibility(this, aVisitor.mPresContext,
                                   eFormRadioStateChange);
         // Fire event for the previous selected radio.
-        nsCOMPtr<nsIDOMHTMLInputElement> previous =
-          do_QueryInterface(aVisitor.mItemData);
+        nsCOMPtr<nsIContent> content = do_QueryInterface(aVisitor.mItemData);
+        HTMLInputElement* previous =
+          HTMLInputElement::FromContentOrNull(content);
         if (previous) {
           FireEventForAccessibility(previous, aVisitor.mPresContext,
                                     eFormRadioStateChange);
         }
       }
 #endif
     }
   }
@@ -6017,17 +5990,17 @@ HTMLInputElement::GetControllers(ErrorRe
 
       mControllers->AppendController(controller);
     }
   }
 
   return mControllers;
 }
 
-NS_IMETHODIMP
+nsresult
 HTMLInputElement::GetControllers(nsIControllers** aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
   ErrorResult rv;
   RefPtr<nsIControllers> controller = GetControllers(rv);
   controller.forget(aResult);
   return rv.StealNSResult();
--- a/dom/html/HTMLInputElement.h
+++ b/dom/html/HTMLInputElement.h
@@ -477,17 +477,17 @@ public:
   {
     GetHTMLAttr(nsGkAtoms::alt, aValue);
   }
   void SetAlt(const nsAString& aValue, ErrorResult& aRv)
   {
     SetHTMLAttr(nsGkAtoms::alt, aValue, aRv);
   }
 
-  // XPCOM GetAutocomplete() is OK
+  void GetAutocomplete(nsAString& aValue);
   void SetAutocomplete(const nsAString& aValue, ErrorResult& aRv)
   {
     SetHTMLAttr(nsGkAtoms::autocomplete, aValue, aRv);
   }
 
   void GetAutocompleteInfo(Nullable<AutocompleteInfo>& aInfo);
 
   bool Autofocus() const
@@ -509,34 +509,31 @@ public:
   {
     SetHTMLBoolAttr(nsGkAtoms::checked, aValue, aRv);
   }
 
   bool Checked() const
   {
     return mChecked;
   }
-  // XPCOM SetChecked() is OK
+  void SetChecked(bool aChecked);
 
   bool Disabled() const
   {
     return GetBoolAttr(nsGkAtoms::disabled);
   }
 
   void SetDisabled(bool aValue, ErrorResult& aRv)
   {
     SetHTMLBoolAttr(nsGkAtoms::disabled, aValue, aRv);
   }
 
-  // XPCOM GetForm() is OK
-
   FileList* GetFiles();
   void SetFiles(FileList* aFiles);
 
-  // XPCOM GetFormAction() is OK
   void SetFormAction(const nsAString& aValue, ErrorResult& aRv)
   {
     SetHTMLAttr(nsGkAtoms::formaction, aValue, aRv);
   }
 
   void GetFormEnctype(nsAString& aValue);
   void SetFormEnctype(const nsAString& aValue, ErrorResult& aRv)
   {
@@ -579,18 +576,17 @@ public:
   {
     return mIndeterminate;
   }
 
   bool IsDraggingRange() const
   {
     return mIsDraggingRange;
   }
-
-  // XPCOM SetIndeterminate() is OK
+  void SetIndeterminate(bool aValue);
 
   void GetInputMode(nsAString& aValue);
   void SetInputMode(const nsAString& aValue, ErrorResult& aRv)
   {
     SetHTMLAttr(nsGkAtoms::inputmode, aValue, aRv);
   }
 
   nsGenericHTMLElement* GetList() const;
@@ -650,17 +646,20 @@ public:
     return GetBoolAttr(nsGkAtoms::multiple);
   }
 
   void SetMultiple(bool aValue, ErrorResult& aRv)
   {
     SetHTMLBoolAttr(nsGkAtoms::multiple, aValue, aRv);
   }
 
-  // XPCOM GetName() is OK
+  void GetName(nsAString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::name, aValue);
+  }
   void SetName(const nsAString& aValue, ErrorResult& aRv)
   {
     SetHTMLAttr(nsGkAtoms::name, aValue, aRv);
   }
 
   void GetPattern(nsAString& aValue)
   {
     GetHTMLAttr(nsGkAtoms::pattern, aValue);
@@ -855,16 +854,18 @@ public:
     GetHTMLAttr(nsGkAtoms::usemap, aValue);
   }
   void SetUseMap(const nsAString& aValue, ErrorResult& aRv)
   {
     SetHTMLAttr(nsGkAtoms::usemap, aValue, aRv);
   }
 
   nsIControllers* GetControllers(ErrorResult& aRv);
+  // XPCOM adapter function widely used throughout code, leaving it as is.
+  nsresult GetControllers(nsIControllers** aResult);
 
   int32_t InputTextLength(CallerType aCallerType);
 
   void MozGetFileNameArray(nsTArray<nsString>& aFileNames, ErrorResult& aRv);
 
   void MozSetFileNameArray(const Sequence< nsString >& aFileNames, ErrorResult& aRv);
   void MozSetFileArray(const Sequence<OwningNonNull<File>>& aFiles);
   void MozSetDirectory(const nsAString& aDirectoryPath, ErrorResult& aRv);
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -14,17 +14,16 @@
 #include "nsEditorCID.h"
 #include "nsLayoutCID.h"
 #include "nsITextControlFrame.h"
 #include "nsIDOMCharacterData.h"
 #include "nsIDOMDocument.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsTextControlFrame.h"
 #include "nsIControllers.h"
-#include "nsIDOMHTMLInputElement.h"
 #include "nsITransactionManager.h"
 #include "nsIControllerContext.h"
 #include "nsAttrValue.h"
 #include "nsAttrValueInlines.h"
 #include "nsGenericHTMLElement.h"
 #include "nsIDOMEventListener.h"
 #include "nsIEditorObserver.h"
 #include "nsIWidget.h"
@@ -879,17 +878,17 @@ TextInputListener::OnSelectionChange(Sel
 
 static void
 DoCommandCallback(Command aCommand, void* aData)
 {
   nsTextControlFrame *frame = static_cast<nsTextControlFrame*>(aData);
   nsIContent *content = frame->GetContent();
 
   nsCOMPtr<nsIControllers> controllers;
-  nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(content);
+  HTMLInputElement* input = HTMLInputElement::FromContent(content);
   if (input) {
     input->GetControllers(getter_AddRefs(controllers));
   } else {
     HTMLTextAreaElement* textArea =
       HTMLTextAreaElement::FromContent(content);
 
     if (textArea) {
       textArea->GetControllers(getter_AddRefs(controllers));
@@ -1409,22 +1408,22 @@ nsTextEditorState::PrepareEditor(const n
                              defaultValue);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   // Initialize the controller for the editor
 
   if (!SuppressEventHandlers(presContext)) {
     nsCOMPtr<nsIControllers> controllers;
-    nsCOMPtr<nsIDOMHTMLInputElement> inputElement =
-      do_QueryInterface(mTextCtrlElement);
+    nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
+    HTMLInputElement* inputElement =
+      HTMLInputElement::FromContentOrNull(content);
     if (inputElement) {
       rv = inputElement->GetControllers(getter_AddRefs(controllers));
     } else {
-      nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
       HTMLTextAreaElement* textAreaElement =
         HTMLTextAreaElement::FromContentOrNull(content);
 
       if (!textAreaElement)
         return NS_ERROR_FAILURE;
 
       rv = textAreaElement->GetControllers(getter_AddRefs(controllers));
     }
@@ -2068,23 +2067,23 @@ nsTextEditorState::UnbindFromFrame(nsTex
 
   // Destroy our editor
   DestroyEditor();
 
   // Clean up the controller
   if (!SuppressEventHandlers(mBoundFrame->PresContext()))
   {
     nsCOMPtr<nsIControllers> controllers;
-    nsCOMPtr<nsIDOMHTMLInputElement> inputElement =
-      do_QueryInterface(mTextCtrlElement);
+    nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
+    HTMLInputElement* inputElement =
+      HTMLInputElement::FromContentOrNull(content);
     if (inputElement)
       inputElement->GetControllers(getter_AddRefs(controllers));
     else
     {
-      nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
       HTMLTextAreaElement* textAreaElement =
         HTMLTextAreaElement::FromContentOrNull(content);
       if (textAreaElement) {
         textAreaElement->GetControllers(getter_AddRefs(controllers));
       }
     }
 
     if (controllers)
--- a/dom/interfaces/html/nsIDOMHTMLInputElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLInputElement.idl
@@ -18,21 +18,9 @@ interface nsIDOMHTMLFormElement;
   *
   * with changes from the work-in-progress WHATWG HTML specification:
   * http://www.whatwg.org/specs/web-apps/current-work/
   */
 
 [uuid(64aeda0b-e9b5-4868-a4f9-e4776e32e733)]
 interface nsIDOMHTMLInputElement : nsISupports
 {
-  readonly attribute DOMString             autocomplete;
-           attribute boolean               checked;
-  readonly attribute nsIDOMHTMLFormElement form;
-           attribute DOMString             formAction;
-
-           attribute boolean               indeterminate;
-
-           attribute DOMString             name;
-
-           attribute boolean               readOnly;
-
-  readonly attribute nsIControllers        controllers;
 };
--- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
+++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp
@@ -25,17 +25,16 @@
 #include "nsContentCID.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsDOMAttributeMap.h"
 #include "nsFrameLoader.h"
 #include "nsIComponentRegistrar.h"
 #include "nsIContent.h"
 #include "nsIDOMComment.h"
 #include "nsIDOMDocument.h"
-#include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMProcessingInstruction.h"
 #include "nsIDOMWindowUtils.h"
 #include "nsIDocShell.h"
 #include "nsIDocument.h"
 #include "nsIDocumentEncoder.h"
 #include "nsILoadContext.h"
@@ -559,17 +558,17 @@ ResourceReader::OnWalkDOMNode(nsIDOMNode
         return OnWalkSubframe(aNode);
     }
 
     if (content->IsHTMLElement(nsGkAtoms::iframe) &&
         !(mPersistFlags & IWBP::PERSIST_FLAGS_IGNORE_IFRAMES)) {
         return OnWalkSubframe(aNode);
     }
 
-    nsCOMPtr<nsIDOMHTMLInputElement> nodeAsInput = do_QueryInterface(aNode);
+    auto nodeAsInput = dom::HTMLInputElement::FromContent(content);
     if (nodeAsInput) {
         return OnWalkAttribute(aNode, "src");
     }
 
     return NS_OK;
 }
 
 // Helper class for node rewriting in writeContent().
--- a/dom/xbl/nsXBLPrototypeHandler.cpp
+++ b/dom/xbl/nsXBLPrototypeHandler.cpp
@@ -17,17 +17,16 @@
 #include "nsAtom.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsNameSpaceManager.h"
 #include "nsIDocument.h"
 #include "nsIController.h"
 #include "nsIControllers.h"
 #include "nsXULElement.h"
 #include "nsIURI.h"
-#include "nsIDOMHTMLInputElement.h"
 #include "nsFocusManager.h"
 #include "nsIFormControl.h"
 #include "nsIDOMEventListener.h"
 #include "nsPIDOMWindow.h"
 #include "nsPIWindowRoot.h"
 #include "nsIDOMWindow.h"
 #include "nsIServiceManager.h"
 #include "nsIScriptError.h"
@@ -43,16 +42,17 @@
 #include "nsXBLSerialize.h"
 #include "nsJSUtils.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/JSEventHandler.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/EventHandlerBinding.h"
+#include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/HTMLTextAreaElement.h"
 #include "mozilla/dom/KeyboardEvent.h"
 #include "mozilla/dom/KeyboardEventBinding.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/layers/KeyboardMap.h"
 #include "xpcpublic.h"
 
 using namespace mozilla;
@@ -677,17 +677,17 @@ nsXBLPrototypeHandler::GetController(Eve
 
   if (!controllers) {
     HTMLTextAreaElement* htmlTextArea = HTMLTextAreaElement::FromContent(targetContent);
     if (htmlTextArea)
       htmlTextArea->GetControllers(getter_AddRefs(controllers));
   }
 
   if (!controllers) {
-    nsCOMPtr<nsIDOMHTMLInputElement> htmlInputElement(do_QueryInterface(aTarget));
+    HTMLInputElement* htmlInputElement = HTMLInputElement::FromContent(targetContent);
     if (htmlInputElement)
       htmlInputElement->GetControllers(getter_AddRefs(controllers));
   }
 
   if (!controllers) {
     nsCOMPtr<nsPIDOMWindowOuter> domWindow(do_QueryInterface(aTarget));
     if (domWindow) {
       domWindow->GetControllers(getter_AddRefs(controllers));
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -37,17 +37,16 @@
 #include "nsError.h"
 #include "nsGkAtoms.h"
 #include "nsIClipboard.h"
 #include "nsIContent.h"
 #include "nsIDOMComment.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentFragment.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMNode.h"
 #include "nsIDocument.h"
 #include "nsIFile.h"
 #include "nsIInputStream.h"
 #include "nsIMIMEService.h"
 #include "nsNameSpaceManager.h"
 #include "nsINode.h"
 #include "nsIParserUtils.h"
--- a/layout/forms/nsCheckboxRadioFrame.cpp
+++ b/layout/forms/nsCheckboxRadioFrame.cpp
@@ -3,24 +3,25 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsCheckboxRadioFrame.h"
 
 #include "nsGkAtoms.h"
 #include "nsLayoutUtils.h"
-#include "nsIDOMHTMLInputElement.h"
+#include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/LookAndFeel.h"
 #include "nsDeviceContext.h"
 #include "nsIContent.h"
 #include "nsThemeConstants.h"
 
 using namespace mozilla;
+using mozilla::dom::HTMLInputElement;
 
 //#define FCF_NOISY
 
 nsCheckboxRadioFrame*
 NS_NewCheckboxRadioFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
   return new (aPresShell) nsCheckboxRadioFrame(aContext);
 }
@@ -190,19 +191,19 @@ nsCheckboxRadioFrame::HandleEvent(nsPres
     return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
   }
   return NS_OK;
 }
 
 void
 nsCheckboxRadioFrame::GetCurrentCheckState(bool* aState)
 {
-  nsCOMPtr<nsIDOMHTMLInputElement> inputElement = do_QueryInterface(mContent);
+  HTMLInputElement* inputElement = HTMLInputElement::FromContent(mContent);
   if (inputElement) {
-    inputElement->GetChecked(aState);
+    *aState = inputElement->Checked();
   }
 }
 
 nsresult
 nsCheckboxRadioFrame::SetFormProperty(nsAtom* aName, const nsAString& aValue)
 {
   return NS_OK;
 }
--- a/layout/forms/nsDateTimeControlFrame.cpp
+++ b/layout/forms/nsDateTimeControlFrame.cpp
@@ -16,17 +16,16 @@
 #include "nsGkAtoms.h"
 #include "nsContentUtils.h"
 #include "nsContentCreatorFunctions.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/MutationEventBinding.h"
 #include "nsNodeInfoManager.h"
 #include "nsIDateTimeInputArea.h"
 #include "nsIObserverService.h"
-#include "nsIDOMHTMLInputElement.h"
 #include "jsapi.h"
 #include "nsJSUtils.h"
 #include "nsThreadUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 nsIFrame*
--- a/layout/forms/nsGfxButtonControlFrame.cpp
+++ b/layout/forms/nsGfxButtonControlFrame.cpp
@@ -6,17 +6,16 @@
 
 #include "nsGfxButtonControlFrame.h"
 #include "nsIFormControl.h"
 #include "nsGkAtoms.h"
 #include "mozilla/StyleSetHandle.h"
 #include "mozilla/StyleSetHandleInlines.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "nsContentUtils.h"
-#include "nsIDOMHTMLInputElement.h"
 #include "nsTextNode.h"
 
 using namespace mozilla;
 
 nsGfxButtonControlFrame::nsGfxButtonControlFrame(nsStyleContext* aContext)
   : nsHTMLButtonControlFrame(aContext, kClassID)
 {
 }
--- a/widget/android/nsNativeThemeAndroid.cpp
+++ b/widget/android/nsNativeThemeAndroid.cpp
@@ -1,15 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsNativeThemeAndroid.h"
 
-#include "nsIDOMHTMLInputElement.h"
 #include "nsIFrame.h"
 #include "nsThemeConstants.h"
 #include "AndroidColors.h"
 #include "nsCSSRendering.h"
 #include "PathHelpers.h"
 
 NS_IMPL_ISUPPORTS_INHERITED(nsNativeThemeAndroid, nsNativeTheme, nsITheme)
 
--- a/widget/gtk/nsNativeThemeGTK.cpp
+++ b/widget/gtk/nsNativeThemeGTK.cpp
@@ -15,20 +15,20 @@
 #include "nsIPresShell.h"
 #include "nsIContent.h"
 #include "nsViewManager.h"
 #include "nsNameSpaceManager.h"
 #include "nsGfxCIID.h"
 #include "nsTransform2D.h"
 #include "nsMenuFrame.h"
 #include "prlink.h"
-#include "nsIDOMHTMLInputElement.h"
 #include "nsGkAtoms.h"
 #include "nsAttrValueInlines.h"
 
+#include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/Services.h"
 
 #include <gdk/gdkprivate.h>
 #include <gtk/gtk.h>
 #include <gtk/gtkx.h>
 
 #include "gfxContext.h"
@@ -49,16 +49,17 @@
 #endif
 
 #include <algorithm>
 #include <dlfcn.h>
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::widget;
+using mozilla::dom::HTMLInputElement;
 
 NS_IMPL_ISUPPORTS_INHERITED(nsNativeThemeGTK, nsNativeTheme, nsITheme,
                                                              nsIObserver)
 
 static int gLastGdkError;
 
 // Return scale factor of the monitor where the window is located
 // by the most part or layout.css.devPixelsPerPx pref if set to > 0.
@@ -241,24 +242,20 @@ nsNativeThemeGTK::GetGtkWidgetAndState(u
             atom = (aWidgetType == NS_THEME_CHECKBOX ||
                     aWidgetType == NS_THEME_CHECKBOX_LABEL) ? nsGkAtoms::checked
                                                             : nsGkAtoms::selected;
           }
           *aWidgetFlags = CheckBooleanAttr(aFrame, atom);
         }
       } else {
         if (aWidgetFlags) {
-          nsCOMPtr<nsIDOMHTMLInputElement> inputElt(do_QueryInterface(aFrame->GetContent()));
           *aWidgetFlags = 0;
-          if (inputElt) {
-            bool isHTMLChecked;
-            inputElt->GetChecked(&isHTMLChecked);
-            if (isHTMLChecked)
-              *aWidgetFlags |= MOZ_GTK_WIDGET_CHECKED;
-          }
+          HTMLInputElement* inputElt = HTMLInputElement::FromContent(aFrame->GetContent());
+          if (inputElt && inputElt->Checked())
+            *aWidgetFlags |= MOZ_GTK_WIDGET_CHECKED;
 
           if (GetIndeterminate(aFrame))
             *aWidgetFlags |= MOZ_GTK_WIDGET_INCONSISTENT;
         }
       }
     } else if (aWidgetType == NS_THEME_TOOLBARBUTTON_DROPDOWN ||
                aWidgetType == NS_THEME_TREEHEADERSORTARROW ||
                aWidgetType == NS_THEME_BUTTON_ARROW_PREVIOUS ||
--- a/widget/nsNativeTheme.cpp
+++ b/widget/nsNativeTheme.cpp
@@ -8,29 +8,29 @@
 #include "nsIDocument.h"
 #include "nsIContent.h"
 #include "nsIFrame.h"
 #include "nsIPresShell.h"
 #include "nsNumberControlFrame.h"
 #include "nsPresContext.h"
 #include "nsString.h"
 #include "nsNameSpaceManager.h"
-#include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMXULMenuListElement.h"
 #include "nsThemeConstants.h"
 #include "nsIComponentManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsProgressFrame.h"
 #include "nsMeterFrame.h"
 #include "nsMenuFrame.h"
 #include "nsRangeFrame.h"
 #include "nsCSSRendering.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/HTMLBodyElement.h"
+#include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/HTMLProgressElement.h"
 #include "nsIDocumentInlines.h"
 #include <algorithm>
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 nsNativeTheme::nsNativeTheme()
@@ -205,21 +205,19 @@ nsNativeTheme::GetCheckedOrSelected(nsIF
   nsIContent* content = aFrame->GetContent();
 
   if (content->IsXULElement()) {
     // For a XUL checkbox or radio button, the state of the parent determines
     // the checked state
     aFrame = aFrame->GetParent();
   } else {
     // Check for an HTML input element
-    nsCOMPtr<nsIDOMHTMLInputElement> inputElt = do_QueryInterface(content);
+    HTMLInputElement* inputElt = HTMLInputElement::FromContent(content);
     if (inputElt) {
-      bool checked;
-      inputElt->GetChecked(&checked);
-      return checked;
+      return inputElt->Checked();
     }
   }
 
   return CheckBooleanAttr(aFrame, aCheckSelected ? nsGkAtoms::selected
                                                  : nsGkAtoms::checked);
 }
 
 bool
@@ -257,21 +255,19 @@ nsNativeTheme::GetIndeterminate(nsIFrame
 
   if (content->IsXULElement()) {
     // For a XUL checkbox or radio button, the state of the parent determines
     // the state
     return CheckBooleanAttr(aFrame->GetParent(), nsGkAtoms::indeterminate);
   }
 
   // Check for an HTML input element
-  nsCOMPtr<nsIDOMHTMLInputElement> inputElt = do_QueryInterface(content);
+  HTMLInputElement* inputElt = HTMLInputElement::FromContent(content);
   if (inputElt) {
-    bool indeterminate;
-    inputElt->GetIndeterminate(&indeterminate);
-    return indeterminate;
+    return inputElt->Indeterminate();
   }
 
   return false;
 }
 
 bool
 nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext, nsIFrame* aFrame,
                               uint8_t aWidgetType)
--- a/widget/windows/nsNativeThemeWin.cpp
+++ b/widget/windows/nsNativeThemeWin.cpp
@@ -13,17 +13,16 @@
 #include "nsSize.h"
 #include "nsTransform2D.h"
 #include "nsThemeConstants.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
 #include "nsIContent.h"
 #include "nsIFrame.h"
 #include "nsNameSpaceManager.h"
-#include "nsIDOMHTMLInputElement.h"
 #include "nsLookAndFeel.h"
 #include "nsMenuFrame.h"
 #include "nsGkAtoms.h"
 #include <malloc.h>
 #include "nsWindow.h"
 #include "nsIComboboxControlFrame.h"
 #include "prinrval.h"
 #include "WinUtils.h"