From ea5334a7ce57c77f24bcaa4e705a24fb81662aef Mon Sep 17 00:00:00 2001 From: "bryner%brianryner.com" Date: Mon, 21 Jun 2004 23:35:56 +0000 Subject: [PATCH] bringing branch changes forward git-svn-id: svn://10.0.0.236/trunk@158277 18797224-902f-48f8-a5cc-f745e15eee43 --- .../accessible/src/base/nsRootAccessible.cpp | 10 + .../accessible/src/base/nsRootAccessible.h | 2 + mozilla/content/events/src/nsDOMEvent.cpp | 19 +- mozilla/content/events/src/nsDOMEvent.h | 4 +- .../events/src/nsEventListenerManager.cpp | 12 +- .../events/src/nsEventListenerManager.h | 14 +- mozilla/content/html/content/public/nsIForm.h | 10 + .../html/content/public/nsIFormControl.h | 2 + mozilla/content/html/content/src/Makefile.in | 1 + .../html/content/src/nsGenericHTMLElement.cpp | 2 + .../html/content/src/nsGenericHTMLElement.h | 1 + .../html/content/src/nsHTMLFormElement.cpp | 43 +++++ .../html/content/src/nsHTMLInputElement.cpp | 11 +- .../html/content/src/nsHTMLOutputElement.cpp | 175 ++++++++++++++++++ .../content/shared/public/nsLayoutAtomList.h | 2 + .../public/coreEvents/nsIDOMFormListener.h | 3 + mozilla/dom/public/idl/Makefile.in | 3 +- mozilla/dom/public/idl/webforms/Makefile.in | 64 +++++++ .../idl/webforms/nsIWebFormsButtonElement.idl | 64 +++++++ .../webforms/nsIWebFormsFieldSetElement.idl | 45 +++++ .../idl/webforms/nsIWebFormsFormElement.idl | 62 +++++++ .../nsIWebFormsFormImplementation.idl | 56 ++++++ .../idl/webforms/nsIWebFormsInputElement.idl | 67 +++++++ .../idl/webforms/nsIWebFormsLabelElement.idl | 45 +++++ .../idl/webforms/nsIWebFormsOutputElement.idl | 48 +++++ .../webforms/nsIWebFormsRepetitionElement.idl | 58 ++++++ .../webforms/nsIWebFormsRepetitionEvent.idl | 56 ++++++ .../idl/webforms/nsIWebFormsSelectElement.idl | 61 ++++++ .../webforms/nsIWebFormsTextAreaElement.idl | 60 ++++++ mozilla/dom/public/nsIDOMClassInfo.h | 5 +- mozilla/dom/src/base/nsDOMClassInfo.cpp | 24 ++- mozilla/dom/src/base/nsDOMClassInfo.h | 3 + mozilla/layout/base/nsLayoutAtomList.h | 2 + mozilla/layout/forms/nsTextControlFrame.cpp | 15 +- .../html/forms/src/nsTextControlFrame.cpp | 15 +- .../parser/htmlparser/public/nsHTMLTagList.h | 1 + .../parser/htmlparser/src/COtherElements.h | 2 + .../parser/htmlparser/src/nsElementTable.cpp | 11 +- mozilla/parser/htmlparser/src/nsHTMLTags.cpp | 2 + mozilla/widget/public/nsGUIEvent.h | 2 + 40 files changed, 1043 insertions(+), 39 deletions(-) create mode 100644 mozilla/content/html/content/src/nsHTMLOutputElement.cpp create mode 100644 mozilla/dom/public/idl/webforms/Makefile.in create mode 100644 mozilla/dom/public/idl/webforms/nsIWebFormsButtonElement.idl create mode 100644 mozilla/dom/public/idl/webforms/nsIWebFormsFieldSetElement.idl create mode 100644 mozilla/dom/public/idl/webforms/nsIWebFormsFormElement.idl create mode 100644 mozilla/dom/public/idl/webforms/nsIWebFormsFormImplementation.idl create mode 100644 mozilla/dom/public/idl/webforms/nsIWebFormsInputElement.idl create mode 100644 mozilla/dom/public/idl/webforms/nsIWebFormsLabelElement.idl create mode 100644 mozilla/dom/public/idl/webforms/nsIWebFormsOutputElement.idl create mode 100644 mozilla/dom/public/idl/webforms/nsIWebFormsRepetitionElement.idl create mode 100644 mozilla/dom/public/idl/webforms/nsIWebFormsRepetitionEvent.idl create mode 100644 mozilla/dom/public/idl/webforms/nsIWebFormsSelectElement.idl create mode 100644 mozilla/dom/public/idl/webforms/nsIWebFormsTextAreaElement.idl diff --git a/mozilla/accessible/src/base/nsRootAccessible.cpp b/mozilla/accessible/src/base/nsRootAccessible.cpp index 81ce932b1bb..e59a08491b2 100644 --- a/mozilla/accessible/src/base/nsRootAccessible.cpp +++ b/mozilla/accessible/src/base/nsRootAccessible.cpp @@ -629,6 +629,16 @@ NS_IMETHODIMP nsRootAccessible::Input(nsIDOMEvent* aEvent) return NS_OK; } +NS_IMETHODIMP nsRootAccessible::FormChange(nsIDOMEvent* aEvent) +{ + return NS_OK; +} + +NS_IMETHODIMP nsRootAccessible::FormInput(nsIDOMEvent* aEvent) +{ + return NS_OK; +} + // ------- nsIDOMXULListener Methods (8) --------------- NS_IMETHODIMP nsRootAccessible::PopupShowing(nsIDOMEvent* aEvent) { return NS_OK; } diff --git a/mozilla/accessible/src/base/nsRootAccessible.h b/mozilla/accessible/src/base/nsRootAccessible.h index 39e536cc23c..c9cbd3eeb61 100644 --- a/mozilla/accessible/src/base/nsRootAccessible.h +++ b/mozilla/accessible/src/base/nsRootAccessible.h @@ -81,6 +81,8 @@ class nsRootAccessible : public nsDocAccessibleWrap, NS_IMETHOD Change(nsIDOMEvent* aEvent); NS_IMETHOD Select(nsIDOMEvent* aEvent); NS_IMETHOD Input(nsIDOMEvent* aEvent); + NS_IMETHOD FormChange(nsIDOMEvent* aEvent); + NS_IMETHOD FormInput(nsIDOMEvent* aEvent); // ----- nsIDOMXULListener --------------------------- NS_IMETHOD PopupShowing(nsIDOMEvent* aEvent); diff --git a/mozilla/content/events/src/nsDOMEvent.cpp b/mozilla/content/events/src/nsDOMEvent.cpp index 932594088bf..70fa50bb7e7 100644 --- a/mozilla/content/events/src/nsDOMEvent.cpp +++ b/mozilla/content/events/src/nsDOMEvent.cpp @@ -67,8 +67,9 @@ static const char* const sEventNames[] = { "mousedown", "mouseup", "click", "dblclick", "mouseover", "mouseout", "mousemove", "contextmenu", "keydown", "keyup", "keypress", "focus", "blur", "load", "beforeunload", "unload", "abort", "error", - "submit", "reset", "change", "select", "input", "paint" ,"text", - "popupshowing", "popupshown", "popuphiding", "popuphidden", "close", "command", "broadcast", "commandupdate", + "submit", "reset", "change", "input", "formchange", "forminput", "select", + "paint" ,"text", "popupshowing", "popupshown", "popuphiding", "popuphidden", + "close", "command", "broadcast", "commandupdate", "dragenter", "dragover", "dragexit", "dragdrop", "draggesture", "resize", "scroll","overflow", "underflow", "overflowchanged", "DOMSubtreeModified", "DOMNodeInserted", "DOMNodeRemoved", @@ -1161,6 +1162,12 @@ nsDOMEvent::SetEventType(const nsAString& aEventTypeArg) mEvent->message = NS_FORM_RESET; else if (atom == nsLayoutAtoms::onchange) mEvent->message = NS_FORM_CHANGE; + else if (atom == nsLayoutAtoms::oninput) + mEvent->message = NS_FORM_INPUT; + else if (atom == nsLayoutAtoms::onformchange) + mEvent->message = NS_FORM_FORMCHANGE; + else if (atom == nsLayoutAtoms::onforminput) + mEvent->message = NS_FORM_FORMINPUT; else if (atom == nsLayoutAtoms::onselect) mEvent->message = NS_FORM_SELECTED; else if (atom == nsLayoutAtoms::onload) @@ -1479,10 +1486,14 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType) return sEventNames[eDOMEvents_reset]; case NS_FORM_CHANGE: return sEventNames[eDOMEvents_change]; - case NS_FORM_SELECTED: - return sEventNames[eDOMEvents_select]; case NS_FORM_INPUT: return sEventNames[eDOMEvents_input]; + case NS_FORM_FORMCHANGE: + return sEventNames[eDOMEvents_formchange]; + case NS_FORM_FORMINPUT: + return sEventNames[eDOMEvents_forminput]; + case NS_FORM_SELECTED: + return sEventNames[eDOMEvents_select]; case NS_PAINT: return sEventNames[eDOMEvents_paint]; case NS_RESIZE_EVENT: diff --git a/mozilla/content/events/src/nsDOMEvent.h b/mozilla/content/events/src/nsDOMEvent.h index 676e792e3b9..e3fbfa8e306 100644 --- a/mozilla/content/events/src/nsDOMEvent.h +++ b/mozilla/content/events/src/nsDOMEvent.h @@ -92,8 +92,10 @@ public: eDOMEvents_submit, eDOMEvents_reset, eDOMEvents_change, - eDOMEvents_select, eDOMEvents_input, + eDOMEvents_formchange, + eDOMEvents_forminput, + eDOMEvents_select, eDOMEvents_paint, eDOMEvents_text, eDOMEvents_popupShowing, diff --git a/mozilla/content/events/src/nsEventListenerManager.cpp b/mozilla/content/events/src/nsEventListenerManager.cpp index 98e2063a222..8f3fca99602 100644 --- a/mozilla/content/events/src/nsEventListenerManager.cpp +++ b/mozilla/content/events/src/nsEventListenerManager.cpp @@ -221,7 +221,9 @@ static const EventDispatchData sFormEvents[] = { {NS_FORM_RESET, HANDLER(&nsIDOMFormListener::Reset), NS_EVENT_BITS_FORM_RESET}, {NS_FORM_CHANGE, HANDLER(&nsIDOMFormListener::Change),NS_EVENT_BITS_FORM_CHANGE}, {NS_FORM_SELECTED,HANDLER(&nsIDOMFormListener::Select),NS_EVENT_BITS_FORM_SELECT}, - {NS_FORM_INPUT, HANDLER(&nsIDOMFormListener::Input), NS_EVENT_BITS_FORM_INPUT} + {NS_FORM_INPUT, HANDLER(&nsIDOMFormListener::Input), NS_EVENT_BITS_FORM_INPUT}, + {NS_FORM_FORMCHANGE, HANDLER(&nsIDOMFormListener::FormChange), NS_EVENT_BITS_FORM_FORMCHANGE}, + {NS_FORM_FORMINPUT, HANDLER(&nsIDOMFormListener::FormInput), NS_EVENT_BITS_FORM_FORMINPUT} }; static const EventDispatchData sLoadEvents[] = { @@ -853,6 +855,14 @@ nsEventListenerManager::GetIdentifiersForType(nsIAtom* aType, *aArrayType = eEventArrayType_Form; *aFlags = NS_EVENT_BITS_FORM_INPUT; } + else if (aType == nsLayoutAtoms::onformchange) { + *aArrayType = eEventArrayType_Form; + *aFlags = NS_EVENT_BITS_FORM_FORMCHANGE; + } + else if (aType == nsLayoutAtoms::onforminput) { + *aArrayType = eEventArrayType_Form; + *aFlags = NS_EVENT_BITS_FORM_FORMINPUT; + } else if (aType == nsLayoutAtoms::onload) { *aArrayType = eEventArrayType_Load; *aFlags = NS_EVENT_BITS_LOAD_LOAD; diff --git a/mozilla/content/events/src/nsEventListenerManager.h b/mozilla/content/events/src/nsEventListenerManager.h index c847d803d34..745c9207e67 100644 --- a/mozilla/content/events/src/nsEventListenerManager.h +++ b/mozilla/content/events/src/nsEventListenerManager.h @@ -285,12 +285,14 @@ protected: #define NS_EVENT_BITS_FOCUS_BLUR 0x02 //nsIDOMFormListener -#define NS_EVENT_BITS_FORM_NONE 0x00 -#define NS_EVENT_BITS_FORM_SUBMIT 0x01 -#define NS_EVENT_BITS_FORM_RESET 0x02 -#define NS_EVENT_BITS_FORM_CHANGE 0x04 -#define NS_EVENT_BITS_FORM_SELECT 0x08 -#define NS_EVENT_BITS_FORM_INPUT 0x10 +#define NS_EVENT_BITS_FORM_NONE 0x00 +#define NS_EVENT_BITS_FORM_SUBMIT 0x01 +#define NS_EVENT_BITS_FORM_RESET 0x02 +#define NS_EVENT_BITS_FORM_CHANGE 0x04 +#define NS_EVENT_BITS_FORM_SELECT 0x08 +#define NS_EVENT_BITS_FORM_INPUT 0x10 +#define NS_EVENT_BITS_FORM_FORMCHANGE 0x11 +#define NS_EVENT_BITS_FORM_FORMINPUT 0x12 //nsIDOMLoadListener #define NS_EVENT_BITS_LOAD_NONE 0x00 diff --git a/mozilla/content/html/content/public/nsIForm.h b/mozilla/content/html/content/public/nsIForm.h index 80d567a8e48..d21c111bef5 100644 --- a/mozilla/content/html/content/public/nsIForm.h +++ b/mozilla/content/html/content/public/nsIForm.h @@ -184,6 +184,16 @@ public: */ NS_IMETHOD GetActionURL(nsIURI** aActionURL) = 0; + /** + * Fire the Web Forms 2 formchange event on all form controls. + */ + virtual void FireFormChangeEvent() = 0; + + /** + * Fire the Web Forms 2 forminput event on all form controls. + */ + virtual void FireFormInputEvent() = 0; + }; #endif /* nsIForm_h___ */ diff --git a/mozilla/content/html/content/public/nsIFormControl.h b/mozilla/content/html/content/public/nsIFormControl.h index b6d8726902c..bb57ca84eb2 100644 --- a/mozilla/content/html/content/public/nsIFormControl.h +++ b/mozilla/content/html/content/public/nsIFormControl.h @@ -67,6 +67,8 @@ class nsIFormSubmission; #define NS_FORM_SELECT 19 #define NS_FORM_TEXTAREA 20 #define NS_FORM_OBJECT 21 +#define NS_FORM_OUTPUT 22 + #define NS_IFORMCONTROL_IID \ { 0x282ff440, 0xcd7e, 0x11d1, \ diff --git a/mozilla/content/html/content/src/Makefile.in b/mozilla/content/html/content/src/Makefile.in index d031e908d0e..f2181b43696 100644 --- a/mozilla/content/html/content/src/Makefile.in +++ b/mozilla/content/html/content/src/Makefile.in @@ -105,6 +105,7 @@ CPPSRCS = \ nsHTMLObjectElement.cpp \ nsHTMLOptionElement.cpp \ nsHTMLOptGroupElement.cpp \ + nsHTMLOutputElement.cpp \ nsHTMLParagraphElement.cpp \ nsHTMLPreElement.cpp \ nsHTMLScriptElement.cpp \ diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 9be401d7e2f..54c79ce3140 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -1741,6 +1741,8 @@ PRBool nsGenericHTMLElement::IsEventName(nsIAtom* aName) aName == nsLayoutAtoms::onabort || aName == nsLayoutAtoms::onerror || aName == nsLayoutAtoms::onfocus || + aName == nsLayoutAtoms::onformchange || + aName == nsLayoutAtoms::onforminput || aName == nsLayoutAtoms::onblur || aName == nsLayoutAtoms::onsubmit || aName == nsLayoutAtoms::onreset || diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.h b/mozilla/content/html/content/src/nsGenericHTMLElement.h index 0aaff53d3b2..c9a0cbde1fa 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.h +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.h @@ -1206,6 +1206,7 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList) NS_DECLARE_NS_NEW_HTML_ELEMENT(Object) NS_DECLARE_NS_NEW_HTML_ELEMENT(OptGroup) NS_DECLARE_NS_NEW_HTML_ELEMENT(Option) +NS_DECLARE_NS_NEW_HTML_ELEMENT(Output) NS_DECLARE_NS_NEW_HTML_ELEMENT(Paragraph) NS_DECLARE_NS_NEW_HTML_ELEMENT(Pre) NS_DECLARE_NS_NEW_HTML_ELEMENT(Script) diff --git a/mozilla/content/html/content/src/nsHTMLFormElement.cpp b/mozilla/content/html/content/src/nsHTMLFormElement.cpp index 4512764c6fb..e8f89e3dd0e 100644 --- a/mozilla/content/html/content/src/nsHTMLFormElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFormElement.cpp @@ -141,6 +141,8 @@ public: NS_IMETHOD FlushPendingSubmission(); NS_IMETHOD ForgetPendingSubmission(); NS_IMETHOD GetActionURL(nsIURI** aActionURL); + virtual void FireFormChangeEvent(); + virtual void FireFormInputEvent(); // nsIRadioGroupContainer NS_IMETHOD SetCurrentRadioButton(const nsAString& aName, @@ -250,6 +252,9 @@ protected: */ nsresult NotifySubmitObservers(nsIURI* aActionURL, PRBool* aCancelSubmit); + // Helper to fire events on all form controls in this form + void FireEventOnControls(PRInt32 aEventType); + // // Data members // @@ -379,6 +384,7 @@ ShouldBeInElements(nsIFormControl* aFormControl) case NS_FORM_TEXTAREA : case NS_FORM_FIELDSET : case NS_FORM_OBJECT : + case NS_FORM_OUTPUT : return PR_TRUE; } @@ -1297,6 +1303,43 @@ nsHTMLFormElement::GetActionURL(nsIURI** aActionURL) return rv; } +void +nsHTMLFormElement::FireEventOnControls(PRInt32 aEventType) +{ + if (!mDocument) { + return; + } + + nsIPresShell *shell = mDocument->GetShellAt(0); + + if (!shell) { + return; + } + + for (PRInt32 i = mControls->mElements.Count()-1; i >= 0; i--) { + nsCOMPtr f = + do_QueryInterface(NS_STATIC_CAST(nsIFormControl *, + mControls->mElements.ElementAt(i))); + nsEventStatus status = nsEventStatus_eIgnore; + nsGUIEvent event(aEventType); + + shell->HandleEventWithTarget(&event, nsnull, f, NS_EVENT_FLAG_INIT, + &status); + } +} + +void +nsHTMLFormElement::FireFormChangeEvent() +{ + FireEventOnControls(NS_FORM_FORMCHANGE); +} + +void +nsHTMLFormElement::FireFormInputEvent() +{ + FireEventOnControls(NS_FORM_FORMINPUT); +} + NS_IMETHODIMP nsHTMLFormElement::GetEncoding(nsAString& aEncoding) { diff --git a/mozilla/content/html/content/src/nsHTMLInputElement.cpp b/mozilla/content/html/content/src/nsHTMLInputElement.cpp index 95d8403cc2a..a6cd943e835 100644 --- a/mozilla/content/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInputElement.cpp @@ -1364,11 +1364,20 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext, PRInt32 oldType = mType; // Try script event handlers first if its not a focus/blur event - //we dont want the doc to get these + // we dont want the doc to get these rv = nsGenericHTMLFormElement::HandleDOMEvent(aPresContext, aEvent, aDOMEvent, aFlags, aEventStatus); + if (aEvent->message == NS_FORM_INPUT && + !(aFlags & NS_EVENT_FLAG_SYSTEM_EVENT)) { + if (mForm) { + mForm->FireFormInputEvent(); + } + + return NS_OK; + } + // Ideally we would make the default action for click and space just dispatch // DOMActivate, and the default action for DOMActivate flip the checkbox/ // radio state and fire onchange. However, for backwards compatibility, we diff --git a/mozilla/content/html/content/src/nsHTMLOutputElement.cpp b/mozilla/content/html/content/src/nsHTMLOutputElement.cpp new file mode 100644 index 00000000000..db4e9eab9c4 --- /dev/null +++ b/mozilla/content/html/content/src/nsHTMLOutputElement.cpp @@ -0,0 +1,175 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +#include "nsIWebFormsOutputElement.h" +//#include "nsIDOMEventReceiver.h" +#include "nsIHTMLContent.h" +#include "nsGenericHTMLElement.h" +#include "nsHTMLAtoms.h" +#include "nsStyleConsts.h" +#include "nsIPresContext.h" +#include "nsMappedAttributes.h" +#include "nsRuleNode.h" + + +class nsHTMLOutputElement : public nsGenericHTMLFormElement, + public nsIWebFormsOutputElement +{ +public: + nsHTMLOutputElement(nsINodeInfo *aNodeInfo); + virtual ~nsHTMLOutputElement(); + + // nsISupports + NS_DECL_ISUPPORTS_INHERITED + + // nsIWebFormsOutputElement + NS_DECL_NSIWEBFORMSOUTPUTELEMENT + + // nsIDOMNode + NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLFormElement::) + + // nsIDOMElement + NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::) + + // nsIDOMHTMLElement + NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::) + + // nsIFormControl + NS_IMETHOD_(PRInt32) GetType() + { + return NS_FORM_OUTPUT; + } + NS_IMETHOD Reset(); + NS_IMETHOD SubmitNamesValues(nsIFormSubmission* aFormSubmission, + nsIContent* aSubmitElement); +}; + + +NS_IMPL_NS_NEW_HTML_ELEMENT(Output) + + +nsHTMLOutputElement::nsHTMLOutputElement(nsINodeInfo *aNodeInfo) + : nsGenericHTMLFormElement(aNodeInfo) +{ +} + +nsHTMLOutputElement::~nsHTMLOutputElement() +{ +} + + +NS_IMPL_ADDREF_INHERITED(nsHTMLOutputElement, nsGenericElement) +NS_IMPL_RELEASE_INHERITED(nsHTMLOutputElement, nsGenericElement) + + + +// QueryInterface implementation for nsHTMLOutputElement +NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLOutputElement, + nsGenericHTMLFormElement) + NS_INTERFACE_MAP_ENTRY(nsIWebFormsOutputElement) + NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLOutputElement) +NS_HTML_CONTENT_INTERFACE_MAP_END + + +NS_IMPL_HTML_DOM_CLONENODE(Output) + + +/* attribute DOMString defaultValue; */ +NS_IMETHODIMP +nsHTMLOutputElement::GetDefaultValue(nsAString & aDefaultValue) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} +NS_IMETHODIMP +nsHTMLOutputElement::SetDefaultValue(const nsAString & aDefaultValue) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* readonly attribute nsIDOMHTMLFormElement form; */ +NS_IMETHODIMP +nsHTMLOutputElement::GetForm(nsIDOMHTMLFormElement * *aForm) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* attribute DOMString name; */ +NS_IMETHODIMP +nsHTMLOutputElement::GetName(nsAString & aName) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} +NS_IMETHODIMP +nsHTMLOutputElement::SetName(const nsAString & aName) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +/* attribute DOMString value; */ +NS_IMETHODIMP +nsHTMLOutputElement::GetValue(nsAString & aValue) +{ + nsresult rv; + nsCOMPtr node3 = + do_QueryInterface(NS_STATIC_CAST(nsIWebFormsOutputElement *, this), &rv); + NS_ENSURE_SUCCESS(rv, rv); + + return node3->GetTextContent(aValue); +} + +NS_IMETHODIMP +nsHTMLOutputElement::SetValue(const nsAString & aValue) +{ + nsresult rv; + nsCOMPtr node3 = + do_QueryInterface(NS_STATIC_CAST(nsIWebFormsOutputElement *, this), &rv); + NS_ENSURE_SUCCESS(rv, rv); + + return node3->SetTextContent(aValue); +} + +NS_IMETHODIMP +nsHTMLOutputElement::Reset() +{ + return NS_OK; +} + +NS_IMETHODIMP +nsHTMLOutputElement::SubmitNamesValues(nsIFormSubmission* aFormSubmission, + nsIContent* aSubmitElement) +{ + return NS_OK; +} diff --git a/mozilla/content/shared/public/nsLayoutAtomList.h b/mozilla/content/shared/public/nsLayoutAtomList.h index 6e42dff67b8..3091c746303 100644 --- a/mozilla/content/shared/public/nsLayoutAtomList.h +++ b/mozilla/content/shared/public/nsLayoutAtomList.h @@ -169,6 +169,8 @@ LAYOUT_ATOM(ondraggesture, "ondraggesture") LAYOUT_ATOM(ondragover, "ondragover") LAYOUT_ATOM(onerror, "onerror") LAYOUT_ATOM(onfocus, "onfocus") +LAYOUT_ATOM(onformchange, "onformchange") +LAYOUT_ATOM(onforminput, "onforminput") LAYOUT_ATOM(oninput, "oninput") LAYOUT_ATOM(onkeydown, "onkeydown") LAYOUT_ATOM(onkeypress, "onkeypress") diff --git a/mozilla/dom/public/coreEvents/nsIDOMFormListener.h b/mozilla/dom/public/coreEvents/nsIDOMFormListener.h index 6738674fb9a..7092cfc6ef2 100644 --- a/mozilla/dom/public/coreEvents/nsIDOMFormListener.h +++ b/mozilla/dom/public/coreEvents/nsIDOMFormListener.h @@ -90,6 +90,9 @@ public: */ NS_IMETHOD Input(nsIDOMEvent* aEvent) = 0; + NS_IMETHOD FormChange(nsIDOMEvent* aEvent) = 0; + + NS_IMETHOD FormInput(nsIDOMEvent* aEvent) = 0; }; #endif // nsIDOMFormListener_h__ diff --git a/mozilla/dom/public/idl/Makefile.in b/mozilla/dom/public/idl/Makefile.in index 40010df0eec..8edd36c438f 100644 --- a/mozilla/dom/public/idl/Makefile.in +++ b/mozilla/dom/public/idl/Makefile.in @@ -54,7 +54,8 @@ DIRS = \ range \ xbl \ xpath \ - xul + xul \ + webforms ifdef MOZ_SVG DIRS += svg diff --git a/mozilla/dom/public/idl/webforms/Makefile.in b/mozilla/dom/public/idl/webforms/Makefile.in new file mode 100644 index 00000000000..ea6efe06994 --- /dev/null +++ b/mozilla/dom/public/idl/webforms/Makefile.in @@ -0,0 +1,64 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# IBM Corporation. +# Portions created by the Initial Developer are Copyright (C) 2004 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Brian Ryner +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = dom +XPIDL_MODULE = dom_webforms +GRE_MODULE = 1 + +XPIDLSRCS = \ + nsIWebFormsButtonElement.idl \ + nsIWebFormsFieldSetElement.idl \ + nsIWebFormsFormElement.idl \ + nsIWebFormsFormImplementation.idl \ + nsIWebFormsInputElement.idl \ + nsIWebFormsLabelElement.idl \ + nsIWebFormsOutputElement.idl \ + nsIWebFormsRepetitionElement.idl \ + nsIWebFormsRepetitionEvent.idl \ + nsIWebFormsSelectElement.idl \ + nsIWebFormsTextAreaElement.idl \ + $(NULL) + +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/dom/public/idl/webforms/nsIWebFormsButtonElement.idl b/mozilla/dom/public/idl/webforms/nsIWebFormsButtonElement.idl new file mode 100644 index 00000000000..904b28f9d54 --- /dev/null +++ b/mozilla/dom/public/idl/webforms/nsIWebFormsButtonElement.idl @@ -0,0 +1,64 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * IBM Corporation. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Brian Ryner + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIDOMHTMLButtonElement.idl" + +interface nsIWebFormsRepetitionElement; + +[scriptable, uuid(c6b1dbab-9be8-44ef-a9a5-7ba6c8b6c2b9)] +interface nsIWebFormsButtonElement : nsIDOMHTMLButtonElement +{ + // defined in nsIDOMNSHTMLButtonElemenet + // attribute DOMString type; + // void blur(); + // void focus(); + + attribute DOMString action; + attribute DOMString enctype; + attribute DOMString method; + attribute DOMString replace; + attribute boolean autofocus; + readonly attribute nsIDOMHTMLCollection labels; + readonly attribute nsIWebFormsRepetitionElement template; + + readonly attribute boolean successful; + readonly attribute long validity; + readonly attribute DOMString validationMessage; + boolean validate(); + void setCustomValidity(in DOMString error); +}; diff --git a/mozilla/dom/public/idl/webforms/nsIWebFormsFieldSetElement.idl b/mozilla/dom/public/idl/webforms/nsIWebFormsFieldSetElement.idl new file mode 100644 index 00000000000..913a8ebad65 --- /dev/null +++ b/mozilla/dom/public/idl/webforms/nsIWebFormsFieldSetElement.idl @@ -0,0 +1,45 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * IBM Corporation. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Brian Ryner + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIDOMHTMLFieldSetElement.idl" + +[scriptable, uuid(a9c6533b-4870-467a-b3f3-1f1bbd01ae65)] +interface nsIWebFormsFieldSetElement : nsIDOMHTMLFieldSetElement +{ + attribute boolean disabled; +}; diff --git a/mozilla/dom/public/idl/webforms/nsIWebFormsFormElement.idl b/mozilla/dom/public/idl/webforms/nsIWebFormsFormElement.idl new file mode 100644 index 00000000000..55e2054cc00 --- /dev/null +++ b/mozilla/dom/public/idl/webforms/nsIWebFormsFormElement.idl @@ -0,0 +1,62 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * IBM Corporation. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Brian Ryner + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIDOMHTMLFormElement.idl" + +[scriptable, uuid(d494e5e7-15dc-48de-930a-14ceee9833fc)] +interface nsIWebFormsFormElement : nsIDOMHTMLFormElement +{ + const unsigned short ERROR_TYPE_MISMATCH = 1; + const unsigned short ERROR_RANGE_UNDERFLOW = 2; + const unsigned short ERROR_RANGE_OVERFLOW = 4; + const unsigned short ERROR_PRECISION_EXCEEDED = 8; + const unsigned short ERROR_TOO_LONG = 16; + const unsigned short ERROR_PATTERN_MISMATCH = 32; + const unsigned short ERROR_REQUIRED = 64; + const unsigned short ERROR_CUSTOM = 32768; + + attribute DOMString accept; + attribute DOMString replace; + readonly attribute nsIDOMHTMLCollection templateElements; + boolean validate(); + boolean willConsiderForSubmission(in nsIDOMElement element); + void resetFromData(in nsIDOMDocument data); + + void dispatchFormInput(); + void dispatchFormChange(); +}; diff --git a/mozilla/dom/public/idl/webforms/nsIWebFormsFormImplementation.idl b/mozilla/dom/public/idl/webforms/nsIWebFormsFormImplementation.idl new file mode 100644 index 00000000000..e2d0d84928f --- /dev/null +++ b/mozilla/dom/public/idl/webforms/nsIWebFormsFormImplementation.idl @@ -0,0 +1,56 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * IBM Corporation. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Brian Ryner + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" +#include "domstubs.idl" + +[scriptable, uuid(d2b27519-fc6f-43a9-99fb-94beed0108a7)] +interface nsIWebFormsFormImplementation : nsISupports +{ + nsIDOMDocument load(in DOMString action, + in nsIDOMEventListener load, + in nsIDOMEventListener error); + nsIDOMDocument loadWithBody(in DOMString action, in DOMString method, + in DOMString enctype, in DOMString content, + in nsIDOMEventListener load, + in nsIDOMEventListener error); + nsIDOMDocument loadWithDocument(in DOMString action, in DOMString method, + in nsIDOMDocument document, + in nsIDOMEventListener load, + in nsIDOMEventListener error); +}; diff --git a/mozilla/dom/public/idl/webforms/nsIWebFormsInputElement.idl b/mozilla/dom/public/idl/webforms/nsIWebFormsInputElement.idl new file mode 100644 index 00000000000..6cfe48720c6 --- /dev/null +++ b/mozilla/dom/public/idl/webforms/nsIWebFormsInputElement.idl @@ -0,0 +1,67 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * IBM Corporation. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Brian Ryner + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIDOMHTMLInputElement.idl" + +interface nsIWebFormsRepetitionElement; + +[scriptable, uuid(3d3cc7ae-c6e7-48fd-aca1-481d048d4382)] +interface nsIWebFormsInputElement : nsIDOMHTMLInputElement +{ + attribute DOMString min; + attribute DOMString max; + attribute DOMString pattern; + attribute boolean required; + attribute boolean autocomplete; + attribute boolean autofocus; + attribute DOMString inputmode; + readonly attribute nsIWebFormsRepetitionElement template; + readonly attribute nsIDOMHTMLCollection labels; + + attribute DOMString action; + attribute DOMString enctype; + attribute DOMString method; + attribute DOMString replace; + readonly attribute boolean successful; + readonly attribute long validity; + readonly attribute DOMString validationMessage; + boolean validate(); + void setCustomValidity(in DOMString error); + void changed(); + void formchanged(); +}; diff --git a/mozilla/dom/public/idl/webforms/nsIWebFormsLabelElement.idl b/mozilla/dom/public/idl/webforms/nsIWebFormsLabelElement.idl new file mode 100644 index 00000000000..085d7faa59c --- /dev/null +++ b/mozilla/dom/public/idl/webforms/nsIWebFormsLabelElement.idl @@ -0,0 +1,45 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * IBM Corporation. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Brian Ryner + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIDOMHTMLLabelElement.idl" + +[scriptable, uuid(ba83b71e-41d7-4e4e-8f8c-6e73bc74fc9d)] +interface nsIWebFormsLabelElement : nsIDOMHTMLLabelElement +{ + readonly attribute nsIDOMElement control; +}; diff --git a/mozilla/dom/public/idl/webforms/nsIWebFormsOutputElement.idl b/mozilla/dom/public/idl/webforms/nsIWebFormsOutputElement.idl new file mode 100644 index 00000000000..f1f7e06f4b8 --- /dev/null +++ b/mozilla/dom/public/idl/webforms/nsIWebFormsOutputElement.idl @@ -0,0 +1,48 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * IBM Corporation. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Brian Ryner + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIDOMHTMLElement.idl" + +[scriptable, uuid(2c80c165-fb46-4265-9ca4-2e22dc457be4)] +interface nsIWebFormsOutputElement : nsIDOMHTMLElement +{ + attribute DOMString defaultValue; + readonly attribute nsIDOMHTMLFormElement form; + attribute DOMString name; + attribute DOMString value; +}; diff --git a/mozilla/dom/public/idl/webforms/nsIWebFormsRepetitionElement.idl b/mozilla/dom/public/idl/webforms/nsIWebFormsRepetitionElement.idl new file mode 100644 index 00000000000..c17191be795 --- /dev/null +++ b/mozilla/dom/public/idl/webforms/nsIWebFormsRepetitionElement.idl @@ -0,0 +1,58 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * IBM Corporation. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Brian Ryner + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" +#include "domstubs.idl" + +[scriptable, uuid(cc110f1c-3adc-4448-95f2-19a24f8ad8d5)] +interface nsIWebFormsRepetitionElement : nsISupports +{ + const unsigned short REPETITION_NONE = 0; + const unsigned short REPETITION_TEMPLATE = 1; + const unsigned short REPETITION_BLOCK = 2; + + attribute unsigned short repetitionType; + attribute long repetitionIndex; + readonly attribute nsIDOMElement repetitionTemplate; + readonly attribute nsIDOMHTMLCollection repetitionBlocks; + void addRepetitionBlock(in nsIDOMNode refNode); + void addRepetitionBlockByIndex(in nsIDOMNode refNode, + in long index); + void moveRepetitionBlock(in long distance); + void removeRepetitionBlock(); +}; diff --git a/mozilla/dom/public/idl/webforms/nsIWebFormsRepetitionEvent.idl b/mozilla/dom/public/idl/webforms/nsIWebFormsRepetitionEvent.idl new file mode 100644 index 00000000000..1e91434b084 --- /dev/null +++ b/mozilla/dom/public/idl/webforms/nsIWebFormsRepetitionEvent.idl @@ -0,0 +1,56 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * IBM Corporation. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Brian Ryner + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIDOMEvent.idl" + +interface nsIWebFormsRepetitionElement; + +[scriptable, uuid(bf17dc6a-efd2-4a69-94bd-9733f7f295d2)] +interface nsIWebFormsRepetitionEvent : nsIDOMEvent +{ + readonly attribute nsIWebFormsRepetitionElement element; + void initRepetitionEvent(in DOMString typeArg, + in boolean canBubbleArg, + in boolean cancelableArg, + in nsIWebFormsRepetitionElement elementArg); + void initRepetitionEventNS(in DOMString namespaceURIArg, + in DOMString typeArg, + in boolean canBubbleArg, + in boolean cancelableArg, + in nsIWebFormsRepetitionElement elementArg); +}; diff --git a/mozilla/dom/public/idl/webforms/nsIWebFormsSelectElement.idl b/mozilla/dom/public/idl/webforms/nsIWebFormsSelectElement.idl new file mode 100644 index 00000000000..bc39a0c320e --- /dev/null +++ b/mozilla/dom/public/idl/webforms/nsIWebFormsSelectElement.idl @@ -0,0 +1,61 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * IBM Corporation. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Brian Ryner + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIDOMHTMLSelectElement.idl" + +[scriptable, uuid(dc35f909-8545-483d-92bc-78e52a5d61ba)] +interface nsIWebFormsSelectElement : nsIDOMHTMLSelectElement +{ + attribute boolean editable; + attribute DOMString pattern; + attribute boolean required; + attribute boolean autocomplete; + attribute boolean autofocus; + attribute DOMString inputmode; + attribute long maxLength; + readonly attribute nsIDOMHTMLCollection selectedOptions; + readonly attribute nsIDOMHTMLCollection labels; + + readonly attribute boolean successful; + readonly attribute long validity; + readonly attribute DOMString validationMessage; + boolean validate(); + void setCustomValidity(in DOMString error); + void changed(); + void formchanged(); +}; diff --git a/mozilla/dom/public/idl/webforms/nsIWebFormsTextAreaElement.idl b/mozilla/dom/public/idl/webforms/nsIWebFormsTextAreaElement.idl new file mode 100644 index 00000000000..fc62427cd46 --- /dev/null +++ b/mozilla/dom/public/idl/webforms/nsIWebFormsTextAreaElement.idl @@ -0,0 +1,60 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * IBM Corporation. + * Portions created by the Initial Developer are Copyright (C) 2004 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Brian Ryner + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIDOMHTMLTextAreaElement.idl" + +[scriptable, uuid(b0b40732-bb66-4fc2-be54-5fc0ecf79e88)] +interface nsIWebFormsTextAreaElement : nsIDOMHTMLTextAreaElement +{ + attribute DOMString wrap; + attribute DOMString pattern; + attribute boolean required; + attribute boolean autocomplete; + attribute boolean autofocus; + attribute DOMString inputmode; + attribute long maxLength; + readonly attribute nsIDOMHTMLCollection labels; + + readonly attribute boolean successful; + readonly attribute long validity; + readonly attribute DOMString validationMessage; + boolean validate(); + void setCustomValidity(in DOMString error); + void changed(); + void formchanged(); +}; diff --git a/mozilla/dom/public/nsIDOMClassInfo.h b/mozilla/dom/public/nsIDOMClassInfo.h index 10533d6ef5b..df7f8590d10 100644 --- a/mozilla/dom/public/nsIDOMClassInfo.h +++ b/mozilla/dom/public/nsIDOMClassInfo.h @@ -291,7 +291,10 @@ enum nsDOMClassInfoID { eDOMClassInfo_SVGImageElement_id, eDOMClassInfo_SVGStyleElement_id, #endif //MOZ_SVG - + + // WebForms 2.0 classes + eDOMClassInfo_HTMLOutputElement_id, + // This one better be the last one in this list eDOMClassInfoIDCount }; diff --git a/mozilla/dom/src/base/nsDOMClassInfo.cpp b/mozilla/dom/src/base/nsDOMClassInfo.cpp index 7dc6bfe033c..92ba2b5a1be 100644 --- a/mozilla/dom/src/base/nsDOMClassInfo.cpp +++ b/mozilla/dom/src/base/nsDOMClassInfo.cpp @@ -338,6 +338,9 @@ #include "nsIImageDocument.h" +#include "nsIWebFormsOutputElement.h" + + static NS_DEFINE_CID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID); @@ -880,6 +883,9 @@ static nsDOMClassInfoData sClassInfoData[] = { NS_DEFINE_CLASSINFO_DATA(SVGStyleElement, nsElementSH, ELEMENT_SCRIPTABLE_FLAGS) #endif + + NS_DEFINE_CLASSINFO_DATA(HTMLOutputElement, nsHTMLElementSH, + ELEMENT_SCRIPTABLE_FLAGS) }; nsIXPConnect *nsDOMClassInfo::sXPConnect = nsnull; @@ -928,6 +934,9 @@ jsval nsDOMClassInfo::sOnblur_id = JSVAL_VOID; jsval nsDOMClassInfo::sOnsubmit_id = JSVAL_VOID; jsval nsDOMClassInfo::sOnreset_id = JSVAL_VOID; jsval nsDOMClassInfo::sOnchange_id = JSVAL_VOID; +jsval nsDOMClassInfo::sOninput_id = JSVAL_VOID; +jsval nsDOMClassInfo::sOnformchange_id = JSVAL_VOID; +jsval nsDOMClassInfo::sOnforminput_id = JSVAL_VOID; jsval nsDOMClassInfo::sOnselect_id = JSVAL_VOID; jsval nsDOMClassInfo::sOnload_id = JSVAL_VOID; jsval nsDOMClassInfo::sOnbeforeunload_id = JSVAL_VOID; @@ -1033,6 +1042,9 @@ nsDOMClassInfo::DefineStaticJSVals(JSContext *cx) SET_JSVAL_TO_STRING(sOnsubmit_id, cx, "onsubmit"); SET_JSVAL_TO_STRING(sOnreset_id, cx, "onreset"); SET_JSVAL_TO_STRING(sOnchange_id, cx, "onchange"); + SET_JSVAL_TO_STRING(sOninput_id, cx, "oninput"); + SET_JSVAL_TO_STRING(sOnformchange_id, cx, "onformchange"); + SET_JSVAL_TO_STRING(sOnforminput_id, cx, "onforminput"); SET_JSVAL_TO_STRING(sOnselect_id, cx, "onselect"); SET_JSVAL_TO_STRING(sOnload_id, cx, "onload"); SET_JSVAL_TO_STRING(sOnbeforeunload_id, cx, "onbeforeunload"); @@ -2354,6 +2366,11 @@ nsDOMClassInfo::Init() #endif //MOZ_SVG + DOM_CLASSINFO_MAP_BEGIN(HTMLOutputElement, nsIWebFormsOutputElement) + DOM_CLASSINFO_MAP_ENTRY(nsIWebFormsOutputElement) + DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES + DOM_CLASSINFO_MAP_END + #ifdef NS_DEBUG { PRUint32 i = sizeof(sClassInfoData) / sizeof(sClassInfoData[0]); @@ -2933,6 +2950,9 @@ nsDOMClassInfo::ShutDown() sOnsubmit_id = JSVAL_VOID; sOnreset_id = JSVAL_VOID; sOnchange_id = JSVAL_VOID; + sOninput_id = JSVAL_VOID; + sOnformchange_id = JSVAL_VOID; + sOnforminput_id = JSVAL_VOID; sOnselect_id = JSVAL_VOID; sOnload_id = JSVAL_VOID; sOnbeforeunload_id = JSVAL_VOID; @@ -4624,7 +4644,9 @@ nsEventReceiverSH::ReallyIsEventName(jsval id, jschar aFirstChar) case 'e' : return id == sOnerror_id; case 'f' : - return id == sOnfocus_id; + return (id == sOnfocus_id || + id == sOnformchange_id || + id == sOnforminput_id); case 'c' : return (id == sOnchange_id || id == sOnclick_id || diff --git a/mozilla/dom/src/base/nsDOMClassInfo.h b/mozilla/dom/src/base/nsDOMClassInfo.h index ea828913cf1..61ea5589dac 100644 --- a/mozilla/dom/src/base/nsDOMClassInfo.h +++ b/mozilla/dom/src/base/nsDOMClassInfo.h @@ -237,6 +237,9 @@ protected: static jsval sOnsubmit_id; static jsval sOnreset_id; static jsval sOnchange_id; + static jsval sOninput_id; + static jsval sOnformchange_id; + static jsval sOnforminput_id; static jsval sOnselect_id; static jsval sOnload_id; static jsval sOnbeforeunload_id; diff --git a/mozilla/layout/base/nsLayoutAtomList.h b/mozilla/layout/base/nsLayoutAtomList.h index 6e42dff67b8..3091c746303 100644 --- a/mozilla/layout/base/nsLayoutAtomList.h +++ b/mozilla/layout/base/nsLayoutAtomList.h @@ -169,6 +169,8 @@ LAYOUT_ATOM(ondraggesture, "ondraggesture") LAYOUT_ATOM(ondragover, "ondragover") LAYOUT_ATOM(onerror, "onerror") LAYOUT_ATOM(onfocus, "onfocus") +LAYOUT_ATOM(onformchange, "onformchange") +LAYOUT_ATOM(onforminput, "onforminput") LAYOUT_ATOM(oninput, "oninput") LAYOUT_ATOM(onkeydown, "onkeydown") LAYOUT_ATOM(onkeypress, "onkeypress") diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index f6e4c1b9c8e..e9565ba9e8e 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -2827,14 +2827,7 @@ nsTextControlFrame::FireOnInput() return; } - nsCOMPtr context; - presShell->GetPresContext(getter_AddRefs(context)); - NS_ASSERTION(context, "No pres context"); - if (!context) { - return; - } - - presShell->HandleEventWithTarget(&event, nsnull, mContent, + presShell->HandleEventWithTarget(&event, this, mContent, NS_EVENT_FLAG_INIT, &status); } @@ -2871,9 +2864,9 @@ nsTextControlFrame::FireOnChange() nsWeakPtr &shell = mTextSelImpl->GetPresShell(); nsCOMPtr presShell = do_QueryReferent(shell); NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); - nsCOMPtr context; - if (NS_SUCCEEDED(presShell->GetPresContext(getter_AddRefs(context))) && context) - return presShell->HandleEventWithTarget(&event, nsnull, mContent, NS_EVENT_FLAG_INIT, &status); + + return presShell->HandleEventWithTarget(&event, this, mContent, + NS_EVENT_FLAG_INIT, &status); } return NS_OK; } diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp index f6e4c1b9c8e..e9565ba9e8e 100644 --- a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp @@ -2827,14 +2827,7 @@ nsTextControlFrame::FireOnInput() return; } - nsCOMPtr context; - presShell->GetPresContext(getter_AddRefs(context)); - NS_ASSERTION(context, "No pres context"); - if (!context) { - return; - } - - presShell->HandleEventWithTarget(&event, nsnull, mContent, + presShell->HandleEventWithTarget(&event, this, mContent, NS_EVENT_FLAG_INIT, &status); } @@ -2871,9 +2864,9 @@ nsTextControlFrame::FireOnChange() nsWeakPtr &shell = mTextSelImpl->GetPresShell(); nsCOMPtr presShell = do_QueryReferent(shell); NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); - nsCOMPtr context; - if (NS_SUCCEEDED(presShell->GetPresContext(getter_AddRefs(context))) && context) - return presShell->HandleEventWithTarget(&event, nsnull, mContent, NS_EVENT_FLAG_INIT, &status); + + return presShell->HandleEventWithTarget(&event, this, mContent, + NS_EVENT_FLAG_INIT, &status); } return NS_OK; } diff --git a/mozilla/parser/htmlparser/public/nsHTMLTagList.h b/mozilla/parser/htmlparser/public/nsHTMLTagList.h index 70def89f2b5..d02ebcdb926 100644 --- a/mozilla/parser/htmlparser/public/nsHTMLTagList.h +++ b/mozilla/parser/htmlparser/public/nsHTMLTagList.h @@ -138,6 +138,7 @@ HTML_TAG(object, Object) HTML_TAG(ol, SharedList) HTML_TAG(optgroup, OptGroup) HTML_TAG(option, Option) +HTML_TAG(output, Output) HTML_TAG(p, Paragraph) HTML_TAG(param, Shared) HTML_TAG(parsererror, Div) diff --git a/mozilla/parser/htmlparser/src/COtherElements.h b/mozilla/parser/htmlparser/src/COtherElements.h index 7d40be9428a..e7c05f38058 100644 --- a/mozilla/parser/htmlparser/src/COtherElements.h +++ b/mozilla/parser/htmlparser/src/COtherElements.h @@ -2341,6 +2341,8 @@ void CElementTable::InitializeElements() { mDfltElements[eHTMLTag_option].mContainsGroups.mAllBits=0; mDfltElements[eHTMLTag_option].mContainsGroups.mBits.mLeaf=1; + CElement::Initialize( mDfltElements[eHTMLTag_output], eHTMLTag_output, CBlockElement::GetGroup(), CFlowElement::GetContainedGroups()); + CElement::Initialize( mDfltElements[eHTMLTag_p], eHTMLTag_p, CBlockElement::GetGroup(), CInlineElement::GetContainedGroups()); mDfltElements[eHTMLTag_p].mContainsGroups.mBits.mSelf=0; diff --git a/mozilla/parser/htmlparser/src/nsElementTable.cpp b/mozilla/parser/htmlparser/src/nsElementTable.cpp index c951b3af6fa..0fa4a19f701 100644 --- a/mozilla/parser/htmlparser/src/nsElementTable.cpp +++ b/mozilla/parser/htmlparser/src/nsElementTable.cpp @@ -154,7 +154,7 @@ DECL_TAG_LIST(gHRAutoClose,{eHTMLTag_p}) DECL_TAG_LIST(gOLAutoClose,{eHTMLTag_p COMMA eHTMLTag_ol}) DECL_TAG_LIST(gDivAutoClose,{eHTMLTag_p}) // Form controls that autoclose