diff --git a/dom/base/FormData.cpp b/dom/base/FormData.cpp index c113d1243621..a74a262c35e8 100644 --- a/dom/base/FormData.cpp +++ b/dom/base/FormData.cpp @@ -16,7 +16,7 @@ using namespace mozilla; using namespace mozilla::dom; FormData::FormData(nsISupports* aOwner) - : nsFormSubmission(NS_LITERAL_CSTRING("UTF-8"), nullptr) + : HTMLFormSubmission(NS_LITERAL_CSTRING("UTF-8"), nullptr) , mOwner(aOwner) { } @@ -99,7 +99,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FormData) NS_INTERFACE_MAP_END // ------------------------------------------------------------------------- -// nsFormSubmission +// HTMLFormSubmission nsresult FormData::GetEncodedSubmission(nsIURI* aURI, nsIInputStream** aPostDataStream) diff --git a/dom/base/FormData.h b/dom/base/FormData.h index 00652e8411ce..a7ab3b9b3d9a 100644 --- a/dom/base/FormData.h +++ b/dom/base/FormData.h @@ -10,11 +10,11 @@ #include "mozilla/Attributes.h" #include "mozilla/ErrorResult.h" #include "mozilla/dom/BindingDeclarations.h" +#include "mozilla/dom/HTMLFormSubmission.h" #include "mozilla/dom/File.h" #include "mozilla/dom/FormDataBinding.h" #include "nsIDOMFormData.h" #include "nsIXMLHttpRequest.h" -#include "nsFormSubmission.h" #include "nsTArray.h" #include "nsWrapperCache.h" @@ -26,7 +26,7 @@ class GlobalObject; class FormData final : public nsIDOMFormData, public nsIXHRSendable, - public nsFormSubmission, + public HTMLFormSubmission, public nsWrapperCache { private: @@ -104,7 +104,7 @@ public: const OwningBlobOrUSVString& GetValueAtIndex(uint32_t aIndex) const; - // nsFormSubmission + // HTMLFormSubmission virtual nsresult GetEncodedSubmission(nsIURI* aURI, nsIInputStream** aPostDataStream) override; diff --git a/dom/html/HTMLButtonElement.cpp b/dom/html/HTMLButtonElement.cpp index 9c80efae67c9..874383fb925b 100644 --- a/dom/html/HTMLButtonElement.cpp +++ b/dom/html/HTMLButtonElement.cpp @@ -6,7 +6,9 @@ #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" @@ -14,9 +16,6 @@ #include "nsStyleConsts.h" #include "nsPresContext.h" #include "nsIFormControl.h" -#include "nsIForm.h" -#include "nsFormSubmission.h" -#include "nsFormSubmissionConstants.h" #include "nsIURL.h" #include "nsIFrame.h" #include "nsIFormControlFrame.h" @@ -440,7 +439,7 @@ HTMLButtonElement::Reset() } NS_IMETHODIMP -HTMLButtonElement::SubmitNamesValues(nsFormSubmission* aFormSubmission) +HTMLButtonElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission) { // // We only submit if we were the button pressed diff --git a/dom/html/HTMLButtonElement.h b/dom/html/HTMLButtonElement.h index 2151fe09f394..ecd9e03d7388 100644 --- a/dom/html/HTMLButtonElement.h +++ b/dom/html/HTMLButtonElement.h @@ -49,7 +49,7 @@ public: // overriden nsIFormControl methods NS_IMETHOD_(uint32_t) GetType() const override { return mType; } NS_IMETHOD Reset() override; - NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override; + NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override; NS_IMETHOD SaveState() override; bool RestoreState(nsPresState* aState) override; virtual bool IsDisabledForEvents(EventMessage aMessage) override; diff --git a/dom/html/HTMLFieldSetElement.cpp b/dom/html/HTMLFieldSetElement.cpp index 46c825138e88..30728f128d1b 100644 --- a/dom/html/HTMLFieldSetElement.cpp +++ b/dom/html/HTMLFieldSetElement.cpp @@ -154,7 +154,7 @@ HTMLFieldSetElement::Reset() } NS_IMETHODIMP -HTMLFieldSetElement::SubmitNamesValues(nsFormSubmission* aFormSubmission) +HTMLFieldSetElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission) { return NS_OK; } diff --git a/dom/html/HTMLFieldSetElement.h b/dom/html/HTMLFieldSetElement.h index a84f452f0a77..d169434ae84c 100644 --- a/dom/html/HTMLFieldSetElement.h +++ b/dom/html/HTMLFieldSetElement.h @@ -51,7 +51,7 @@ public: // nsIFormControl NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_FIELDSET; } NS_IMETHOD Reset() override; - NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override; + NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override; virtual bool IsDisabledForEvents(EventMessage aMessage) override; virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override; diff --git a/dom/html/HTMLFormElement.cpp b/dom/html/HTMLFormElement.cpp index 820c89724b41..9b30636a29d1 100644 --- a/dom/html/HTMLFormElement.cpp +++ b/dom/html/HTMLFormElement.cpp @@ -36,6 +36,7 @@ #include "nsQueryObject.h" // form submission +#include "HTMLFormSubmissionConstants.h" #include "mozilla/dom/FormData.h" #include "mozilla/Telemetry.h" #include "nsIFormSubmitObserver.h" @@ -50,7 +51,6 @@ #include "nsIInterfaceRequestorUtils.h" #include "nsIWebProgress.h" #include "nsIDocShell.h" -#include "nsFormSubmissionConstants.h" #include "nsIPrompt.h" #include "nsISecurityUITelemetry.h" #include "nsIStringBundle.h" @@ -644,7 +644,7 @@ HTMLFormElement::DoSubmit(WidgetEvent* aEvent) mIsSubmitting = true; NS_ASSERTION(!mWebProgress && !mSubmittingRequest, "Web progress / submitting request should not exist here!"); - nsAutoPtr submission; + nsAutoPtr submission; // // prepare the submission object @@ -684,7 +684,7 @@ HTMLFormElement::DoSubmit(WidgetEvent* aEvent) } nsresult -HTMLFormElement::BuildSubmission(nsFormSubmission** aFormSubmission, +HTMLFormElement::BuildSubmission(HTMLFormSubmission** aFormSubmission, WidgetEvent* aEvent) { NS_ASSERTION(!mPendingSubmission, "tried to build two submissions!"); @@ -722,7 +722,7 @@ HTMLFormElement::BuildSubmission(nsFormSubmission** aFormSubmission, } nsresult -HTMLFormElement::SubmitSubmission(nsFormSubmission* aFormSubmission) +HTMLFormElement::SubmitSubmission(HTMLFormSubmission* aFormSubmission) { nsresult rv; nsIContent* originatingElement = aFormSubmission->GetOriginatingElement(); @@ -1033,7 +1033,7 @@ HTMLFormElement::NotifySubmitObservers(nsIURI* aActionURL, nsresult -HTMLFormElement::WalkFormElements(nsFormSubmission* aFormSubmission) +HTMLFormElement::WalkFormElements(HTMLFormSubmission* aFormSubmission) { nsTArray sortedControls; nsresult rv = mControls->GetSortedControls(sortedControls); @@ -1609,7 +1609,7 @@ HTMLFormElement::FlushPendingSubmission() if (mPendingSubmission) { // Transfer owning reference so that the submissioin doesn't get deleted // if we reenter - nsAutoPtr submission = Move(mPendingSubmission); + nsAutoPtr submission = Move(mPendingSubmission); SubmitSubmission(submission); } diff --git a/dom/html/HTMLFormElement.h b/dom/html/HTMLFormElement.h index 6c6792297fea..11f2d6265a51 100644 --- a/dom/html/HTMLFormElement.h +++ b/dom/html/HTMLFormElement.h @@ -9,11 +9,11 @@ #include "mozilla/AsyncEventDispatcher.h" #include "mozilla/Attributes.h" +#include "mozilla/dom/HTMLFormSubmission.h" #include "nsAutoPtr.h" #include "nsCOMPtr.h" #include "nsIForm.h" #include "nsIFormControl.h" -#include "nsFormSubmission.h" #include "nsGenericHTMLElement.h" #include "nsIDOMHTMLFormElement.h" #include "nsIWebProgressListener.h" @@ -283,7 +283,7 @@ public: * * @param aFormSubmission the form submission object */ - nsresult WalkFormElements(nsFormSubmission* aFormSubmission); + nsresult WalkFormElements(HTMLFormSubmission* aFormSubmission); /** * Whether the submission of this form has been ever prevented because of @@ -481,14 +481,14 @@ protected: * @param aFormSubmission the submission object * @param aEvent the DOM event that was passed to us for the submit */ - nsresult BuildSubmission(nsFormSubmission** aFormSubmission, + nsresult BuildSubmission(HTMLFormSubmission** aFormSubmission, WidgetEvent* aEvent); /** * Perform the submission (called by DoSubmit and FlushPendingSubmission) * * @param aFormSubmission the submission object */ - nsresult SubmitSubmission(nsFormSubmission* aFormSubmission); + nsresult SubmitSubmission(HTMLFormSubmission* aFormSubmission); /** * Notify any submit observers of the submit. @@ -590,7 +590,7 @@ protected: bool mSubmitInitiatedFromUserInput; /** The pending submission object */ - nsAutoPtr mPendingSubmission; + nsAutoPtr mPendingSubmission; /** The request currently being submitted */ nsCOMPtr mSubmittingRequest; /** The web progress object we are currently listening to */ diff --git a/dom/html/nsFormSubmission.cpp b/dom/html/HTMLFormSubmission.cpp similarity index 98% rename from dom/html/nsFormSubmission.cpp rename to dom/html/HTMLFormSubmission.cpp index 2acb50d85b20..786384eeb40c 100644 --- a/dom/html/nsFormSubmission.cpp +++ b/dom/html/HTMLFormSubmission.cpp @@ -4,7 +4,7 @@ * 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 "nsFormSubmission.h" +#include "HTMLFormSubmission.h" #include "nsCOMPtr.h" #include "nsIForm.h" @@ -40,11 +40,8 @@ #include "mozilla/dom/EncodingUtils.h" #include "mozilla/dom/File.h" -using namespace mozilla; -using mozilla::dom::Blob; -using mozilla::dom::Directory; -using mozilla::dom::EncodingUtils; -using mozilla::dom::File; +namespace mozilla { +namespace dom { static void SendJSWarning(nsIDocument* aDocument, @@ -715,7 +712,7 @@ nsFSTextPlain::GetEncodedSubmission(nsIURI* aURI, nsEncodingFormSubmission::nsEncodingFormSubmission(const nsACString& aCharset, nsIContent* aOriginatingElement) - : nsFormSubmission(aCharset, aOriginatingElement) + : HTMLFormSubmission(aCharset, aOriginatingElement) , mEncoder(aCharset) { if (!(aCharset.EqualsLiteral("UTF-8") || aCharset.EqualsLiteral("gb18030"))) { @@ -806,7 +803,7 @@ GetEnumAttr(nsGenericHTMLElement* aContent, nsresult GetSubmissionFromForm(nsGenericHTMLElement* aForm, nsGenericHTMLElement* aOriginatingElement, - nsFormSubmission** aFormSubmission) + HTMLFormSubmission** aFormSubmission) { // Get all the information necessary to encode the form data NS_ASSERTION(aForm->GetComposedDoc(), @@ -873,3 +870,6 @@ GetSubmissionFromForm(nsGenericHTMLElement* aForm, return NS_OK; } + +} // dom namespace +} // mozilla namespace diff --git a/dom/html/nsFormSubmission.h b/dom/html/HTMLFormSubmission.h similarity index 90% rename from dom/html/nsFormSubmission.h rename to dom/html/HTMLFormSubmission.h index 98e38842dbde..3a66b2a726f4 100644 --- a/dom/html/nsFormSubmission.h +++ b/dom/html/HTMLFormSubmission.h @@ -3,14 +3,15 @@ /* 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/. */ -#ifndef nsIFormSubmission_h___ -#define nsIFormSubmission_h___ + +#ifndef mozilla_dom_HTMLFormSubmission_h +#define mozilla_dom_HTMLFormSubmission_h #include "mozilla/Attributes.h" -#include "nsString.h" #include "nsCOMPtr.h" #include "nsIContent.h" #include "nsNCRFallbackEncoderWrapper.h" +#include "nsString.h" class nsIURI; class nsIInputStream; @@ -19,20 +20,19 @@ class nsIMultiplexInputStream; namespace mozilla { namespace dom { + class Blob; -} // namespace dom -} // namespace mozilla /** * Class for form submissions; encompasses the function to call to submit as * well as the form submission name/value pairs */ -class nsFormSubmission +class HTMLFormSubmission { public: - virtual ~nsFormSubmission() + virtual ~HTMLFormSubmission() { - MOZ_COUNT_DTOR(nsFormSubmission); + MOZ_COUNT_DTOR(HTMLFormSubmission); } /** @@ -53,7 +53,7 @@ public: * not null. */ virtual nsresult AddNameBlobOrNullPair(const nsAString& aName, - mozilla::dom::Blob* aBlob) = 0; + Blob* aBlob) = 0; /** * Reports whether the instance supports AddIsindex(). @@ -106,11 +106,12 @@ protected: * @param aCharset the charset of the form as a string * @param aOriginatingElement the originating element (can be null) */ - nsFormSubmission(const nsACString& aCharset, nsIContent* aOriginatingElement) + HTMLFormSubmission(const nsACString& aCharset, + nsIContent* aOriginatingElement) : mCharset(aCharset) , mOriginatingElement(aOriginatingElement) { - MOZ_COUNT_CTOR(nsFormSubmission); + MOZ_COUNT_CTOR(HTMLFormSubmission); } // The name of the encoder charset @@ -120,7 +121,7 @@ protected: nsCOMPtr mOriginatingElement; }; -class nsEncodingFormSubmission : public nsFormSubmission +class nsEncodingFormSubmission : public HTMLFormSubmission { public: nsEncodingFormSubmission(const nsACString& aCharset, @@ -162,7 +163,7 @@ public: virtual nsresult AddNameValuePair(const nsAString& aName, const nsAString& aValue) override; virtual nsresult AddNameBlobOrNullPair(const nsAString& aName, - mozilla::dom::Blob* aBlob) override; + Blob* aBlob) override; virtual nsresult GetEncodedSubmission(nsIURI* aURI, nsIInputStream** aPostDataStream) override; @@ -220,6 +221,9 @@ private: */ nsresult GetSubmissionFromForm(nsGenericHTMLElement* aForm, nsGenericHTMLElement* aOriginatingElement, - nsFormSubmission** aFormSubmission); + HTMLFormSubmission** aFormSubmission); -#endif /* nsIFormSubmission_h___ */ +} // namespace dom +} // namespace mozilla + +#endif /* mozilla_dom_HTMLFormSubmission_h */ diff --git a/dom/html/nsFormSubmissionConstants.h b/dom/html/HTMLFormSubmissionConstants.h similarity index 84% rename from dom/html/nsFormSubmissionConstants.h rename to dom/html/HTMLFormSubmissionConstants.h index 68baaa7eeb23..cedded9c6eff 100644 --- a/dom/html/nsFormSubmissionConstants.h +++ b/dom/html/HTMLFormSubmissionConstants.h @@ -4,14 +4,17 @@ * 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/. */ -#ifndef nsFormSubmissionConstants_h__ -#define nsFormSubmissionConstants_h__ +#ifndef mozilla_dom_HTMLFormSubmissionConstants_h +#define mozilla_dom_HTMLFormSubmissionConstants_h + +#include "nsIForm.h" static const nsAttrValue::EnumTable kFormMethodTable[] = { { "get", NS_FORM_METHOD_GET }, { "post", NS_FORM_METHOD_POST }, { 0 } }; + // Default method is 'get'. static const nsAttrValue::EnumTable* kFormDefaultMethod = &kFormMethodTable[0]; @@ -21,8 +24,8 @@ static const nsAttrValue::EnumTable kFormEnctypeTable[] = { { "text/plain", NS_FORM_ENCTYPE_TEXTPLAIN }, { 0 } }; + // Default method is 'application/x-www-form-urlencoded'. static const nsAttrValue::EnumTable* kFormDefaultEnctype = &kFormEnctypeTable[1]; -#endif // nsFormSubmissionConstants_h__ - +#endif // mozilla_dom_HTMLFormSubmissionConstants_h diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index 16256efc3d74..067a6f0c2cc3 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -11,6 +11,7 @@ #include "mozilla/DebugOnly.h" #include "mozilla/dom/Date.h" #include "mozilla/dom/Directory.h" +#include "mozilla/dom/HTMLFormSubmission.h" #include "mozilla/dom/FileSystemUtils.h" #include "nsAttrValueInlines.h" #include "nsCRTGlue.h" @@ -21,6 +22,7 @@ #include "nsIRadioVisitor.h" #include "nsIPhonetic.h" +#include "HTMLFormSubmissionConstants.h" #include "mozilla/Telemetry.h" #include "nsIControllers.h" #include "nsIStringBundle.h" @@ -38,9 +40,6 @@ #include "nsPresContext.h" #include "nsMappedAttributes.h" #include "nsIFormControl.h" -#include "nsIForm.h" -#include "nsFormSubmission.h" -#include "nsFormSubmissionConstants.h" #include "nsIDocument.h" #include "nsIPresShell.h" #include "nsIFormControlFrame.h" @@ -6182,7 +6181,7 @@ HTMLInputElement::Reset() } NS_IMETHODIMP -HTMLInputElement::SubmitNamesValues(nsFormSubmission* aFormSubmission) +HTMLInputElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission) { // Disabled elements don't submit // For type=reset, and type=button, we just never submit, period. diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h index b9154328e8aa..a9841763ed2f 100644 --- a/dom/html/HTMLInputElement.h +++ b/dom/html/HTMLInputElement.h @@ -154,7 +154,7 @@ public: // Overriden nsIFormControl methods NS_IMETHOD_(uint32_t) GetType() const override { return mType; } NS_IMETHOD Reset() override; - NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override; + NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override; NS_IMETHOD SaveState() override; virtual bool RestoreState(nsPresState* aState) override; virtual bool AllowDrop() override; diff --git a/dom/html/HTMLObjectElement.cpp b/dom/html/HTMLObjectElement.cpp index 2a551865ccde..a23fc193e8d1 100644 --- a/dom/html/HTMLObjectElement.cpp +++ b/dom/html/HTMLObjectElement.cpp @@ -5,6 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/EventStates.h" +#include "mozilla/dom/HTMLFormSubmission.h" #include "mozilla/dom/HTMLObjectElement.h" #include "mozilla/dom/HTMLObjectElementBinding.h" #include "mozilla/dom/ElementInlines.h" @@ -14,7 +15,6 @@ #include "nsIDocument.h" #include "nsIPluginDocument.h" #include "nsIDOMDocument.h" -#include "nsFormSubmission.h" #include "nsIObjectFrame.h" #include "nsNPAPIPluginInstance.h" #include "nsIWidget.h" @@ -407,7 +407,7 @@ HTMLObjectElement::Reset() } NS_IMETHODIMP -HTMLObjectElement::SubmitNamesValues(nsFormSubmission *aFormSubmission) +HTMLObjectElement::SubmitNamesValues(HTMLFormSubmission *aFormSubmission) { nsAutoString name; if (!GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) { diff --git a/dom/html/HTMLObjectElement.h b/dom/html/HTMLObjectElement.h index 8f601349859b..a5bfb7ebf54b 100644 --- a/dom/html/HTMLObjectElement.h +++ b/dom/html/HTMLObjectElement.h @@ -16,6 +16,8 @@ namespace mozilla { namespace dom { +class HTMLFormSubmission; + class HTMLObjectElement final : public nsGenericHTMLFormElement , public nsObjectLoadingContent , public nsIDOMHTMLObjectElement @@ -70,7 +72,7 @@ public: } NS_IMETHOD Reset() override; - NS_IMETHOD SubmitNamesValues(nsFormSubmission *aFormSubmission) override; + NS_IMETHOD SubmitNamesValues(HTMLFormSubmission *aFormSubmission) override; virtual bool IsDisabled() const override { return false; } diff --git a/dom/html/HTMLOptionsCollection.cpp b/dom/html/HTMLOptionsCollection.cpp index 1fce684aedb3..294493c0c3f2 100644 --- a/dom/html/HTMLOptionsCollection.cpp +++ b/dom/html/HTMLOptionsCollection.cpp @@ -10,12 +10,12 @@ #include "mozAutoDocUpdate.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/Element.h" +#include "mozilla/dom/HTMLFormSubmission.h" #include "mozilla/dom/HTMLOptionElement.h" #include "mozilla/dom/HTMLOptionsCollectionBinding.h" #include "mozilla/dom/HTMLSelectElement.h" #include "nsContentCreatorFunctions.h" #include "nsError.h" -#include "nsFormSubmission.h" #include "nsGkAtoms.h" #include "nsIComboboxControlFrame.h" #include "nsIDocument.h" diff --git a/dom/html/HTMLOutputElement.cpp b/dom/html/HTMLOutputElement.cpp index a5c5c9d2cf48..17608c94fd0a 100644 --- a/dom/html/HTMLOutputElement.cpp +++ b/dom/html/HTMLOutputElement.cpp @@ -9,10 +9,10 @@ #include "mozAutoDocUpdate.h" #include "mozilla/EventStates.h" #include "mozilla/dom/HTMLFormElement.h" +#include "mozilla/dom/HTMLFormSubmission.h" #include "mozilla/dom/HTMLOutputElementBinding.h" #include "nsContentUtils.h" #include "nsDOMTokenList.h" -#include "nsFormSubmission.h" NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Output) @@ -75,7 +75,7 @@ HTMLOutputElement::Reset() } NS_IMETHODIMP -HTMLOutputElement::SubmitNamesValues(nsFormSubmission* aFormSubmission) +HTMLOutputElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission) { // The output element is not submittable. return NS_OK; diff --git a/dom/html/HTMLOutputElement.h b/dom/html/HTMLOutputElement.h index b9e6ecd9c4aa..5882624806d4 100644 --- a/dom/html/HTMLOutputElement.h +++ b/dom/html/HTMLOutputElement.h @@ -15,6 +15,8 @@ namespace mozilla { namespace dom { +class HTMLFormSubmission; + class HTMLOutputElement final : public nsGenericHTMLFormElement, public nsStubMutationObserver, public nsIConstraintValidation @@ -31,7 +33,7 @@ public: // nsIFormControl NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_OUTPUT; } NS_IMETHOD Reset() override; - NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override; + NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override; virtual bool IsDisabled() const override { return false; } diff --git a/dom/html/HTMLSelectElement.cpp b/dom/html/HTMLSelectElement.cpp index ca37eb0622ac..b46a7c1a535f 100644 --- a/dom/html/HTMLSelectElement.cpp +++ b/dom/html/HTMLSelectElement.cpp @@ -12,6 +12,7 @@ #include "mozilla/EventDispatcher.h" #include "mozilla/EventStates.h" #include "mozilla/dom/Element.h" +#include "mozilla/dom/HTMLFormSubmission.h" #include "mozilla/dom/HTMLOptGroupElement.h" #include "mozilla/dom/HTMLOptionElement.h" #include "mozilla/dom/HTMLSelectElementBinding.h" @@ -19,7 +20,6 @@ #include "nsContentCreatorFunctions.h" #include "nsContentList.h" #include "nsError.h" -#include "nsFormSubmission.h" #include "nsGkAtoms.h" #include "nsIComboboxControlFrame.h" #include "nsIDocument.h" @@ -1656,7 +1656,7 @@ HTMLSelectElement::Reset() static NS_DEFINE_CID(kFormProcessorCID, NS_FORMPROCESSOR_CID); NS_IMETHODIMP -HTMLSelectElement::SubmitNamesValues(nsFormSubmission* aFormSubmission) +HTMLSelectElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission) { // Disabled elements don't submit if (IsDisabled()) { diff --git a/dom/html/HTMLSelectElement.h b/dom/html/HTMLSelectElement.h index 731aba3d7e0f..cce8eafabe0c 100644 --- a/dom/html/HTMLSelectElement.h +++ b/dom/html/HTMLSelectElement.h @@ -33,6 +33,7 @@ class EventChainPreVisitor; namespace dom { +class HTMLFormSubmission; class HTMLSelectElement; #define NS_SELECT_STATE_IID \ @@ -289,7 +290,7 @@ public: // Overriden nsIFormControl methods NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_SELECT; } NS_IMETHOD Reset() override; - NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override; + NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override; NS_IMETHOD SaveState() override; virtual bool RestoreState(nsPresState* aState) override; virtual bool IsDisabledForEvents(EventMessage aMessage) override; diff --git a/dom/html/HTMLTextAreaElement.cpp b/dom/html/HTMLTextAreaElement.cpp index f6114a99169e..0d216a3d0ed5 100644 --- a/dom/html/HTMLTextAreaElement.cpp +++ b/dom/html/HTMLTextAreaElement.cpp @@ -9,6 +9,7 @@ #include "mozAutoDocUpdate.h" #include "mozilla/AsyncEventDispatcher.h" #include "mozilla/Attributes.h" +#include "mozilla/dom/HTMLFormSubmission.h" #include "mozilla/dom/HTMLTextAreaElementBinding.h" #include "mozilla/EventDispatcher.h" #include "mozilla/EventStates.h" @@ -18,7 +19,6 @@ #include "nsContentCreatorFunctions.h" #include "nsError.h" #include "nsFocusManager.h" -#include "nsFormSubmission.h" #include "nsIComponentManager.h" #include "nsIConstraintValidation.h" #include "nsIControllers.h" @@ -1040,7 +1040,7 @@ HTMLTextAreaElement::Reset() } NS_IMETHODIMP -HTMLTextAreaElement::SubmitNamesValues(nsFormSubmission* aFormSubmission) +HTMLTextAreaElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission) { // Disabled elements don't submit if (IsDisabled()) { diff --git a/dom/html/HTMLTextAreaElement.h b/dom/html/HTMLTextAreaElement.h index c9b222e9a42d..283fcf7524f2 100644 --- a/dom/html/HTMLTextAreaElement.h +++ b/dom/html/HTMLTextAreaElement.h @@ -21,7 +21,6 @@ #include "nsTextEditorState.h" -class nsFormSubmission; class nsIControllers; class nsIDocument; class nsPresContext; @@ -35,6 +34,8 @@ class EventStates; namespace dom { +class HTMLFormSubmission; + class HTMLTextAreaElement final : public nsGenericHTMLFormElementWithState, public nsIDOMHTMLTextAreaElement, public nsITextControlElement, @@ -72,7 +73,7 @@ public: // nsIFormControl NS_IMETHOD_(uint32_t) GetType() const override { return NS_FORM_TEXTAREA; } NS_IMETHOD Reset() override; - NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) override; + NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override; NS_IMETHOD SaveState() override; virtual bool RestoreState(nsPresState* aState) override; virtual bool IsDisabledForEvents(EventMessage aMessage) override; diff --git a/dom/html/moz.build b/dom/html/moz.build index 67072fb01721..3389e5abb12f 100644 --- a/dom/html/moz.build +++ b/dom/html/moz.build @@ -28,7 +28,6 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'content_html' EXPORTS += [ - 'nsFormSubmission.h', 'nsGenericHTMLElement.h', 'nsHTMLDNSPrefetch.h', 'nsIConstraintValidation.h', @@ -61,6 +60,7 @@ EXPORTS.mozilla.dom += [ 'HTMLFontElement.h', 'HTMLFormControlsCollection.h', 'HTMLFormElement.h', + 'HTMLFormSubmission.h', 'HTMLFrameElement.h', 'HTMLFrameSetElement.h', 'HTMLHeadingElement.h', @@ -140,6 +140,7 @@ UNIFIED_SOURCES += [ 'HTMLFontElement.cpp', 'HTMLFormControlsCollection.cpp', 'HTMLFormElement.cpp', + 'HTMLFormSubmission.cpp', 'HTMLFrameElement.cpp', 'HTMLFrameSetElement.cpp', 'HTMLHeadingElement.cpp', @@ -195,7 +196,6 @@ UNIFIED_SOURCES += [ 'MediaError.cpp', 'nsBrowserElement.cpp', 'nsDOMStringMap.cpp', - 'nsFormSubmission.cpp', 'nsGenericHTMLElement.cpp', 'nsGenericHTMLFrameElement.cpp', 'nsHTMLContentSink.cpp', diff --git a/dom/html/nsIFormControl.h b/dom/html/nsIFormControl.h index 2d9283165922..d4f491a9c1d7 100644 --- a/dom/html/nsIFormControl.h +++ b/dom/html/nsIFormControl.h @@ -11,12 +11,12 @@ class nsIDOMHTMLFormElement; class nsPresState; -class nsFormSubmission; namespace mozilla { namespace dom { class Element; class HTMLFieldSetElement; +class HTMLFormSubmission; } // namespace dom } // namespace mozilla @@ -141,7 +141,8 @@ public: * @param aFormSubmission the form submission to notify of names/values/files * to submit */ - NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) = 0; + NS_IMETHOD + SubmitNamesValues(mozilla::dom::HTMLFormSubmission* aFormSubmission) = 0; /** * Save to presentation state. The form control will determine whether it