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

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

Issue 1382263002: Store object definition ID in each js_class. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use size_t vars with FX_ArraySize. Created 5 years, 2 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
« no previous file with comments | « fpdfsdk/src/javascript/Field.h ('k') | fpdfsdk/src/javascript/Icon.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "Field.h" 7 #include "Field.h"
8 8
9 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. 9 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment.
10 #include "../../include/javascript/IJavaScript.h" 10 #include "../../include/javascript/IJavaScript.h"
(...skipping 3292 matching lines...) Expand 10 before | Expand all | Expand 10 after
3303 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); 3303 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
3304 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) 3304 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
3305 return FALSE; 3305 return FALSE;
3306 3306
3307 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); 3307 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
3308 if (!pFormControl) 3308 if (!pFormControl)
3309 return FALSE; 3309 return FALSE;
3310 3310
3311 CJS_Context* pContext = (CJS_Context*)cc; 3311 CJS_Context* pContext = (CJS_Context*)cc;
3312 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); 3312 CJS_Runtime* pRuntime = pContext->GetJSRuntime();
3313 v8::Local<v8::Object> pObj = 3313 v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj(
3314 FXJS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext, 3314 pRuntime->GetIsolate(), pContext, CJS_Icon::g_nObjDefnID);
3315 FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Icon"));
3316 ASSERT(pObj.IsEmpty() == FALSE); 3315 ASSERT(pObj.IsEmpty() == FALSE);
3317 3316
3318 CJS_Icon* pJS_Icon = (CJS_Icon*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); 3317 CJS_Icon* pJS_Icon = (CJS_Icon*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj);
3319 Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject(); 3318 Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject();
3320 3319
3321 CPDF_Stream* pIconStream = NULL; 3320 CPDF_Stream* pIconStream = NULL;
3322 if (nface == 0) 3321 if (nface == 0)
3323 pIconStream = pFormControl->GetNormalIcon(); 3322 pIconStream = pFormControl->GetNormalIcon();
3324 else if (nface == 1) 3323 else if (nface == 1)
3325 pIconStream = pFormControl->GetDownIcon(); 3324 pIconStream = pFormControl->GetDownIcon();
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
3514 3513
3515 CJS_Context* pContext = (CJS_Context*)cc; 3514 CJS_Context* pContext = (CJS_Context*)cc;
3516 ASSERT(pContext != NULL); 3515 ASSERT(pContext != NULL);
3517 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); 3516 CJS_Runtime* pRuntime = pContext->GetJSRuntime();
3518 ASSERT(pRuntime != NULL); 3517 ASSERT(pRuntime != NULL);
3519 3518
3520 CJS_Array FormFieldArray(m_isolate); 3519 CJS_Array FormFieldArray(m_isolate);
3521 for (int j = 0, jsz = swSort.GetSize(); j < jsz; j++) { 3520 for (int j = 0, jsz = swSort.GetSize(); j < jsz; j++) {
3522 nonstd::unique_ptr<CFX_WideString> pStr(swSort.GetAt(j)); 3521 nonstd::unique_ptr<CFX_WideString> pStr(swSort.GetAt(j));
3523 v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj( 3522 v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj(
3524 pRuntime->GetIsolate(), pContext, 3523 pRuntime->GetIsolate(), pContext, CJS_Field::g_nObjDefnID);
3525 FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Field")); 3524 ASSERT(!pObj.IsEmpty());
3526 ASSERT(pObj.IsEmpty() == FALSE);
3527 3525
3528 CJS_Field* pJSField = 3526 CJS_Field* pJSField =
3529 (CJS_Field*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); 3527 (CJS_Field*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj);
3530 Field* pField = (Field*)pJSField->GetEmbedObject(); 3528 Field* pField = (Field*)pJSField->GetEmbedObject();
3531 pField->AttachField(m_pJSDoc, *pStr); 3529 pField->AttachField(m_pJSDoc, *pStr);
3532 3530
3533 CJS_Value FormFieldValue(m_isolate); 3531 CJS_Value FormFieldValue(m_isolate);
3534 FormFieldValue = pJSField; 3532 FormFieldValue = pJSField;
3535 FormFieldArray.SetElement(j, FormFieldValue); 3533 FormFieldArray.SetElement(j, FormFieldValue);
3536 } 3534 }
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
4041 #define JS_FIELD_MINWIDTH 1 4039 #define JS_FIELD_MINWIDTH 1
4042 #define JS_FIELD_MINHEIGHT 1 4040 #define JS_FIELD_MINHEIGHT 1
4043 4041
4044 void Field::AddField(CPDFSDK_Document* pDocument, 4042 void Field::AddField(CPDFSDK_Document* pDocument,
4045 int nPageIndex, 4043 int nPageIndex,
4046 int nFieldType, 4044 int nFieldType,
4047 const CFX_WideString& sName, 4045 const CFX_WideString& sName,
4048 const CPDF_Rect& rcCoords) { 4046 const CPDF_Rect& rcCoords) {
4049 // Not supported. 4047 // Not supported.
4050 } 4048 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/Field.h ('k') | fpdfsdk/src/javascript/Icon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698