Bug 1440741 - Remove all members from nsIDOMHTMLFormElement. r?qdot
MozReview-Commit-ID: 2UcUy4MkVsM
--- a/accessible/generic/FormControlAccessible.cpp
+++ b/accessible/generic/FormControlAccessible.cpp
@@ -4,17 +4,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// NOTE: alphabetically ordered
#include "FormControlAccessible.h"
#include "Role.h"
#include "mozilla/FloatingPoint.h"
-#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMXULControlElement.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// ProgressMeterAccessible
////////////////////////////////////////////////////////////////////////////////
--- a/dom/base/nsContentList.cpp
+++ b/dom/base/nsContentList.cpp
@@ -22,19 +22,16 @@
#include "mozilla/dom/HTMLCollectionBinding.h"
#include "mozilla/dom/NodeListBinding.h"
#include "mozilla/Likely.h"
#include "nsGenericHTMLElement.h"
#include "jsfriendapi.h"
#include <algorithm>
#include "mozilla/dom/NodeInfoInlines.h"
-// Form related includes
-#include "nsIDOMHTMLFormElement.h"
-
#include "PLDHashTable.h"
#ifdef DEBUG_CONTENT_LIST
#include "nsIContentIterator.h"
#define ASSERT_IN_SYNC AssertInSync()
#else
#define ASSERT_IN_SYNC PR_BEGIN_MACRO PR_END_MACRO
#endif
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -129,17 +129,16 @@
#include "nsIDocShell.h"
#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 "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMWindowUtils.h"
#include "nsIDragService.h"
#include "nsIFormControl.h"
#include "nsIForm.h"
#include "nsIFragmentContentSink.h"
#include "nsContainerFrame.h"
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -120,17 +120,16 @@
#include "nsBidiUtils.h"
#include "nsContentCreatorFunctions.h"
#include "nsIScriptContext.h"
#include "nsBindingManager.h"
#include "nsHTMLDocument.h"
-#include "nsIDOMHTMLFormElement.h"
#include "nsIRequest.h"
#include "nsHostObjectProtocolHandler.h"
#include "nsCharsetSource.h"
#include "nsIParser.h"
#include "nsIContentSink.h"
#include "mozilla/EventDispatcher.h"
@@ -155,16 +154,17 @@
#include "mozilla/dom/StyleRuleChangeEvent.h"
#include "mozilla/dom/StyleSheetChangeEvent.h"
#include "mozilla/dom/StyleSheetApplicableStateChangeEvent.h"
#include "nsJSUtils.h"
#include "nsFrameLoader.h"
#include "nsEscape.h"
#include "nsObjectLoadingContent.h"
#include "nsHtml5TreeOpExecutor.h"
+#include "mozilla/dom/HTMLFormElement.h"
#include "mozilla/dom/HTMLLinkElement.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/dom/HTMLIFrameElement.h"
#include "mozilla/dom/HTMLImageElement.h"
#include "mozilla/dom/HTMLTextAreaElement.h"
#include "mozilla/dom/MediaSource.h"
#include "mozAutoDocUpdate.h"
@@ -8021,22 +8021,21 @@ nsDocument::Sanitize()
// Now locate all _form_ elements that have autocomplete=off and reset them
nodes = GetElementsByTagName(NS_LITERAL_STRING("form"));
length = nodes->Length(true);
for (uint32_t i = 0; i < length; ++i) {
NS_ASSERTION(nodes->Item(i), "null item in nodelist");
- nsCOMPtr<nsIDOMHTMLFormElement> form = do_QueryInterface(nodes->Item(i));
+ HTMLFormElement* form = HTMLFormElement::FromContent(nodes->Item(i));
if (!form)
continue;
- nodes->Item(i)->AsElement()->GetAttr(kNameSpaceID_None,
- nsGkAtoms::autocomplete, value);
+ form->GetAttr(kNameSpaceID_None, nsGkAtoms::autocomplete, value);
if (value.LowerCaseEqualsLiteral("off"))
form->Reset();
}
}
void
nsDocument::EnumerateSubDocuments(nsSubDocEnumFunc aCallback, void *aData)
{
--- a/dom/html/HTMLButtonElement.cpp
+++ b/dom/html/HTMLButtonElement.cpp
@@ -4,17 +4,16 @@
* 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 "mozilla/dom/HTMLButtonElement.h"
#include "HTMLFormSubmissionConstants.h"
#include "mozilla/dom/HTMLButtonElementBinding.h"
#include "mozilla/dom/HTMLFormSubmission.h"
-#include "nsIDOMHTMLFormElement.h"
#include "nsAttrValueInlines.h"
#include "nsGkAtoms.h"
#include "nsIPresShell.h"
#include "nsStyleConsts.h"
#include "nsPresContext.h"
#include "nsIFormControl.h"
#include "nsIURL.h"
#include "nsIFrame.h"
--- a/dom/html/HTMLFormElement.cpp
+++ b/dom/html/HTMLFormElement.cpp
@@ -160,18 +160,16 @@ NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHER
void
HTMLFormElement::AsyncEventRunning(AsyncEventDispatcher* aEvent)
{
if (mFormPasswordEventDispatcher == aEvent) {
mFormPasswordEventDispatcher = nullptr;
}
}
-// nsIDOMHTMLFormElement
-
NS_IMPL_ELEMENT_CLONE(HTMLFormElement)
nsIHTMLCollection*
HTMLFormElement::Elements()
{
return mControls;
}
@@ -220,64 +218,51 @@ HTMLFormElement::AfterSetAttr(int32_t aN
mControls->mNotInElements[i]->UpdateState(true);
}
}
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
aOldValue, aSubjectPrincipal, aNotify);
}
-NS_IMPL_STRING_ATTR(HTMLFormElement, AcceptCharset, acceptcharset)
-NS_IMPL_ACTION_ATTR(HTMLFormElement, Action, action)
-NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLFormElement, Autocomplete, autocomplete,
- kFormDefaultAutocomplete->tag)
-NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLFormElement, Enctype, enctype,
- kFormDefaultEnctype->tag)
-NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLFormElement, Method, method,
- kFormDefaultMethod->tag)
-NS_IMPL_BOOL_ATTR(HTMLFormElement, NoValidate, novalidate)
-NS_IMPL_STRING_ATTR(HTMLFormElement, Name, name)
-NS_IMPL_STRING_ATTR(HTMLFormElement, Target, target)
+void HTMLFormElement::GetAutocomplete(nsAString& aValue)
+{
+ GetEnumAttr(nsGkAtoms::autocomplete, kFormDefaultAutocomplete->tag, aValue);
+}
+
+void HTMLFormElement::GetEnctype(nsAString& aValue)
+{
+ GetEnumAttr(nsGkAtoms::enctype, kFormDefaultEnctype->tag, aValue);
+}
+
+void HTMLFormElement::GetMethod(nsAString& aValue)
+{
+ GetEnumAttr(nsGkAtoms::method, kFormDefaultMethod->tag, aValue);
+}
void
HTMLFormElement::Submit(ErrorResult& aRv)
{
// Send the submit event
if (mPendingSubmission) {
// aha, we have a pending submission that was not flushed
// (this happens when form.submit() is called twice)
// we have to delete it and build a new one since values
// might have changed inbetween (we emulate IE here, that's all)
mPendingSubmission = nullptr;
}
aRv = DoSubmitOrReset(nullptr, eFormSubmit);
}
-NS_IMETHODIMP
-HTMLFormElement::Submit()
-{
- ErrorResult rv;
- Submit(rv);
- return rv.StealNSResult();
-}
-
-NS_IMETHODIMP
+void
HTMLFormElement::Reset()
{
InternalFormEvent event(true, eFormReset);
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), nullptr, &event);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-HTMLFormElement::CheckValidity(bool* retVal)
-{
- *retVal = CheckValidity();
- return NS_OK;
}
bool
HTMLFormElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
@@ -1839,41 +1824,22 @@ HTMLFormElement::IsLastActiveElement(con
if (element->IsSingleLineTextOrNumberControl(false) &&
!element->IsDisabled()) {
return element == aControl;
}
}
return false;
}
-NS_IMETHODIMP
-HTMLFormElement::GetEncoding(nsAString& aEncoding)
-{
- return GetEnctype(aEncoding);
-}
-
-NS_IMETHODIMP
-HTMLFormElement::SetEncoding(const nsAString& aEncoding)
-{
- return SetEnctype(aEncoding);
-}
-
int32_t
HTMLFormElement::Length()
{
return mControls->Length();
}
-NS_IMETHODIMP
-HTMLFormElement::GetLength(int32_t* aLength)
-{
- *aLength = Length();
- return NS_OK;
-}
-
void
HTMLFormElement::ForgetCurrentSubmission()
{
mNotifiedObservers = false;
mIsSubmitting = false;
mSubmittingRequest = nullptr;
nsCOMPtr<nsIWebProgress> webProgress = do_QueryReferent(mWebProgress);
if (webProgress) {
--- a/dom/html/HTMLFormElement.h
+++ b/dom/html/HTMLFormElement.h
@@ -39,16 +39,18 @@ class HTMLFormElement final : public nsG
public nsIDOMHTMLFormElement,
public nsIWebProgressListener,
public nsIForm,
public nsIRadioGroupContainer
{
friend class HTMLFormControlsCollection;
public:
+ NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLFormElement, form)
+
explicit HTMLFormElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
enum {
FORM_CONTROL_LIST_HASHTABLE_LENGTH = 8
};
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
@@ -320,41 +322,43 @@ public:
}
void SetAcceptCharset(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::acceptcharset, aValue, aRv);
}
void GetAction(nsString& aValue);
-
void SetAction(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::action, aValue, aRv);
}
- // XPCOM GetAutocomplete() is OK
+ void GetAutocomplete(nsAString& aValue);
void SetAutocomplete(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::autocomplete, aValue, aRv);
}
- // XPCOM GetEnctype() is OK
+ void GetEnctype(nsAString& aValue);
void SetEnctype(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::enctype, aValue, aRv);
}
- // XPCOM GetEncoding() is OK
+ void GetEncoding(nsAString& aValue)
+ {
+ GetEnctype(aValue);
+ }
void SetEncoding(const nsAString& aValue, ErrorResult& aRv)
{
SetEnctype(aValue, aRv);
}
- // XPCOM GetMethod() is OK
+ void GetMethod(nsAString& aValue);
void SetMethod(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::method, aValue, aRv);
}
void GetName(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::name, aValue);
@@ -387,18 +391,17 @@ public:
// it's only out-of-line because the class definition is not available in the
// header
nsIHTMLCollection* Elements();
int32_t Length();
void Submit(ErrorResult& aRv);
-
- // XPCOM Reset() is OK
+ void Reset();
bool CheckValidity()
{
return CheckFormValidity(nullptr);
}
bool ReportValidity()
{
--- a/dom/html/HTMLFormSubmission.cpp
+++ b/dom/html/HTMLFormSubmission.cpp
@@ -7,17 +7,16 @@
#include "HTMLFormSubmission.h"
#include "nsCOMPtr.h"
#include "nsIForm.h"
#include "nsILinkHandler.h"
#include "nsIDocument.h"
#include "nsGkAtoms.h"
#include "nsIFormControl.h"
-#include "nsIDOMHTMLFormElement.h"
#include "nsError.h"
#include "nsGenericHTMLElement.h"
#include "nsAttrValueInlines.h"
#include "nsIFile.h"
#include "nsDirectoryServiceDefs.h"
#include "nsStringStream.h"
#include "nsIURI.h"
#include "nsIURL.h"
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -29,17 +29,16 @@
#include "nsIStringBundle.h"
#include "nsFocusManager.h"
#include "nsColorControlFrame.h"
#include "nsNumberControlFrame.h"
#include "nsPIDOMWindow.h"
#include "nsRepeatService.h"
#include "nsContentCID.h"
#include "nsIComponentManager.h"
-#include "nsIDOMHTMLFormElement.h"
#include "mozilla/dom/ProgressEvent.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsPresContext.h"
#include "nsMappedAttributes.h"
#include "nsIFormControl.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
--- a/dom/html/HTMLLegendElement.cpp
+++ b/dom/html/HTMLLegendElement.cpp
@@ -1,17 +1,16 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "mozilla/dom/HTMLLegendElement.h"
#include "mozilla/dom/HTMLLegendElementBinding.h"
-#include "nsIDOMHTMLFormElement.h"
#include "nsFocusManager.h"
#include "nsIFrame.h"
NS_IMPL_NS_NEW_HTML_ELEMENT(Legend)
namespace mozilla {
namespace dom {
--- a/dom/html/HTMLOptionElement.cpp
+++ b/dom/html/HTMLOptionElement.cpp
@@ -2,17 +2,16 @@
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "mozilla/dom/HTMLOptionElement.h"
#include "mozilla/dom/HTMLOptionElementBinding.h"
#include "mozilla/dom/HTMLSelectElement.h"
-#include "nsIDOMHTMLFormElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsIFormControl.h"
#include "nsIForm.h"
#include "nsIDOMNode.h"
#include "nsISelectControlFrame.h"
// Notify/query select frame for selected state
--- a/dom/html/HTMLTextAreaElement.cpp
+++ b/dom/html/HTMLTextAreaElement.cpp
@@ -19,17 +19,16 @@
#include "nsContentCID.h"
#include "nsContentCreatorFunctions.h"
#include "nsError.h"
#include "nsFocusManager.h"
#include "nsIComponentManager.h"
#include "nsIConstraintValidation.h"
#include "nsIControllers.h"
#include "nsIDocument.h"
-#include "nsIDOMHTMLFormElement.h"
#include "nsIFormControlFrame.h"
#include "nsIFormControl.h"
#include "nsIForm.h"
#include "nsIFrame.h"
#include "nsISupportsPrimitives.h"
#include "nsITextControlFrame.h"
#include "nsLayoutUtils.h"
#include "nsLinebreakConverter.h"
--- a/dom/interfaces/html/nsIDOMHTMLFormElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLFormElement.idl
@@ -14,24 +14,9 @@
*
* with changes from the work-in-progress WHATWG HTML specification:
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[uuid(ad9b2ad0-9d29-43f6-b1a2-a1fd24627e6b)]
interface nsIDOMHTMLFormElement : nsISupports
{
- attribute DOMString acceptCharset;
- attribute DOMString action;
- attribute DOMString autocomplete;
- attribute DOMString enctype;
- attribute DOMString encoding;
- attribute DOMString method;
- attribute DOMString name;
- attribute boolean noValidate;
- attribute DOMString target;
-
- readonly attribute long length;
-
- void submit();
- void reset();
- boolean checkValidity();
};
--- a/dom/xul/nsXULContentSink.cpp
+++ b/dom/xul/nsXULContentSink.cpp
@@ -17,17 +17,16 @@
#include "jsfriendapi.h"
#include "nsCOMPtr.h"
#include "nsForwardReference.h"
#include "nsHTMLStyleSheet.h"
#include "nsIContentSink.h"
#include "nsIDocument.h"
#include "nsIDOMEventListener.h"
-#include "nsIDOMHTMLFormElement.h"
#include "nsIFormControl.h"
#include "mozilla/dom/NodeInfo.h"
#include "nsIScriptContext.h"
#include "nsIScriptGlobalObject.h"
#include "nsIServiceManager.h"
#include "nsIURL.h"
#include "nsNameSpaceManager.h"
#include "nsParserBase.h"
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -28,17 +28,16 @@
#include "nsPIDOMWindow.h"
#include "nsIWebNavigation.h"
#include "nsIContentViewer.h"
#include "nsIDOMElement.h"
#include "nsIDocument.h"
#include "nsIContent.h"
#include "nsIPresShell.h"
#include "nsRect.h"
-#include "nsIDOMHTMLFormElement.h"
#include "nsILoginManager.h"
#include "nsIDOMMouseEvent.h"
#include "mozilla/ModuleUtils.h"
#include "nsToolkitCompsCID.h"
#include "nsEmbedCID.h"
#include "nsIDOMNSEditableElement.h"
#include "nsContentUtils.h"
#include "nsGenericHTMLElement.h"