2004-10-13 09:51:52 +00:00
|
|
|
/* -*- 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 XForms support.
|
|
|
|
*
|
|
|
|
* 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 <bryner@brianryner.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either 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 "nsIDOMEventTarget.h"
|
|
|
|
#include "nsIDOM3Node.h"
|
|
|
|
#include "nsIDOMElement.h"
|
|
|
|
#include "nsMemory.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsIXTFXMLVisualWrapper.h"
|
|
|
|
#include "nsIDOMDocument.h"
|
2004-10-26 00:34:03 +00:00
|
|
|
#include "nsIXFormsControl.h"
|
2005-01-19 16:05:31 +00:00
|
|
|
#include "nsXFormsControlStub.h"
|
2004-10-13 09:51:52 +00:00
|
|
|
#include "nsISchema.h"
|
|
|
|
#include "nsIDOMHTMLInputElement.h"
|
2004-12-01 23:39:55 +00:00
|
|
|
#include "nsIDOMHTMLTextAreaElement.h"
|
2004-10-13 09:51:52 +00:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsIDOMXPathResult.h"
|
|
|
|
#include "nsIDOMFocusListener.h"
|
2004-10-26 00:34:03 +00:00
|
|
|
#include "nsXFormsUtils.h"
|
|
|
|
#include "nsIModelElementPrivate.h"
|
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsIDOMXPathExpression.h"
|
2005-02-01 19:38:00 +00:00
|
|
|
#include "nsXFormsAtoms.h"
|
2004-10-13 09:51:52 +00:00
|
|
|
|
2004-11-04 21:12:22 +00:00
|
|
|
/**
|
2004-12-06 23:04:58 +00:00
|
|
|
* Implementation of the \<input\>, \<secret\>, and \<textarea\> elements.
|
2004-11-04 21:12:22 +00:00
|
|
|
*/
|
2005-01-19 16:05:31 +00:00
|
|
|
class nsXFormsInputElement : public nsIDOMFocusListener,
|
|
|
|
public nsXFormsControlStub
|
2004-10-13 09:51:52 +00:00
|
|
|
{
|
|
|
|
public:
|
2004-11-07 08:54:32 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIXTFXMLVisual overrides
|
|
|
|
NS_IMETHOD OnCreated(nsIXTFXMLVisualWrapper *aWrapper);
|
|
|
|
|
|
|
|
// nsIXTFVisual overrides
|
|
|
|
NS_IMETHOD GetVisualContent(nsIDOMElement **aElement);
|
2004-11-20 21:00:59 +00:00
|
|
|
NS_IMETHOD GetInsertionPoint(nsIDOMElement **aPoint);
|
2004-11-07 08:54:32 +00:00
|
|
|
|
|
|
|
// nsIXTFElement overrides
|
|
|
|
NS_IMETHOD OnDestroyed();
|
2005-02-01 19:38:00 +00:00
|
|
|
NS_IMETHOD AttributeSet(nsIAtom *aName, const nsAString &aValue);
|
|
|
|
NS_IMETHOD HandleDefault(nsIDOMEvent *aEvent, PRBool *aHandled);
|
2004-11-07 08:54:32 +00:00
|
|
|
|
|
|
|
// nsIXFormsControl
|
2005-01-19 16:05:31 +00:00
|
|
|
NS_IMETHOD Refresh();
|
2005-01-27 19:30:03 +00:00
|
|
|
NS_IMETHOD TryFocus(PRBool* aOK);
|
2004-10-13 09:51:52 +00:00
|
|
|
|
|
|
|
// nsIDOMEventListener
|
|
|
|
NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent);
|
|
|
|
|
|
|
|
// nsIDOMFocusListener
|
|
|
|
NS_IMETHOD Focus(nsIDOMEvent *aEvent);
|
|
|
|
NS_IMETHOD Blur(nsIDOMEvent *aEvent);
|
|
|
|
|
2004-12-06 23:04:58 +00:00
|
|
|
enum ControlType {
|
|
|
|
eType_Input,
|
|
|
|
eType_Secret,
|
|
|
|
eType_TextArea
|
|
|
|
};
|
|
|
|
|
2005-01-19 16:05:31 +00:00
|
|
|
// nsXFormsInputElement
|
2004-12-06 23:04:58 +00:00
|
|
|
nsXFormsInputElement(ControlType aType)
|
2005-02-01 19:38:00 +00:00
|
|
|
: mType(aType), mIncremental(PR_FALSE)
|
2004-12-01 23:39:55 +00:00
|
|
|
{}
|
2004-10-13 09:51:52 +00:00
|
|
|
|
|
|
|
private:
|
2005-02-01 19:38:00 +00:00
|
|
|
// Updates the instance data node bound to this form control.
|
|
|
|
nsresult UpdateInstanceData();
|
|
|
|
|
2005-01-19 16:05:31 +00:00
|
|
|
nsCOMPtr<nsIDOMElement> mLabel;
|
|
|
|
nsCOMPtr<nsIDOMElement> mControl;
|
|
|
|
ControlType mType;
|
2005-02-01 19:38:00 +00:00
|
|
|
PRBool mIncremental;
|
2004-10-13 09:51:52 +00:00
|
|
|
};
|
|
|
|
|
2005-02-09 09:57:31 +00:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsInputElement,
|
|
|
|
nsXFormsControlStub,
|
2004-11-07 08:54:32 +00:00
|
|
|
nsIDOMFocusListener,
|
|
|
|
nsIDOMEventListener)
|
2004-10-13 09:51:52 +00:00
|
|
|
|
|
|
|
// nsIXTFXMLVisual
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXFormsInputElement::OnCreated(nsIXTFXMLVisualWrapper *aWrapper)
|
|
|
|
{
|
2005-01-19 16:05:31 +00:00
|
|
|
nsresult rv = nsXFormsControlStub::OnCreated(aWrapper);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2004-10-26 00:34:03 +00:00
|
|
|
|
2004-11-20 21:00:59 +00:00
|
|
|
// Our anonymous content structure will look like this:
|
|
|
|
//
|
2004-12-01 23:39:55 +00:00
|
|
|
// <label> (mLabel)
|
|
|
|
// <span/> (insertion point)
|
|
|
|
// <input/> or <textarea/> (mControl)
|
2004-11-20 21:00:59 +00:00
|
|
|
// </label>
|
|
|
|
|
2004-10-13 09:51:52 +00:00
|
|
|
nsCOMPtr<nsIDOMDocument> domDoc;
|
2005-01-19 16:05:31 +00:00
|
|
|
mElement->GetOwnerDocument(getter_AddRefs(domDoc));
|
2004-10-13 09:51:52 +00:00
|
|
|
|
2004-11-20 21:00:59 +00:00
|
|
|
domDoc->CreateElementNS(NS_LITERAL_STRING(NS_NAMESPACE_XHTML),
|
|
|
|
NS_LITERAL_STRING("label"),
|
|
|
|
getter_AddRefs(mLabel));
|
2004-12-06 23:04:58 +00:00
|
|
|
NS_ENSURE_STATE(mLabel);
|
2004-11-20 21:00:59 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> element;
|
|
|
|
nsCOMPtr<nsIDOMNode> childReturn;
|
|
|
|
|
|
|
|
domDoc->CreateElementNS(NS_LITERAL_STRING(NS_NAMESPACE_XHTML),
|
|
|
|
NS_LITERAL_STRING("span"),
|
|
|
|
getter_AddRefs(element));
|
2004-12-06 23:04:58 +00:00
|
|
|
NS_ENSURE_STATE(element);
|
2004-11-20 21:00:59 +00:00
|
|
|
|
|
|
|
mLabel->AppendChild(element, getter_AddRefs(childReturn));
|
|
|
|
|
2004-10-13 09:51:52 +00:00
|
|
|
domDoc->CreateElementNS(NS_LITERAL_STRING(NS_NAMESPACE_XHTML),
|
2004-12-06 23:04:58 +00:00
|
|
|
mType == eType_TextArea
|
|
|
|
? NS_LITERAL_STRING("textarea")
|
|
|
|
: NS_LITERAL_STRING("input"),
|
2004-12-01 23:39:55 +00:00
|
|
|
getter_AddRefs(mControl));
|
2004-12-06 23:04:58 +00:00
|
|
|
NS_ENSURE_STATE(mControl);
|
|
|
|
|
|
|
|
if (mType == eType_Secret) {
|
|
|
|
nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(mControl);
|
|
|
|
NS_ENSURE_STATE(input);
|
|
|
|
|
|
|
|
input->SetType(NS_LITERAL_STRING("password"));
|
|
|
|
}
|
2004-10-13 09:51:52 +00:00
|
|
|
|
2004-12-01 23:39:55 +00:00
|
|
|
mLabel->AppendChild(mControl, getter_AddRefs(childReturn));
|
2004-11-20 21:00:59 +00:00
|
|
|
|
2004-10-16 21:29:00 +00:00
|
|
|
// We can't use xtf handleDefault here because editor stops blur events from
|
|
|
|
// bubbling, and we can't use a system event group handler because blur
|
|
|
|
// events don't go to the system event group (bug 263240). So, just install
|
|
|
|
// a bubbling listener in the normal event group. This works out because
|
|
|
|
// content can't get at the anonymous content to install an event handler,
|
|
|
|
// and the event doesn't bubble up.
|
2004-10-13 09:51:52 +00:00
|
|
|
|
2004-12-01 23:39:55 +00:00
|
|
|
nsCOMPtr<nsIDOMEventTarget> targ = do_QueryInterface(mControl);
|
2004-10-16 21:29:00 +00:00
|
|
|
NS_ASSERTION(targ, "input must be an event target!");
|
2004-10-13 09:51:52 +00:00
|
|
|
|
2004-10-16 21:29:00 +00:00
|
|
|
targ->AddEventListener(NS_LITERAL_STRING("blur"), this, PR_FALSE);
|
2004-10-13 09:51:52 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2004-10-13 18:50:15 +00:00
|
|
|
// nsIXTFVisual
|
|
|
|
|
2004-10-13 09:51:52 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXFormsInputElement::GetVisualContent(nsIDOMElement **aElement)
|
|
|
|
{
|
2004-11-20 21:00:59 +00:00
|
|
|
NS_ADDREF(*aElement = mLabel);
|
2004-10-13 09:51:52 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2004-11-20 21:00:59 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXFormsInputElement::GetInsertionPoint(nsIDOMElement **aPoint)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMNode> childNode;
|
|
|
|
mLabel->GetFirstChild(getter_AddRefs(childNode));
|
|
|
|
return CallQueryInterface(childNode, aPoint);
|
|
|
|
}
|
|
|
|
|
2004-10-13 09:51:52 +00:00
|
|
|
// nsIXTFElement
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXFormsInputElement::OnDestroyed()
|
|
|
|
{
|
2004-12-01 23:39:55 +00:00
|
|
|
nsCOMPtr<nsIDOMEventTarget> targ = do_QueryInterface(mControl);
|
2004-10-16 21:29:00 +00:00
|
|
|
if (NS_LIKELY(targ != nsnull)) {
|
|
|
|
targ->RemoveEventListener(NS_LITERAL_STRING("blur"), this, PR_FALSE);
|
|
|
|
}
|
2004-10-13 09:51:52 +00:00
|
|
|
|
2005-01-19 16:05:31 +00:00
|
|
|
nsXFormsControlStub::OnDestroyed();
|
2004-10-13 09:51:52 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2005-02-01 19:38:00 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXFormsInputElement::AttributeSet(nsIAtom *aName, const nsAString &aValue)
|
|
|
|
{
|
|
|
|
nsXFormsControlStub::WillSetAttribute(aName, aValue);
|
|
|
|
|
|
|
|
if (aName == nsXFormsAtoms::incremental)
|
|
|
|
mIncremental = aValue.EqualsLiteral("true");
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXFormsInputElement::HandleDefault(nsIDOMEvent *aEvent,
|
|
|
|
PRBool *aHandled)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
rv = nsXFormsControlStub::HandleDefault(aEvent, aHandled);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (*aHandled || !mIncremental) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAutoString type;
|
|
|
|
aEvent->GetType(type);
|
|
|
|
if (type.EqualsLiteral("keyup"))
|
|
|
|
UpdateInstanceData();
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2004-10-13 09:51:52 +00:00
|
|
|
// nsIDOMEventListener
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXFormsInputElement::HandleEvent(nsIDOMEvent *aEvent)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXFormsInputElement::Focus(nsIDOMEvent *aEvent)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXFormsInputElement::Blur(nsIDOMEvent *aEvent)
|
2005-02-01 19:38:00 +00:00
|
|
|
{
|
|
|
|
return UpdateInstanceData();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsXFormsInputElement::UpdateInstanceData()
|
2004-10-13 09:51:52 +00:00
|
|
|
{
|
2005-02-18 10:14:48 +00:00
|
|
|
if (!mControl || !mBoundNode || !mModel)
|
2004-10-13 09:51:52 +00:00
|
|
|
return NS_OK;
|
|
|
|
|
2004-12-01 23:39:55 +00:00
|
|
|
nsAutoString value;
|
2004-12-06 23:04:58 +00:00
|
|
|
if (mType == eType_TextArea) {
|
2004-12-01 23:39:55 +00:00
|
|
|
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea = do_QueryInterface(mControl);
|
|
|
|
NS_ENSURE_STATE(textArea);
|
|
|
|
|
|
|
|
textArea->GetValue(value);
|
2004-10-13 09:51:52 +00:00
|
|
|
} else {
|
2004-12-01 23:39:55 +00:00
|
|
|
nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(mControl);
|
|
|
|
NS_ENSURE_STATE(input);
|
|
|
|
|
|
|
|
nsAutoString type;
|
|
|
|
input->GetType(type);
|
2004-12-06 23:04:58 +00:00
|
|
|
if (mType == eType_Input && type.EqualsLiteral("checkbox")) {
|
2004-12-01 23:39:55 +00:00
|
|
|
PRBool checked;
|
|
|
|
input->GetChecked(&checked);
|
|
|
|
value.AssignASCII(checked ? "1" : "0", 1);
|
|
|
|
} else {
|
|
|
|
input->GetValue(value);
|
|
|
|
}
|
2004-10-13 09:51:52 +00:00
|
|
|
}
|
|
|
|
|
2005-01-19 16:05:31 +00:00
|
|
|
PRBool changed;
|
2005-01-29 20:36:09 +00:00
|
|
|
nsresult rv = mModel->SetNodeValue(mBoundNode, value, &changed);
|
2005-01-19 16:05:31 +00:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
if (changed) {
|
2005-01-29 20:36:09 +00:00
|
|
|
nsCOMPtr<nsIDOMNode> model = do_QueryInterface(mModel);
|
2005-01-19 16:05:31 +00:00
|
|
|
|
|
|
|
if (model) {
|
|
|
|
rv = nsXFormsUtils::DispatchEvent(model, eEvent_Recalculate);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
rv = nsXFormsUtils::DispatchEvent(model, eEvent_Revalidate);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
rv = nsXFormsUtils::DispatchEvent(model, eEvent_Refresh);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-10-13 09:51:52 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2004-11-07 08:54:32 +00:00
|
|
|
// nsIXFormsControl
|
2004-10-13 09:51:52 +00:00
|
|
|
|
2005-01-19 16:05:31 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXFormsInputElement::Refresh()
|
|
|
|
{
|
2005-01-29 20:36:09 +00:00
|
|
|
if (!mControl || !mModel)
|
2005-01-19 16:05:31 +00:00
|
|
|
return NS_OK;
|
2005-02-01 16:02:54 +00:00
|
|
|
|
2004-12-01 23:39:55 +00:00
|
|
|
nsAutoString text;
|
2005-01-19 16:05:31 +00:00
|
|
|
PRBool readonly = GetReadOnlyState();
|
|
|
|
if (mBoundNode) {
|
|
|
|
nsXFormsUtils::GetNodeValue(mBoundNode, text);
|
|
|
|
}
|
2004-10-26 00:34:03 +00:00
|
|
|
|
2004-12-06 23:04:58 +00:00
|
|
|
if (mType == eType_TextArea) {
|
2004-12-01 23:39:55 +00:00
|
|
|
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea = do_QueryInterface(mControl);
|
|
|
|
NS_ENSURE_STATE(textArea);
|
|
|
|
|
|
|
|
textArea->SetValue(text);
|
2005-01-19 16:05:31 +00:00
|
|
|
textArea->SetReadOnly(readonly);
|
2004-12-01 23:39:55 +00:00
|
|
|
} else {
|
|
|
|
nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(mControl);
|
|
|
|
NS_ENSURE_STATE(input);
|
|
|
|
|
2004-12-06 23:04:58 +00:00
|
|
|
if (mType == eType_Input) {
|
|
|
|
nsCOMPtr<nsISchemaType> type;
|
2005-01-29 20:36:09 +00:00
|
|
|
mModel->GetTypeForControl(this, getter_AddRefs(type));
|
2004-12-06 23:04:58 +00:00
|
|
|
nsCOMPtr<nsISchemaBuiltinType> biType = do_QueryInterface(type);
|
|
|
|
PRUint16 typeValue = nsISchemaBuiltinType::BUILTIN_TYPE_STRING;
|
|
|
|
if (biType)
|
|
|
|
biType->GetBuiltinType(&typeValue);
|
|
|
|
|
|
|
|
if (typeValue == nsISchemaBuiltinType::BUILTIN_TYPE_BOOLEAN) {
|
|
|
|
input->SetAttribute(NS_LITERAL_STRING("type"),
|
|
|
|
NS_LITERAL_STRING("checkbox"));
|
|
|
|
|
|
|
|
input->SetChecked(text.EqualsLiteral("true") ||
|
|
|
|
text.EqualsLiteral("1"));
|
|
|
|
} else {
|
|
|
|
input->RemoveAttribute(NS_LITERAL_STRING("type"));
|
|
|
|
input->SetValue(text);
|
|
|
|
}
|
2004-12-01 23:39:55 +00:00
|
|
|
} else {
|
|
|
|
input->SetValue(text);
|
2004-10-13 09:51:52 +00:00
|
|
|
}
|
2004-12-01 23:39:55 +00:00
|
|
|
|
2005-01-19 16:05:31 +00:00
|
|
|
input->SetReadOnly(readonly);
|
2004-10-13 09:51:52 +00:00
|
|
|
}
|
2004-10-26 00:34:03 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
2004-10-13 09:51:52 +00:00
|
|
|
}
|
|
|
|
|
2005-01-27 19:30:03 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsXFormsInputElement::TryFocus(PRBool* aOK)
|
|
|
|
{
|
|
|
|
*aOK = GetRelevantState() && nsXFormsUtils::FocusControl(mControl);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2004-10-13 09:51:52 +00:00
|
|
|
NS_HIDDEN_(nsresult)
|
|
|
|
NS_NewXFormsInputElement(nsIXTFElement **aResult)
|
|
|
|
{
|
2004-12-06 23:04:58 +00:00
|
|
|
*aResult = new nsXFormsInputElement(nsXFormsInputElement::eType_Input);
|
|
|
|
if (!*aResult)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
NS_ADDREF(*aResult);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_HIDDEN_(nsresult)
|
|
|
|
NS_NewXFormsSecretElement(nsIXTFElement **aResult)
|
|
|
|
{
|
|
|
|
*aResult = new nsXFormsInputElement(nsXFormsInputElement::eType_Secret);
|
2004-10-13 09:51:52 +00:00
|
|
|
if (!*aResult)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
NS_ADDREF(*aResult);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2004-12-01 23:39:55 +00:00
|
|
|
|
|
|
|
NS_HIDDEN_(nsresult)
|
|
|
|
NS_NewXFormsTextAreaElement(nsIXTFElement **aResult)
|
|
|
|
{
|
2004-12-06 23:04:58 +00:00
|
|
|
*aResult = new nsXFormsInputElement(nsXFormsInputElement::eType_TextArea);
|
2004-12-01 23:39:55 +00:00
|
|
|
if (!*aResult)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
NS_ADDREF(*aResult);
|
|
|
|
return NS_OK;
|
|
|
|
}
|