Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: fpdfsdk/src/javascript/event.cpp

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

Powered by Google App Engine
This is Rietveld 408576698