XForms bug 281668 - select1 as a combobox. patch my smaug, r=beaufour,me a=mkaply
git-svn-id: svn://10.0.0.236/trunk@177066 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -37,89 +37,14 @@
|
||||
*
|
||||
* ***** 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"
|
||||
#include "nsIXFormsControl.h"
|
||||
#include "nsXFormsControlStub.h"
|
||||
#include "nsISchema.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIDOMXPathResult.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsXFormsUtils.h"
|
||||
#include "nsIModelElementPrivate.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMXPathExpression.h"
|
||||
#include "nsXFormsAtoms.h"
|
||||
#include "nsXFormsDelegateStub.h"
|
||||
|
||||
/**
|
||||
* Implementation of the \<input\>, \<secret\>, and \<textarea\> elements.
|
||||
*/
|
||||
class nsXFormsInputElement : public nsXFormsDelegateStub
|
||||
{
|
||||
public:
|
||||
|
||||
// nsIXFormsDelegate
|
||||
NS_IMETHOD SetValue(const nsAString& aValue);
|
||||
|
||||
enum ControlType {
|
||||
eType_Input,
|
||||
eType_Secret,
|
||||
eType_TextArea
|
||||
};
|
||||
|
||||
#ifdef DEBUG_smaug
|
||||
virtual const char* Name() { return "input"; }
|
||||
#endif
|
||||
|
||||
// nsXFormsInputElement
|
||||
nsXFormsInputElement(const nsAString& aType)
|
||||
: nsXFormsDelegateStub(aType)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// nsIXFormsDelegate
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsInputElement::SetValue(const nsAString& aValue)
|
||||
{
|
||||
if (!mBoundNode || !mModel)
|
||||
return NS_OK;
|
||||
|
||||
PRBool changed;
|
||||
nsresult rv = mModel->SetNodeValue(mBoundNode, aValue, &changed);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (changed) {
|
||||
nsCOMPtr<nsIDOMNode> model = do_QueryInterface(mModel);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Creators
|
||||
|
||||
NS_HIDDEN_(nsresult)
|
||||
NS_NewXFormsInputElement(nsIXTFElement **aResult)
|
||||
{
|
||||
*aResult = new nsXFormsInputElement(NS_LITERAL_STRING("input"));
|
||||
*aResult = new nsXFormsDelegateStub(NS_LITERAL_STRING("input"));
|
||||
if (!*aResult)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@@ -130,7 +55,7 @@ NS_NewXFormsInputElement(nsIXTFElement **aResult)
|
||||
NS_HIDDEN_(nsresult)
|
||||
NS_NewXFormsSecretElement(nsIXTFElement **aResult)
|
||||
{
|
||||
*aResult = new nsXFormsInputElement(NS_LITERAL_STRING("secret"));
|
||||
*aResult = new nsXFormsDelegateStub(NS_LITERAL_STRING("secret"));
|
||||
if (!*aResult)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
@@ -141,7 +66,7 @@ NS_NewXFormsSecretElement(nsIXTFElement **aResult)
|
||||
NS_HIDDEN_(nsresult)
|
||||
NS_NewXFormsTextAreaElement(nsIXTFElement **aResult)
|
||||
{
|
||||
*aResult = new nsXFormsInputElement(NS_LITERAL_STRING("textarea"));
|
||||
*aResult = new nsXFormsDelegateStub(NS_LITERAL_STRING("textarea"));
|
||||
if (!*aResult)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user