FX Bool considered harmful, part 3
[pdfium.git] / fpdfsdk / src / javascript / event.cpp
index 9168a2e..ee73e42 100644 (file)
-// Copyright 2014 PDFium Authors. All rights reserved.\r
-// Use of this source code is governed by a BSD-style license that can be\r
-// found in the LICENSE file.\r
\r
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
-\r
-#include "../../include/javascript/JavaScript.h"\r
-#include "../../include/javascript/IJavaScript.h"\r
-#include "../../include/javascript/JS_Define.h"\r
-#include "../../include/javascript/JS_Object.h"\r
-#include "../../include/javascript/JS_Value.h"\r
-#include "../../include/javascript/JS_EventHandler.h"\r
-//#include "../include/JS_ResMgr.h"\r
-#include "../../include/javascript/JS_Context.h"\r
-#include "../../include/javascript/event.h"\r
-#include "../../include/javascript/Field.h"\r
-\r
-/* -------------------------- event -------------------------- */\r
-\r
-BEGIN_JS_STATIC_CONST(CJS_Event)\r
-END_JS_STATIC_CONST()\r
-\r
-BEGIN_JS_STATIC_PROP(CJS_Event)\r
-       JS_STATIC_PROP_ENTRY(change)\r
-       JS_STATIC_PROP_ENTRY(changeEx)\r
-       JS_STATIC_PROP_ENTRY(commitKey)\r
-       JS_STATIC_PROP_ENTRY(fieldFull)\r
-       JS_STATIC_PROP_ENTRY(keyDown)\r
-       JS_STATIC_PROP_ENTRY(modifier)\r
-       JS_STATIC_PROP_ENTRY(name)\r
-       JS_STATIC_PROP_ENTRY(rc)\r
-       JS_STATIC_PROP_ENTRY(richChange)\r
-       JS_STATIC_PROP_ENTRY(richChangeEx)\r
-       JS_STATIC_PROP_ENTRY(richValue)\r
-       JS_STATIC_PROP_ENTRY(selEnd)\r
-       JS_STATIC_PROP_ENTRY(selStart)\r
-       JS_STATIC_PROP_ENTRY(shift)\r
-       JS_STATIC_PROP_ENTRY(source)\r
-       JS_STATIC_PROP_ENTRY(target)\r
-       JS_STATIC_PROP_ENTRY(targetName)\r
-       JS_STATIC_PROP_ENTRY(type)\r
-       JS_STATIC_PROP_ENTRY(value)\r
-       JS_STATIC_PROP_ENTRY(willCommit)\r
-END_JS_STATIC_PROP()\r
-\r
-BEGIN_JS_STATIC_METHOD(CJS_Event)  \r
-END_JS_STATIC_METHOD()\r
-\r
-IMPLEMENT_JS_CLASS(CJS_Event,event)\r
-\r
-event::event(CJS_Object * pJsObject) : CJS_EmbedObj(pJsObject)                           \r
-{\r
-}\r
-\r
-event::~event(void)\r
-{\r
-}\r
-\r
-FX_BOOL event::change(OBJ_PROP_PARAMS)\r
-{\r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       CFX_WideString &wChange = pEvent->Change();\r
-       if (vp.IsSetting())\r
-       {\r
-               if (vp.GetType() == VT_string)\r
-                       vp >> wChange;\r
-       }\r
-       else\r
-       {\r
-               vp << wChange;\r
-       }\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::changeEx(OBJ_PROP_PARAMS)\r
-{\r
-       if (!vp.IsGetting())return FALSE;\r
-\r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       vp << pEvent->ChangeEx();\r
-       return TRUE;    \r
-}\r
-\r
-FX_BOOL event::commitKey(OBJ_PROP_PARAMS)\r
-{\r
-       if (!vp.IsGetting())return FALSE;\r
-\r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       vp << pEvent->CommitKey();\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::fieldFull(OBJ_PROP_PARAMS)\r
-{      \r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       if (!vp.IsGetting() && wcscmp((const wchar_t*)pEvent->Name(),L"Keystroke") != 0)\r
-               return FALSE;\r
-\r
-       if (pEvent->FieldFull())\r
-               vp << TRUE;\r
-       else\r
-               vp << FALSE;\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::keyDown(OBJ_PROP_PARAMS)\r
-{\r
-       if (!vp.IsGetting())return FALSE;\r
-\r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       if (pEvent->KeyDown())\r
-               vp << TRUE;\r
-       else\r
-               vp << FALSE;\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::modifier(OBJ_PROP_PARAMS)\r
-{\r
-       if (!vp.IsGetting())return FALSE;\r
-\r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       if (pEvent->Modifier())\r
-               vp << TRUE;\r
-       else\r
-               vp << FALSE;\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::name(OBJ_PROP_PARAMS)\r
-{\r
-       if (!vp.IsGetting())return FALSE;\r
-\r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       vp << pEvent->Name();\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::rc(OBJ_PROP_PARAMS)\r
-{\r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-    FX_BOOL &bRc = pEvent->Rc();\r
-       if (vp.IsSetting())\r
-       {\r
-               vp>>bRc;\r
-       }\r
-       else\r
-       {\r
-               vp<<bRc;\r
-       }\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::richChange(OBJ_PROP_PARAMS)\r
-{\r
-       return TRUE;\r
-       if (vp.IsSetting())\r
-       {\r
-       }\r
-       else\r
-       {\r
-               ;\r
-       }\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::richChangeEx(OBJ_PROP_PARAMS)\r
-{\r
-       return TRUE;\r
-       if (vp.IsSetting())\r
-       {\r
-       }\r
-       else\r
-       {\r
-               ;\r
-       }\r
-       return TRUE;\r
-}\r
-\r
-\r
-FX_BOOL event::richValue(OBJ_PROP_PARAMS)\r
-{\r
-       return TRUE;\r
-       if (vp.IsSetting())\r
-       {\r
-       }\r
-       else\r
-       {\r
-               ;\r
-       }\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::selEnd(OBJ_PROP_PARAMS)\r
-{\r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       if (wcscmp((const wchar_t*)pEvent->Name(),L"Keystroke") != 0)\r
-       {\r
-               return TRUE;\r
-       }\r
-\r
-       int &iSelEnd = pEvent->SelEnd();\r
-       if (vp.IsSetting())\r
-       {\r
-               vp >> iSelEnd;\r
-       }\r
-       else\r
-       {\r
-               vp << iSelEnd;\r
-       }\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::selStart(OBJ_PROP_PARAMS)\r
-{      \r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       if (wcscmp((const wchar_t*)pEvent->Name(),L"Keystroke") != 0)\r
-       {\r
-               return TRUE;\r
-       }\r
-       int &iSelStart = pEvent->SelStart();\r
-       if (vp.IsSetting())\r
-       {\r
-               vp >> iSelStart;\r
-       }\r
-       else\r
-       {\r
-               vp << iSelStart;\r
-       }\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::shift(OBJ_PROP_PARAMS)\r
-{\r
-       if (!vp.IsGetting())return FALSE;\r
-\r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       if (pEvent->Shift())\r
-               vp << TRUE;\r
-       else\r
-               vp << FALSE;\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::source(OBJ_PROP_PARAMS)\r
-{\r
-       if (!vp.IsGetting())return FALSE;       \r
-\r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       vp << pEvent->Source()->GetJSObject();\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::target(OBJ_PROP_PARAMS)\r
-{\r
-       if (!vp.IsGetting())return FALSE;\r
-\r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       vp<<pEvent->Target_Field()->GetJSObject();\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::targetName(OBJ_PROP_PARAMS)\r
-{\r
-       if (!vp.IsGetting())return FALSE;\r
-\r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       vp << pEvent->TargetName();\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::type(OBJ_PROP_PARAMS)\r
-{\r
-       if (!vp.IsGetting())return FALSE;\r
-\r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       vp << pEvent->Type();\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::value(OBJ_PROP_PARAMS)\r
-{\r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       if (wcscmp((const wchar_t*)pEvent->Type(),L"Field") != 0)\r
-               return FALSE;\r
-       if(!pEvent->m_pValue)\r
-               return FALSE;\r
-       CFX_WideString & val = pEvent->Value();\r
-       if (vp.IsSetting())\r
-       {\r
-               val = vp;\r
-       }\r
-       else\r
-       {\r
-               vp << val;\r
-       }\r
-       return TRUE;\r
-}\r
-\r
-FX_BOOL event::willCommit(OBJ_PROP_PARAMS)\r
-{\r
-       if (!vp.IsGetting())return FALSE;\r
-\r
-       CJS_Context* pContext = (CJS_Context*)cc;\r
-       ASSERT(pContext != NULL);\r
-       CJS_EventHandler* pEvent = pContext->GetEventHandler();\r
-       ASSERT(pEvent != NULL);\r
-\r
-       if (pEvent->WillCommit())\r
-               vp << TRUE;\r
-       else\r
-               vp << FALSE;\r
-       return TRUE;\r
-}\r
-\r
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "../../include/javascript/JavaScript.h"
+#include "../../include/javascript/IJavaScript.h"
+#include "../../include/javascript/JS_Define.h"
+#include "../../include/javascript/JS_Object.h"
+#include "../../include/javascript/JS_Value.h"
+#include "../../include/javascript/JS_EventHandler.h"
+//#include "../include/JS_ResMgr.h"
+#include "../../include/javascript/JS_Context.h"
+#include "../../include/javascript/event.h"
+#include "../../include/javascript/Field.h"
+
+/* -------------------------- event -------------------------- */
+
+BEGIN_JS_STATIC_CONST(CJS_Event)
+END_JS_STATIC_CONST()
+
+BEGIN_JS_STATIC_PROP(CJS_Event)
+       JS_STATIC_PROP_ENTRY(change)
+       JS_STATIC_PROP_ENTRY(changeEx)
+       JS_STATIC_PROP_ENTRY(commitKey)
+       JS_STATIC_PROP_ENTRY(fieldFull)
+       JS_STATIC_PROP_ENTRY(keyDown)
+       JS_STATIC_PROP_ENTRY(modifier)
+       JS_STATIC_PROP_ENTRY(name)
+       JS_STATIC_PROP_ENTRY(rc)
+       JS_STATIC_PROP_ENTRY(richChange)
+       JS_STATIC_PROP_ENTRY(richChangeEx)
+       JS_STATIC_PROP_ENTRY(richValue)
+       JS_STATIC_PROP_ENTRY(selEnd)
+       JS_STATIC_PROP_ENTRY(selStart)
+       JS_STATIC_PROP_ENTRY(shift)
+       JS_STATIC_PROP_ENTRY(source)
+       JS_STATIC_PROP_ENTRY(target)
+       JS_STATIC_PROP_ENTRY(targetName)
+       JS_STATIC_PROP_ENTRY(type)
+       JS_STATIC_PROP_ENTRY(value)
+       JS_STATIC_PROP_ENTRY(willCommit)
+END_JS_STATIC_PROP()
+
+BEGIN_JS_STATIC_METHOD(CJS_Event)
+END_JS_STATIC_METHOD()
+
+IMPLEMENT_JS_CLASS(CJS_Event,event)
+
+event::event(CJS_Object * pJsObject) : CJS_EmbedObj(pJsObject)
+{
+}
+
+event::~event(void)
+{
+}
+
+bool event::change(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       CFX_WideString &wChange = pEvent->Change();
+       if (vp.IsSetting())
+       {
+               if (vp.GetType() == VT_string)
+                       vp >> wChange;
+       }
+       else
+       {
+               vp << wChange;
+       }
+       return true;
+}
+
+bool event::changeEx(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       if (!vp.IsGetting())return false;
+
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       vp << pEvent->ChangeEx();
+       return true;
+}
+
+bool event::commitKey(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       if (!vp.IsGetting())return false;
+
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       vp << pEvent->CommitKey();
+       return true;
+}
+
+bool event::fieldFull(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       if (!vp.IsGetting() && wcscmp((const wchar_t*)pEvent->Name(),L"Keystroke") != 0)
+               return false;
+
+       if (pEvent->FieldFull())
+               vp << true;
+       else
+               vp << false;
+       return true;
+}
+
+bool event::keyDown(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       if (!vp.IsGetting())return false;
+
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       if (pEvent->KeyDown())
+               vp << true;
+       else
+               vp << false;
+       return true;
+}
+
+bool event::modifier(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       if (!vp.IsGetting())return false;
+
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       if (pEvent->Modifier())
+               vp << true;
+       else
+               vp << false;
+       return true;
+}
+
+bool event::name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       if (!vp.IsGetting())return false;
+
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       vp << pEvent->Name();
+       return true;
+}
+
+bool event::rc(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+    bool &bRc = pEvent->Rc();
+       if (vp.IsSetting())
+       {
+               vp>>bRc;
+       }
+       else
+       {
+               vp<<bRc;
+       }
+       return true;
+}
+
+bool event::richChange(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       return true;
+       if (vp.IsSetting())
+       {
+       }
+       else
+       {
+               ;
+       }
+       return true;
+}
+
+bool event::richChangeEx(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       return true;
+       if (vp.IsSetting())
+       {
+       }
+       else
+       {
+               ;
+       }
+       return true;
+}
+
+
+bool event::richValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       return true;
+       if (vp.IsSetting())
+       {
+       }
+       else
+       {
+               ;
+       }
+       return true;
+}
+
+bool event::selEnd(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       if (wcscmp((const wchar_t*)pEvent->Name(),L"Keystroke") != 0)
+       {
+               return true;
+       }
+
+       int &iSelEnd = pEvent->SelEnd();
+       if (vp.IsSetting())
+       {
+               vp >> iSelEnd;
+       }
+       else
+       {
+               vp << iSelEnd;
+       }
+       return true;
+}
+
+bool event::selStart(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       if (wcscmp((const wchar_t*)pEvent->Name(),L"Keystroke") != 0)
+       {
+               return true;
+       }
+       int &iSelStart = pEvent->SelStart();
+       if (vp.IsSetting())
+       {
+               vp >> iSelStart;
+       }
+       else
+       {
+               vp << iSelStart;
+       }
+       return true;
+}
+
+bool event::shift(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       if (!vp.IsGetting())return false;
+
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       if (pEvent->Shift())
+               vp << true;
+       else
+               vp << false;
+       return true;
+}
+
+bool event::source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       if (!vp.IsGetting())return false;
+
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       vp << pEvent->Source()->GetJSObject();
+       return true;
+}
+
+bool event::target(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       if (!vp.IsGetting())return false;
+
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       vp<<pEvent->Target_Field()->GetJSObject();
+       return true;
+}
+
+bool event::targetName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       if (!vp.IsGetting())return false;
+
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       vp << pEvent->TargetName();
+       return true;
+}
+
+bool event::type(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       if (!vp.IsGetting())return false;
+
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       vp << pEvent->Type();
+       return true;
+}
+
+bool event::value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       if (wcscmp((const wchar_t*)pEvent->Type(),L"Field") != 0)
+               return false;
+       if(!pEvent->m_pValue)
+               return false;
+       CFX_WideString & val = pEvent->Value();
+       if (vp.IsSetting())
+       {
+               vp >> val;
+       }
+       else
+       {
+               vp << val;
+       }
+       return true;
+}
+
+bool event::willCommit(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
+{
+       if (!vp.IsGetting())return false;
+
+       CJS_Context* pContext = (CJS_Context*)cc;
+       ASSERT(pContext != NULL);
+       CJS_EventHandler* pEvent = pContext->GetEventHandler();
+       ASSERT(pEvent != NULL);
+
+       if (pEvent->WillCommit())
+               vp << true;
+       else
+               vp << false;
+       return true;
+}
+