Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 1 | // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 4 | |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 7 | #include "event.h" |
| 8 | |
| 9 | #include "Field.h" |
| 10 | #include "JS_Context.h" |
| 11 | #include "JS_Define.h" |
| 12 | #include "JS_EventHandler.h" |
| 13 | #include "JS_Object.h" |
| 14 | #include "JS_Value.h" |
| 15 | #include "fpdfsdk/include/javascript/IJavaScript.h" |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 16 | |
| 17 | /* -------------------------- event -------------------------- */ |
| 18 | |
| 19 | BEGIN_JS_STATIC_CONST(CJS_Event) |
| 20 | END_JS_STATIC_CONST() |
| 21 | |
| 22 | BEGIN_JS_STATIC_PROP(CJS_Event) |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 23 | JS_STATIC_PROP_ENTRY(change) |
| 24 | JS_STATIC_PROP_ENTRY(changeEx) |
| 25 | JS_STATIC_PROP_ENTRY(commitKey) |
| 26 | JS_STATIC_PROP_ENTRY(fieldFull) |
| 27 | JS_STATIC_PROP_ENTRY(keyDown) |
| 28 | JS_STATIC_PROP_ENTRY(modifier) |
| 29 | JS_STATIC_PROP_ENTRY(name) |
| 30 | JS_STATIC_PROP_ENTRY(rc) |
| 31 | JS_STATIC_PROP_ENTRY(richChange) |
| 32 | JS_STATIC_PROP_ENTRY(richChangeEx) |
| 33 | JS_STATIC_PROP_ENTRY(richValue) |
| 34 | JS_STATIC_PROP_ENTRY(selEnd) |
| 35 | JS_STATIC_PROP_ENTRY(selStart) |
| 36 | JS_STATIC_PROP_ENTRY(shift) |
| 37 | JS_STATIC_PROP_ENTRY(source) |
| 38 | JS_STATIC_PROP_ENTRY(target) |
| 39 | JS_STATIC_PROP_ENTRY(targetName) |
| 40 | JS_STATIC_PROP_ENTRY(type) |
| 41 | JS_STATIC_PROP_ENTRY(value) |
| 42 | JS_STATIC_PROP_ENTRY(willCommit) |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 43 | END_JS_STATIC_PROP() |
| 44 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 45 | BEGIN_JS_STATIC_METHOD(CJS_Event) |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 46 | END_JS_STATIC_METHOD() |
| 47 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 48 | IMPLEMENT_JS_CLASS(CJS_Event, event) |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 49 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 50 | event::event(CJS_Object* pJsObject) : CJS_EmbedObj(pJsObject) {} |
| 51 | |
| 52 | event::~event() { |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 53 | } |
| 54 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 55 | FX_BOOL event::change(IJS_Context* cc, |
| 56 | CJS_PropValue& vp, |
| 57 | CFX_WideString& sError) { |
| 58 | CJS_Context* pContext = (CJS_Context*)cc; |
| 59 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
| 60 | CFX_WideString& wChange = pEvent->Change(); |
| 61 | if (vp.IsSetting()) { |
| 62 | if (vp.GetType() == CJS_Value::VT_string) |
| 63 | vp >> wChange; |
| 64 | } else { |
| 65 | vp << wChange; |
| 66 | } |
| 67 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 68 | } |
| 69 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 70 | FX_BOOL event::changeEx(IJS_Context* cc, |
| 71 | CJS_PropValue& vp, |
| 72 | CFX_WideString& sError) { |
| 73 | if (!vp.IsGetting()) |
| 74 | return FALSE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 75 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 76 | CJS_Context* pContext = (CJS_Context*)cc; |
| 77 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
| 78 | |
| 79 | vp << pEvent->ChangeEx(); |
| 80 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 81 | } |
| 82 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 83 | FX_BOOL event::commitKey(IJS_Context* cc, |
| 84 | CJS_PropValue& vp, |
| 85 | CFX_WideString& sError) { |
| 86 | if (!vp.IsGetting()) |
| 87 | return FALSE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 88 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 89 | CJS_Context* pContext = (CJS_Context*)cc; |
| 90 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 91 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 92 | vp << pEvent->CommitKey(); |
| 93 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 94 | } |
| 95 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 96 | FX_BOOL event::fieldFull(IJS_Context* cc, |
| 97 | CJS_PropValue& vp, |
| 98 | CFX_WideString& sError) { |
| 99 | CJS_Context* pContext = (CJS_Context*)cc; |
| 100 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 101 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 102 | if (!vp.IsGetting() && |
| 103 | wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) |
| 104 | return FALSE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 105 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 106 | if (pEvent->FieldFull()) |
| 107 | vp << TRUE; |
| 108 | else |
| 109 | vp << FALSE; |
| 110 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 111 | } |
| 112 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 113 | FX_BOOL event::keyDown(IJS_Context* cc, |
| 114 | CJS_PropValue& vp, |
| 115 | CFX_WideString& sError) { |
| 116 | if (!vp.IsGetting()) |
| 117 | return FALSE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 118 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 119 | CJS_Context* pContext = (CJS_Context*)cc; |
| 120 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 121 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 122 | if (pEvent->KeyDown()) |
| 123 | vp << TRUE; |
| 124 | else |
| 125 | vp << FALSE; |
| 126 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 127 | } |
| 128 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 129 | FX_BOOL event::modifier(IJS_Context* cc, |
| 130 | CJS_PropValue& vp, |
| 131 | CFX_WideString& sError) { |
| 132 | if (!vp.IsGetting()) |
| 133 | return FALSE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 134 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 135 | CJS_Context* pContext = (CJS_Context*)cc; |
| 136 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 137 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 138 | if (pEvent->Modifier()) |
| 139 | vp << TRUE; |
| 140 | else |
| 141 | vp << FALSE; |
| 142 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 143 | } |
| 144 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 145 | FX_BOOL event::name(IJS_Context* cc, |
| 146 | CJS_PropValue& vp, |
| 147 | CFX_WideString& sError) { |
| 148 | if (!vp.IsGetting()) |
| 149 | return FALSE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 150 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 151 | CJS_Context* pContext = (CJS_Context*)cc; |
| 152 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 153 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 154 | vp << pEvent->Name(); |
| 155 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 156 | } |
| 157 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 158 | FX_BOOL event::rc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { |
| 159 | CJS_Context* pContext = (CJS_Context*)cc; |
| 160 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 161 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 162 | FX_BOOL& bRc = pEvent->Rc(); |
| 163 | if (vp.IsSetting()) { |
| 164 | vp >> bRc; |
| 165 | } else { |
| 166 | vp << bRc; |
| 167 | } |
| 168 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 169 | } |
| 170 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 171 | FX_BOOL event::richChange(IJS_Context* cc, |
| 172 | CJS_PropValue& vp, |
| 173 | CFX_WideString& sError) { |
| 174 | return TRUE; |
| 175 | if (vp.IsSetting()) { |
| 176 | } else { |
| 177 | ; |
| 178 | } |
| 179 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 180 | } |
| 181 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 182 | FX_BOOL event::richChangeEx(IJS_Context* cc, |
| 183 | CJS_PropValue& vp, |
| 184 | CFX_WideString& sError) { |
| 185 | return TRUE; |
| 186 | if (vp.IsSetting()) { |
| 187 | } else { |
| 188 | ; |
| 189 | } |
| 190 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 191 | } |
| 192 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 193 | FX_BOOL event::richValue(IJS_Context* cc, |
| 194 | CJS_PropValue& vp, |
| 195 | CFX_WideString& sError) { |
| 196 | return TRUE; |
| 197 | if (vp.IsSetting()) { |
| 198 | } else { |
| 199 | ; |
| 200 | } |
| 201 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 202 | } |
| 203 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 204 | FX_BOOL event::selEnd(IJS_Context* cc, |
| 205 | CJS_PropValue& vp, |
| 206 | CFX_WideString& sError) { |
| 207 | CJS_Context* pContext = (CJS_Context*)cc; |
| 208 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 209 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 210 | if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) { |
| 211 | return TRUE; |
| 212 | } |
| 213 | |
| 214 | int& iSelEnd = pEvent->SelEnd(); |
| 215 | if (vp.IsSetting()) { |
| 216 | vp >> iSelEnd; |
| 217 | } else { |
| 218 | vp << iSelEnd; |
| 219 | } |
| 220 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 221 | } |
| 222 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 223 | FX_BOOL event::selStart(IJS_Context* cc, |
| 224 | CJS_PropValue& vp, |
| 225 | CFX_WideString& sError) { |
| 226 | CJS_Context* pContext = (CJS_Context*)cc; |
| 227 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 228 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 229 | if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) { |
| 230 | return TRUE; |
| 231 | } |
| 232 | int& iSelStart = pEvent->SelStart(); |
| 233 | if (vp.IsSetting()) { |
| 234 | vp >> iSelStart; |
| 235 | } else { |
| 236 | vp << iSelStart; |
| 237 | } |
| 238 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 239 | } |
| 240 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 241 | FX_BOOL event::shift(IJS_Context* cc, |
| 242 | CJS_PropValue& vp, |
| 243 | CFX_WideString& sError) { |
| 244 | if (!vp.IsGetting()) |
| 245 | return FALSE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 246 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 247 | CJS_Context* pContext = (CJS_Context*)cc; |
| 248 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
| 249 | |
| 250 | if (pEvent->Shift()) |
| 251 | vp << TRUE; |
| 252 | else |
| 253 | vp << FALSE; |
| 254 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 255 | } |
| 256 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 257 | FX_BOOL event::source(IJS_Context* cc, |
| 258 | CJS_PropValue& vp, |
| 259 | CFX_WideString& sError) { |
| 260 | if (!vp.IsGetting()) |
| 261 | return FALSE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 262 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 263 | CJS_Context* pContext = (CJS_Context*)cc; |
| 264 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 265 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 266 | vp << pEvent->Source()->GetJSObject(); |
| 267 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 268 | } |
| 269 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 270 | FX_BOOL event::target(IJS_Context* cc, |
| 271 | CJS_PropValue& vp, |
| 272 | CFX_WideString& sError) { |
| 273 | if (!vp.IsGetting()) |
| 274 | return FALSE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 275 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 276 | CJS_Context* pContext = (CJS_Context*)cc; |
| 277 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 278 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 279 | vp << pEvent->Target_Field()->GetJSObject(); |
| 280 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 281 | } |
| 282 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 283 | FX_BOOL event::targetName(IJS_Context* cc, |
| 284 | CJS_PropValue& vp, |
| 285 | CFX_WideString& sError) { |
| 286 | if (!vp.IsGetting()) |
| 287 | return FALSE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 288 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 289 | CJS_Context* pContext = (CJS_Context*)cc; |
| 290 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 291 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 292 | vp << pEvent->TargetName(); |
| 293 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 294 | } |
| 295 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 296 | FX_BOOL event::type(IJS_Context* cc, |
| 297 | CJS_PropValue& vp, |
| 298 | CFX_WideString& sError) { |
| 299 | if (!vp.IsGetting()) |
| 300 | return FALSE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 301 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 302 | CJS_Context* pContext = (CJS_Context*)cc; |
| 303 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 304 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 305 | vp << pEvent->Type(); |
| 306 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 307 | } |
| 308 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 309 | FX_BOOL event::value(IJS_Context* cc, |
| 310 | CJS_PropValue& vp, |
| 311 | CFX_WideString& sError) { |
| 312 | CJS_Context* pContext = (CJS_Context*)cc; |
| 313 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 314 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 315 | if (wcscmp((const wchar_t*)pEvent->Type(), L"Field") != 0) |
| 316 | return FALSE; |
| 317 | if (!pEvent->m_pValue) |
| 318 | return FALSE; |
| 319 | CFX_WideString& val = pEvent->Value(); |
| 320 | if (vp.IsSetting()) { |
| 321 | vp >> val; |
| 322 | } else { |
| 323 | vp << val; |
| 324 | } |
| 325 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 326 | } |
| 327 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 328 | FX_BOOL event::willCommit(IJS_Context* cc, |
| 329 | CJS_PropValue& vp, |
| 330 | CFX_WideString& sError) { |
| 331 | if (!vp.IsGetting()) |
| 332 | return FALSE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 333 | |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 334 | CJS_Context* pContext = (CJS_Context*)cc; |
| 335 | CJS_EventHandler* pEvent = pContext->GetEventHandler(); |
| 336 | |
| 337 | if (pEvent->WillCommit()) |
| 338 | vp << TRUE; |
| 339 | else |
| 340 | vp << FALSE; |
| 341 | return TRUE; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 342 | } |