diff --git a/content/html/content/src/makefile.win b/content/html/content/src/makefile.win
index 4b7ae1acf701..58674a512233 100644
--- a/content/html/content/src/makefile.win
+++ b/content/html/content/src/makefile.win
@@ -94,7 +94,7 @@ CPPSRCS= \
CPP_OBJS= \
.\$(OBJDIR)\nsGenericHTMLElement.obj \
.\$(OBJDIR)\nsGenericDOMHTMLCollection.obj \
- .\$(OBJDIR)\GenericElementCollection.obj \
+ .\$(OBJDIR)\GenericElementCollection.obj \
.\$(OBJDIR)\nsHTMLAnchorElement.obj \
.\$(OBJDIR)\nsHTMLAppletElement.obj \
.\$(OBJDIR)\nsHTMLAreaElement.obj \
diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp
index e1cedf4485a1..314b2c586719 100644
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -73,6 +73,9 @@
#include "prprf.h"
#include "prmem.h"
#include "nsIFormControlFrame.h"
+#include "nsIForm.h"
+#include "nsIFormControl.h"
+#include "nsIDOMHTMLFormElement.h"
// XXX todo: add in missing out-of-memory checks
NS_DEFINE_IID(kIDOMHTMLElementIID, NS_IDOMHTMLELEMENT_IID);
@@ -90,6 +93,7 @@ static NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMNODE_IID);
static NS_DEFINE_IID(kIDOMDocumentFragmentIID, NS_IDOMDOCUMENTFRAGMENT_IID);
static NS_DEFINE_IID(kIHTMLContentContainerIID, NS_IHTMLCONTENTCONTAINER_IID);
static NS_DEFINE_IID(kIFormControlFrameIID, NS_IFORMCONTROLFRAME_IID);
+static NS_DEFINE_IID(kIDOMHTMLFormElementIID, NS_IDOMHTMLFORMELEMENT_IID);
//----------------------------------------------------------------------
@@ -424,6 +428,99 @@ nsGenericHTMLElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
return result;
}
+static nsresult
+FindFormParent(nsIContent* aParent,
+ nsIFormControl* aControl)
+{
+ nsresult result = NS_OK;
+ nsIContent* parent = aParent;
+ nsIDOMHTMLFormElement* form;
+
+ // Will be released below
+ NS_IF_ADDREF(parent);
+ while (nsnull != parent) {
+ nsIAtom* tag;
+ PRInt32 nameSpaceID;
+ nsIContent* tmp;
+
+ parent->GetTag(tag);
+ parent->GetNameSpaceID(nameSpaceID);
+
+ // If the current ancestor is a form, set it as our form
+ if ((tag == nsHTMLAtoms::form) && (kNameSpaceID_HTML == nameSpaceID)) {
+ result = parent->QueryInterface(kIDOMHTMLFormElementIID,
+ (void**)&form);
+ if (NS_SUCCEEDED(result)) {
+ result = aControl->SetForm(form);
+ NS_RELEASE(form);
+ }
+ NS_IF_RELEASE(tag);
+ NS_RELEASE(parent);
+ break;
+ }
+ NS_IF_RELEASE(tag);
+
+ tmp = parent;
+ parent->GetParent(parent);
+ NS_RELEASE(tmp);
+ }
+
+ return result;
+}
+
+
+nsresult
+nsGenericHTMLElement::SetParentForFormControls(nsIContent* aParent,
+ nsIFormControl* aControl,
+ nsIForm* aForm)
+{
+ nsresult result = NS_OK;
+
+ if ((nsnull == aParent) && (nsnull != aForm)) {
+ result = aControl->SetForm(nsnull);
+ }
+ // If we have a new parent and either we had an old parent or we
+ // don't have a form, search for a containing form. If we didn't
+ // have an old parent, but we do have a form, we shouldn't do the
+ // search. In this case, someone (possibly the content sink) has
+ // already set the form for us.
+ else if ((nsnull != mDocument) && (nsnull != aParent) &&
+ ((nsnull != mParent) || (nsnull == aForm))) {
+ result = FindFormParent(aParent, aControl);
+ }
+
+ if (NS_SUCCEEDED(result)) {
+ result = SetParent(aParent);
+ }
+
+ return result;
+}
+
+nsresult
+nsGenericHTMLElement::SetDocumentForFormControls(nsIDocument* aDocument,
+ PRBool aDeep,
+ nsIFormControl* aControl,
+ nsIForm* aForm)
+{
+ nsresult result = NS_OK;
+ if ((nsnull != aDocument) && (nsnull != mParent) && (nsnull == aForm)) {
+ // XXX Do this check since anonymous frame content was also being
+ // added to the form. To make sure that the form control isn't
+ // anonymous, we ask the parent if it knows about it.
+ PRInt32 index;
+ mParent->IndexOf(mContent, index);
+ if (-1 != index) {
+ result = FindFormParent(mParent, aControl);
+ }
+ }
+
+ if (NS_SUCCEEDED(result)) {
+ result = SetDocument(aDocument, aDeep);
+ }
+
+ return result;
+}
+
nsresult
nsGenericHTMLElement::GetNameSpaceID(PRInt32& aID) const
{
diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h
index bc4cbc621cb8..56f337d2ba06 100644
--- a/content/html/content/src/nsGenericHTMLElement.h
+++ b/content/html/content/src/nsGenericHTMLElement.h
@@ -48,6 +48,8 @@ class nsDOMCSSDeclaration;
class nsIDOMCSSStyleDeclaration;
class nsIURI;
class nsIFormControlFrame;
+class nsIFormControl;
+class nsIForm;
class nsGenericHTMLElement : public nsGenericElement {
public:
@@ -102,6 +104,13 @@ public:
nsIAtom*& aName) const;
nsresult GetAttributeCount(PRInt32& aResult) const;
nsresult List(FILE* out, PRInt32 aIndent) const;
+ nsresult SetParentForFormControls(nsIContent* aParent,
+ nsIFormControl* aControl,
+ nsIForm* aForm);
+ nsresult SetDocumentForFormControls(nsIDocument* aDocument,
+ PRBool aDeep,
+ nsIFormControl* aControl,
+ nsIForm* aForm);
// Implementation for nsIHTMLContent
nsresult Compact();
diff --git a/content/html/content/src/nsHTMLButtonElement.cpp b/content/html/content/src/nsHTMLButtonElement.cpp
index 09278f2d63e9..9098c489c65b 100644
--- a/content/html/content/src/nsHTMLButtonElement.cpp
+++ b/content/html/content/src/nsHTMLButtonElement.cpp
@@ -87,7 +87,7 @@ public:
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
// nsIContent
- NS_IMPL_ICONTENT_USING_GENERIC(mInner)
+ NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner)
// nsIHTMLContent
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
@@ -204,6 +204,20 @@ nsHTMLButtonElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
+// nsIContent
+
+NS_IMETHODIMP
+nsHTMLButtonElement::SetParent(nsIContent* aParent)
+{
+ return mInner.SetParentForFormControls(aParent, this, mForm);
+}
+
+NS_IMETHODIMP
+nsHTMLButtonElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
+{
+ return mInner.SetDocumentForFormControls(aDocument, aDeep, this, mForm);
+}
+
NS_IMETHODIMP
nsHTMLButtonElement::GetForm(nsIDOMHTMLFormElement** aForm)
{
diff --git a/content/html/content/src/nsHTMLFieldSetElement.cpp b/content/html/content/src/nsHTMLFieldSetElement.cpp
index 9cbde8e90d9d..4e457fe4948e 100644
--- a/content/html/content/src/nsHTMLFieldSetElement.cpp
+++ b/content/html/content/src/nsHTMLFieldSetElement.cpp
@@ -68,7 +68,7 @@ public:
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
// nsIContent
- NS_IMPL_ICONTENT_USING_GENERIC(mInner)
+ NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner)
// nsIHTMLContent
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
@@ -164,6 +164,20 @@ nsHTMLFieldSetElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
+// nsIContent
+
+NS_IMETHODIMP
+nsHTMLFieldSetElement::SetParent(nsIContent* aParent)
+{
+ return mInner.SetParentForFormControls(aParent, this, mForm);
+}
+
+NS_IMETHODIMP
+nsHTMLFieldSetElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
+{
+ return mInner.SetDocumentForFormControls(aDocument, aDeep, this, mForm);
+}
+
NS_IMETHODIMP
nsHTMLFieldSetElement::GetForm(nsIDOMHTMLFormElement** aForm)
{
diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp
index 198c86a8c442..9376bcd8f49f 100644
--- a/content/html/content/src/nsHTMLInputElement.cpp
+++ b/content/html/content/src/nsHTMLInputElement.cpp
@@ -116,7 +116,7 @@ public:
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
// nsIContent
- NS_IMPL_ICONTENT_USING_GENERIC(mInner)
+ NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner)
// nsIHTMLContent
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
@@ -224,7 +224,7 @@ nsHTMLInputElement::Release()
}
}
-// nsIDOMHTMLInputElement
+// nsIDOMNode
nsresult
nsHTMLInputElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
@@ -237,6 +237,20 @@ nsHTMLInputElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
+// nsIContent
+
+NS_IMETHODIMP
+nsHTMLInputElement::SetParent(nsIContent* aParent)
+{
+ return mInner.SetParentForFormControls(aParent, this, mForm);
+}
+
+NS_IMETHODIMP
+nsHTMLInputElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
+{
+ return mInner.SetDocumentForFormControls(aDocument, aDeep, this, mForm);
+}
+
NS_IMETHODIMP
nsHTMLInputElement::GetForm(nsIDOMHTMLFormElement** aForm)
{
diff --git a/content/html/content/src/nsHTMLLabelElement.cpp b/content/html/content/src/nsHTMLLabelElement.cpp
index 01ef1435e66f..a5d74a69d166 100644
--- a/content/html/content/src/nsHTMLLabelElement.cpp
+++ b/content/html/content/src/nsHTMLLabelElement.cpp
@@ -73,7 +73,7 @@ public:
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
// nsIContent
- NS_IMPL_ICONTENT_USING_GENERIC(mInner)
+ NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner)
// nsIHTMLContent
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
@@ -168,6 +168,20 @@ nsHTMLLabelElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
+// nsIContent
+
+NS_IMETHODIMP
+nsHTMLLabelElement::SetParent(nsIContent* aParent)
+{
+ return mInner.SetParentForFormControls(aParent, this, mForm);
+}
+
+NS_IMETHODIMP
+nsHTMLLabelElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
+{
+ return mInner.SetDocumentForFormControls(aDocument, aDeep, this, mForm);
+}
+
NS_IMETHODIMP
nsHTMLLabelElement::GetForm(nsIDOMHTMLFormElement** aForm)
{
diff --git a/content/html/content/src/nsHTMLSelectElement.cpp b/content/html/content/src/nsHTMLSelectElement.cpp
index 980473233e63..ddccb9f791f4 100644
--- a/content/html/content/src/nsHTMLSelectElement.cpp
+++ b/content/html/content/src/nsHTMLSelectElement.cpp
@@ -157,7 +157,7 @@ public:
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
// nsIContent
- NS_IMPL_ICONTENT_USING_GENERIC(mInner)
+ NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner)
// nsIHTMLContent
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
@@ -286,6 +286,20 @@ nsHTMLSelectElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
+// nsIContent
+
+NS_IMETHODIMP
+nsHTMLSelectElement::SetParent(nsIContent* aParent)
+{
+ return mInner.SetParentForFormControls(aParent, this, mForm);
+}
+
+NS_IMETHODIMP
+nsHTMLSelectElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
+{
+ return mInner.SetDocumentForFormControls(aDocument, aDeep, this, mForm);
+}
+
NS_IMETHODIMP
nsHTMLSelectElement::Add(nsIDOMHTMLElement* aElement, nsIDOMHTMLElement* aBefore)
{
diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp
index 51c068fa5fa1..a800ebd6a290 100644
--- a/content/html/content/src/nsHTMLTextAreaElement.cpp
+++ b/content/html/content/src/nsHTMLTextAreaElement.cpp
@@ -95,7 +95,7 @@ public:
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
// nsIContent
- NS_IMPL_ICONTENT_USING_GENERIC(mInner)
+ NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner)
// nsIHTMLContent
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
@@ -197,6 +197,20 @@ nsHTMLTextAreaElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
+// nsIContent
+
+NS_IMETHODIMP
+nsHTMLTextAreaElement::SetParent(nsIContent* aParent)
+{
+ return mInner.SetParentForFormControls(aParent, this, mForm);
+}
+
+NS_IMETHODIMP
+nsHTMLTextAreaElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
+{
+ return mInner.SetDocumentForFormControls(aDocument, aDeep, this, mForm);
+}
+
NS_IMETHODIMP
nsHTMLTextAreaElement::GetForm(nsIDOMHTMLFormElement** aForm)
{
diff --git a/layout/html/content/src/makefile.win b/layout/html/content/src/makefile.win
index 4b7ae1acf701..58674a512233 100644
--- a/layout/html/content/src/makefile.win
+++ b/layout/html/content/src/makefile.win
@@ -94,7 +94,7 @@ CPPSRCS= \
CPP_OBJS= \
.\$(OBJDIR)\nsGenericHTMLElement.obj \
.\$(OBJDIR)\nsGenericDOMHTMLCollection.obj \
- .\$(OBJDIR)\GenericElementCollection.obj \
+ .\$(OBJDIR)\GenericElementCollection.obj \
.\$(OBJDIR)\nsHTMLAnchorElement.obj \
.\$(OBJDIR)\nsHTMLAppletElement.obj \
.\$(OBJDIR)\nsHTMLAreaElement.obj \
diff --git a/layout/html/content/src/nsGenericHTMLElement.cpp b/layout/html/content/src/nsGenericHTMLElement.cpp
index e1cedf4485a1..314b2c586719 100644
--- a/layout/html/content/src/nsGenericHTMLElement.cpp
+++ b/layout/html/content/src/nsGenericHTMLElement.cpp
@@ -73,6 +73,9 @@
#include "prprf.h"
#include "prmem.h"
#include "nsIFormControlFrame.h"
+#include "nsIForm.h"
+#include "nsIFormControl.h"
+#include "nsIDOMHTMLFormElement.h"
// XXX todo: add in missing out-of-memory checks
NS_DEFINE_IID(kIDOMHTMLElementIID, NS_IDOMHTMLELEMENT_IID);
@@ -90,6 +93,7 @@ static NS_DEFINE_IID(kIDOMDocumentIID, NS_IDOMNODE_IID);
static NS_DEFINE_IID(kIDOMDocumentFragmentIID, NS_IDOMDOCUMENTFRAGMENT_IID);
static NS_DEFINE_IID(kIHTMLContentContainerIID, NS_IHTMLCONTENTCONTAINER_IID);
static NS_DEFINE_IID(kIFormControlFrameIID, NS_IFORMCONTROLFRAME_IID);
+static NS_DEFINE_IID(kIDOMHTMLFormElementIID, NS_IDOMHTMLFORMELEMENT_IID);
//----------------------------------------------------------------------
@@ -424,6 +428,99 @@ nsGenericHTMLElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
return result;
}
+static nsresult
+FindFormParent(nsIContent* aParent,
+ nsIFormControl* aControl)
+{
+ nsresult result = NS_OK;
+ nsIContent* parent = aParent;
+ nsIDOMHTMLFormElement* form;
+
+ // Will be released below
+ NS_IF_ADDREF(parent);
+ while (nsnull != parent) {
+ nsIAtom* tag;
+ PRInt32 nameSpaceID;
+ nsIContent* tmp;
+
+ parent->GetTag(tag);
+ parent->GetNameSpaceID(nameSpaceID);
+
+ // If the current ancestor is a form, set it as our form
+ if ((tag == nsHTMLAtoms::form) && (kNameSpaceID_HTML == nameSpaceID)) {
+ result = parent->QueryInterface(kIDOMHTMLFormElementIID,
+ (void**)&form);
+ if (NS_SUCCEEDED(result)) {
+ result = aControl->SetForm(form);
+ NS_RELEASE(form);
+ }
+ NS_IF_RELEASE(tag);
+ NS_RELEASE(parent);
+ break;
+ }
+ NS_IF_RELEASE(tag);
+
+ tmp = parent;
+ parent->GetParent(parent);
+ NS_RELEASE(tmp);
+ }
+
+ return result;
+}
+
+
+nsresult
+nsGenericHTMLElement::SetParentForFormControls(nsIContent* aParent,
+ nsIFormControl* aControl,
+ nsIForm* aForm)
+{
+ nsresult result = NS_OK;
+
+ if ((nsnull == aParent) && (nsnull != aForm)) {
+ result = aControl->SetForm(nsnull);
+ }
+ // If we have a new parent and either we had an old parent or we
+ // don't have a form, search for a containing form. If we didn't
+ // have an old parent, but we do have a form, we shouldn't do the
+ // search. In this case, someone (possibly the content sink) has
+ // already set the form for us.
+ else if ((nsnull != mDocument) && (nsnull != aParent) &&
+ ((nsnull != mParent) || (nsnull == aForm))) {
+ result = FindFormParent(aParent, aControl);
+ }
+
+ if (NS_SUCCEEDED(result)) {
+ result = SetParent(aParent);
+ }
+
+ return result;
+}
+
+nsresult
+nsGenericHTMLElement::SetDocumentForFormControls(nsIDocument* aDocument,
+ PRBool aDeep,
+ nsIFormControl* aControl,
+ nsIForm* aForm)
+{
+ nsresult result = NS_OK;
+ if ((nsnull != aDocument) && (nsnull != mParent) && (nsnull == aForm)) {
+ // XXX Do this check since anonymous frame content was also being
+ // added to the form. To make sure that the form control isn't
+ // anonymous, we ask the parent if it knows about it.
+ PRInt32 index;
+ mParent->IndexOf(mContent, index);
+ if (-1 != index) {
+ result = FindFormParent(mParent, aControl);
+ }
+ }
+
+ if (NS_SUCCEEDED(result)) {
+ result = SetDocument(aDocument, aDeep);
+ }
+
+ return result;
+}
+
nsresult
nsGenericHTMLElement::GetNameSpaceID(PRInt32& aID) const
{
diff --git a/layout/html/content/src/nsGenericHTMLElement.h b/layout/html/content/src/nsGenericHTMLElement.h
index bc4cbc621cb8..56f337d2ba06 100644
--- a/layout/html/content/src/nsGenericHTMLElement.h
+++ b/layout/html/content/src/nsGenericHTMLElement.h
@@ -48,6 +48,8 @@ class nsDOMCSSDeclaration;
class nsIDOMCSSStyleDeclaration;
class nsIURI;
class nsIFormControlFrame;
+class nsIFormControl;
+class nsIForm;
class nsGenericHTMLElement : public nsGenericElement {
public:
@@ -102,6 +104,13 @@ public:
nsIAtom*& aName) const;
nsresult GetAttributeCount(PRInt32& aResult) const;
nsresult List(FILE* out, PRInt32 aIndent) const;
+ nsresult SetParentForFormControls(nsIContent* aParent,
+ nsIFormControl* aControl,
+ nsIForm* aForm);
+ nsresult SetDocumentForFormControls(nsIDocument* aDocument,
+ PRBool aDeep,
+ nsIFormControl* aControl,
+ nsIForm* aForm);
// Implementation for nsIHTMLContent
nsresult Compact();
diff --git a/layout/html/content/src/nsHTMLButtonElement.cpp b/layout/html/content/src/nsHTMLButtonElement.cpp
index 09278f2d63e9..9098c489c65b 100644
--- a/layout/html/content/src/nsHTMLButtonElement.cpp
+++ b/layout/html/content/src/nsHTMLButtonElement.cpp
@@ -87,7 +87,7 @@ public:
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
// nsIContent
- NS_IMPL_ICONTENT_USING_GENERIC(mInner)
+ NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner)
// nsIHTMLContent
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
@@ -204,6 +204,20 @@ nsHTMLButtonElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
+// nsIContent
+
+NS_IMETHODIMP
+nsHTMLButtonElement::SetParent(nsIContent* aParent)
+{
+ return mInner.SetParentForFormControls(aParent, this, mForm);
+}
+
+NS_IMETHODIMP
+nsHTMLButtonElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
+{
+ return mInner.SetDocumentForFormControls(aDocument, aDeep, this, mForm);
+}
+
NS_IMETHODIMP
nsHTMLButtonElement::GetForm(nsIDOMHTMLFormElement** aForm)
{
diff --git a/layout/html/content/src/nsHTMLFieldSetElement.cpp b/layout/html/content/src/nsHTMLFieldSetElement.cpp
index 9cbde8e90d9d..4e457fe4948e 100644
--- a/layout/html/content/src/nsHTMLFieldSetElement.cpp
+++ b/layout/html/content/src/nsHTMLFieldSetElement.cpp
@@ -68,7 +68,7 @@ public:
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
// nsIContent
- NS_IMPL_ICONTENT_USING_GENERIC(mInner)
+ NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner)
// nsIHTMLContent
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
@@ -164,6 +164,20 @@ nsHTMLFieldSetElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
+// nsIContent
+
+NS_IMETHODIMP
+nsHTMLFieldSetElement::SetParent(nsIContent* aParent)
+{
+ return mInner.SetParentForFormControls(aParent, this, mForm);
+}
+
+NS_IMETHODIMP
+nsHTMLFieldSetElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
+{
+ return mInner.SetDocumentForFormControls(aDocument, aDeep, this, mForm);
+}
+
NS_IMETHODIMP
nsHTMLFieldSetElement::GetForm(nsIDOMHTMLFormElement** aForm)
{
diff --git a/layout/html/content/src/nsHTMLInputElement.cpp b/layout/html/content/src/nsHTMLInputElement.cpp
index 198c86a8c442..9376bcd8f49f 100644
--- a/layout/html/content/src/nsHTMLInputElement.cpp
+++ b/layout/html/content/src/nsHTMLInputElement.cpp
@@ -116,7 +116,7 @@ public:
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
// nsIContent
- NS_IMPL_ICONTENT_USING_GENERIC(mInner)
+ NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner)
// nsIHTMLContent
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
@@ -224,7 +224,7 @@ nsHTMLInputElement::Release()
}
}
-// nsIDOMHTMLInputElement
+// nsIDOMNode
nsresult
nsHTMLInputElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
@@ -237,6 +237,20 @@ nsHTMLInputElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
+// nsIContent
+
+NS_IMETHODIMP
+nsHTMLInputElement::SetParent(nsIContent* aParent)
+{
+ return mInner.SetParentForFormControls(aParent, this, mForm);
+}
+
+NS_IMETHODIMP
+nsHTMLInputElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
+{
+ return mInner.SetDocumentForFormControls(aDocument, aDeep, this, mForm);
+}
+
NS_IMETHODIMP
nsHTMLInputElement::GetForm(nsIDOMHTMLFormElement** aForm)
{
diff --git a/layout/html/content/src/nsHTMLLabelElement.cpp b/layout/html/content/src/nsHTMLLabelElement.cpp
index 01ef1435e66f..a5d74a69d166 100644
--- a/layout/html/content/src/nsHTMLLabelElement.cpp
+++ b/layout/html/content/src/nsHTMLLabelElement.cpp
@@ -73,7 +73,7 @@ public:
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
// nsIContent
- NS_IMPL_ICONTENT_USING_GENERIC(mInner)
+ NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner)
// nsIHTMLContent
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
@@ -168,6 +168,20 @@ nsHTMLLabelElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
+// nsIContent
+
+NS_IMETHODIMP
+nsHTMLLabelElement::SetParent(nsIContent* aParent)
+{
+ return mInner.SetParentForFormControls(aParent, this, mForm);
+}
+
+NS_IMETHODIMP
+nsHTMLLabelElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
+{
+ return mInner.SetDocumentForFormControls(aDocument, aDeep, this, mForm);
+}
+
NS_IMETHODIMP
nsHTMLLabelElement::GetForm(nsIDOMHTMLFormElement** aForm)
{
diff --git a/layout/html/content/src/nsHTMLSelectElement.cpp b/layout/html/content/src/nsHTMLSelectElement.cpp
index 980473233e63..ddccb9f791f4 100644
--- a/layout/html/content/src/nsHTMLSelectElement.cpp
+++ b/layout/html/content/src/nsHTMLSelectElement.cpp
@@ -157,7 +157,7 @@ public:
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
// nsIContent
- NS_IMPL_ICONTENT_USING_GENERIC(mInner)
+ NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner)
// nsIHTMLContent
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
@@ -286,6 +286,20 @@ nsHTMLSelectElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
+// nsIContent
+
+NS_IMETHODIMP
+nsHTMLSelectElement::SetParent(nsIContent* aParent)
+{
+ return mInner.SetParentForFormControls(aParent, this, mForm);
+}
+
+NS_IMETHODIMP
+nsHTMLSelectElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
+{
+ return mInner.SetDocumentForFormControls(aDocument, aDeep, this, mForm);
+}
+
NS_IMETHODIMP
nsHTMLSelectElement::Add(nsIDOMHTMLElement* aElement, nsIDOMHTMLElement* aBefore)
{
diff --git a/layout/html/content/src/nsHTMLTextAreaElement.cpp b/layout/html/content/src/nsHTMLTextAreaElement.cpp
index 51c068fa5fa1..a800ebd6a290 100644
--- a/layout/html/content/src/nsHTMLTextAreaElement.cpp
+++ b/layout/html/content/src/nsHTMLTextAreaElement.cpp
@@ -95,7 +95,7 @@ public:
NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC(mInner)
// nsIContent
- NS_IMPL_ICONTENT_USING_GENERIC(mInner)
+ NS_IMPL_ICONTENT_NO_SETPARENT_NO_SETDOCUMENT_USING_GENERIC(mInner)
// nsIHTMLContent
NS_IMPL_IHTMLCONTENT_USING_GENERIC(mInner)
@@ -197,6 +197,20 @@ nsHTMLTextAreaElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
return it->QueryInterface(kIDOMNodeIID, (void**) aReturn);
}
+// nsIContent
+
+NS_IMETHODIMP
+nsHTMLTextAreaElement::SetParent(nsIContent* aParent)
+{
+ return mInner.SetParentForFormControls(aParent, this, mForm);
+}
+
+NS_IMETHODIMP
+nsHTMLTextAreaElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
+{
+ return mInner.SetDocumentForFormControls(aDocument, aDeep, this, mForm);
+}
+
NS_IMETHODIMP
nsHTMLTextAreaElement::GetForm(nsIDOMHTMLFormElement** aForm)
{