mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-02 12:07:52 +00:00
Reimplemented nsiDOMNSHTMLFormElement interface on form class
This commit is contained in:
parent
719dd69e29
commit
a0254879da
@ -46,6 +46,7 @@ class nsFormControlList;
|
||||
// nsHTMLFormElement
|
||||
|
||||
class nsHTMLFormElement : public nsIDOMHTMLFormElement,
|
||||
public nsIDOMNSHTMLFormElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent,
|
||||
@ -83,6 +84,11 @@ public:
|
||||
NS_IMETHOD Reset();
|
||||
NS_IMETHOD Submit();
|
||||
|
||||
// nsIDOMNSHTMLFormElement
|
||||
NS_IMETHOD GetEncoding(nsString& aEncoding);
|
||||
NS_IMETHOD GetLength(PRUint32* aLength);
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMElement** aReturn);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
@ -426,6 +432,36 @@ nsHTMLFormElement::RemoveElement(nsIFormControl* aChild, PRBool aChildIsRef)
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFormElement::GetEncoding(nsString& aEncoding)
|
||||
{
|
||||
return mInner.GetAttribute(nsHTMLAtoms::encoding, aEncoding);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFormElement::GetLength(PRUint32* aLength)
|
||||
{
|
||||
*aLength = mControls->mElements.Count();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFormElement::NamedItem(const nsString& aName, nsIDOMElement** aReturn)
|
||||
{
|
||||
// XXX For now we just search our element list. In reality, we'll have
|
||||
// to look at all of our children, including images, objects, etc.
|
||||
nsIDOMNode *node;
|
||||
nsresult result = mControls->NamedItem(aName, &node);
|
||||
|
||||
if ((NS_OK == result) && (nsnull != node)) {
|
||||
result = node->QueryInterface(kIDOMElementIID, (void **)aReturn);
|
||||
NS_RELEASE(node);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// nsFormControlList implementation, this could go away if there were a lightweight collection implementation somewhere
|
||||
|
||||
|
@ -46,6 +46,7 @@ class nsFormControlList;
|
||||
// nsHTMLFormElement
|
||||
|
||||
class nsHTMLFormElement : public nsIDOMHTMLFormElement,
|
||||
public nsIDOMNSHTMLFormElement,
|
||||
public nsIScriptObjectOwner,
|
||||
public nsIDOMEventReceiver,
|
||||
public nsIHTMLContent,
|
||||
@ -83,6 +84,11 @@ public:
|
||||
NS_IMETHOD Reset();
|
||||
NS_IMETHOD Submit();
|
||||
|
||||
// nsIDOMNSHTMLFormElement
|
||||
NS_IMETHOD GetEncoding(nsString& aEncoding);
|
||||
NS_IMETHOD GetLength(PRUint32* aLength);
|
||||
NS_IMETHOD NamedItem(const nsString& aName, nsIDOMElement** aReturn);
|
||||
|
||||
// nsIScriptObjectOwner
|
||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC(mInner)
|
||||
|
||||
@ -426,6 +432,36 @@ nsHTMLFormElement::RemoveElement(nsIFormControl* aChild, PRBool aChildIsRef)
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFormElement::GetEncoding(nsString& aEncoding)
|
||||
{
|
||||
return mInner.GetAttribute(nsHTMLAtoms::encoding, aEncoding);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFormElement::GetLength(PRUint32* aLength)
|
||||
{
|
||||
*aLength = mControls->mElements.Count();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLFormElement::NamedItem(const nsString& aName, nsIDOMElement** aReturn)
|
||||
{
|
||||
// XXX For now we just search our element list. In reality, we'll have
|
||||
// to look at all of our children, including images, objects, etc.
|
||||
nsIDOMNode *node;
|
||||
nsresult result = mControls->NamedItem(aName, &node);
|
||||
|
||||
if ((NS_OK == result) && (nsnull != node)) {
|
||||
result = node->QueryInterface(kIDOMElementIID, (void **)aReturn);
|
||||
NS_RELEASE(node);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// nsFormControlList implementation, this could go away if there were a lightweight collection implementation somewhere
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user