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

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

Issue 1347833002: Ensure functions in FXJS_V8 are prefixed by FXJS_. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, nits, format. Created 5 years, 3 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/Document.cpp ('k') | fpdfsdk/src/javascript/JS_Context.cpp » ('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 "../../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"
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 CJS_PropValue& vp, 1031 CJS_PropValue& vp,
1032 CFX_WideString& sError) { 1032 CFX_WideString& sError) {
1033 ASSERT(m_pDocument != NULL); 1033 ASSERT(m_pDocument != NULL);
1034 1034
1035 if (vp.IsSetting()) { 1035 if (vp.IsSetting()) {
1036 if (!m_bCanSet) 1036 if (!m_bCanSet)
1037 return FALSE; 1037 return FALSE;
1038 1038
1039 CFX_DWordArray array; 1039 CFX_DWordArray array;
1040 1040
1041 if (vp.GetType() == VT_number) { 1041 if (vp.GetType() == CJS_Value::VT_number) {
1042 int iSelecting = 0; 1042 int iSelecting = 0;
1043 vp >> iSelecting; 1043 vp >> iSelecting;
1044 array.Add(iSelecting); 1044 array.Add(iSelecting);
1045 } else if (vp.IsArrayObject()) { 1045 } else if (vp.IsArrayObject()) {
1046 CJS_Array SelArray(m_isolate); 1046 CJS_Array SelArray(m_isolate);
1047 CJS_Value SelValue(m_isolate); 1047 CJS_Value SelValue(m_isolate);
1048 int iSelecting; 1048 int iSelecting;
1049 vp >> SelArray; 1049 vp >> SelArray;
1050 for (int i = 0, sz = SelArray.GetLength(); i < sz; i++) { 1050 for (int i = 0, sz = SelArray.GetLength(); i < sz; i++) {
1051 SelArray.GetElement(i, SelValue); 1051 SelArray.GetElement(i, SelValue);
(...skipping 2257 matching lines...) Expand 10 before | Expand all | Expand 10 after
3309 if (!pFormControl) 3309 if (!pFormControl)
3310 return FALSE; 3310 return FALSE;
3311 3311
3312 CJS_Context* pContext = (CJS_Context*)cc; 3312 CJS_Context* pContext = (CJS_Context*)cc;
3313 ASSERT(pContext != NULL); 3313 ASSERT(pContext != NULL);
3314 3314
3315 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); 3315 CJS_Runtime* pRuntime = pContext->GetJSRuntime();
3316 ASSERT(pRuntime != NULL); 3316 ASSERT(pRuntime != NULL);
3317 3317
3318 v8::Local<v8::Object> pObj = 3318 v8::Local<v8::Object> pObj =
3319 JS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext, 3319 FXJS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext,
3320 JS_GetObjDefnID(pRuntime->GetIsolate(), L"Icon")); 3320 FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Icon"));
3321 ASSERT(pObj.IsEmpty() == FALSE); 3321 ASSERT(pObj.IsEmpty() == FALSE);
3322 3322
3323 CJS_Icon* pJS_Icon = (CJS_Icon*)JS_GetPrivate(pObj); 3323 CJS_Icon* pJS_Icon = (CJS_Icon*)FXJS_GetPrivate(pObj);
3324 ASSERT(pJS_Icon != NULL);
3325
3326 Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject(); 3324 Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject();
3327 ASSERT(pIcon != NULL);
3328 3325
3329 CPDF_Stream* pIconStream = NULL; 3326 CPDF_Stream* pIconStream = NULL;
3330 if (nface == 0) 3327 if (nface == 0)
3331 pIconStream = pFormControl->GetNormalIcon(); 3328 pIconStream = pFormControl->GetNormalIcon();
3332 else if (nface == 1) 3329 else if (nface == 1)
3333 pIconStream = pFormControl->GetDownIcon(); 3330 pIconStream = pFormControl->GetDownIcon();
3334 else if (nface == 2) 3331 else if (nface == 2)
3335 pIconStream = pFormControl->GetRolloverIcon(); 3332 pIconStream = pFormControl->GetRolloverIcon();
3336 else 3333 else
3337 return FALSE; 3334 return FALSE;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
3524 3521
3525 CJS_Context* pContext = (CJS_Context*)cc; 3522 CJS_Context* pContext = (CJS_Context*)cc;
3526 ASSERT(pContext != NULL); 3523 ASSERT(pContext != NULL);
3527 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); 3524 CJS_Runtime* pRuntime = pContext->GetJSRuntime();
3528 ASSERT(pRuntime != NULL); 3525 ASSERT(pRuntime != NULL);
3529 3526
3530 CJS_Array FormFieldArray(m_isolate); 3527 CJS_Array FormFieldArray(m_isolate);
3531 for (int j = 0, jsz = swSort.GetSize(); j < jsz; j++) { 3528 for (int j = 0, jsz = swSort.GetSize(); j < jsz; j++) {
3532 CFX_WideString* pStr = swSort.GetAt(j); 3529 CFX_WideString* pStr = swSort.GetAt(j);
3533 3530
3534 v8::Local<v8::Object> pObj = 3531 v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj(
3535 JS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext, 3532 pRuntime->GetIsolate(), pContext,
3536 JS_GetObjDefnID(pRuntime->GetIsolate(), L"Field")); 3533 FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Field"));
3537 ASSERT(pObj.IsEmpty() == FALSE); 3534 ASSERT(pObj.IsEmpty() == FALSE);
3538 3535
3539 CJS_Field* pJSField = (CJS_Field*)JS_GetPrivate(pObj); 3536 CJS_Field* pJSField = (CJS_Field*)FXJS_GetPrivate(pObj);
3540 ASSERT(pJSField != NULL);
3541
3542 Field* pField = (Field*)pJSField->GetEmbedObject(); 3537 Field* pField = (Field*)pJSField->GetEmbedObject();
3543 ASSERT(pField != NULL);
3544
3545 pField->AttachField(m_pJSDoc, *pStr); 3538 pField->AttachField(m_pJSDoc, *pStr);
3546 3539
3547 CJS_Value FormFieldValue(m_isolate); 3540 CJS_Value FormFieldValue(m_isolate);
3548 FormFieldValue = pJSField; 3541 FormFieldValue = pJSField;
3549 FormFieldArray.SetElement(j, FormFieldValue); 3542 FormFieldArray.SetElement(j, FormFieldValue);
3550 3543
3551 delete pStr; 3544 delete pStr;
3552 } 3545 }
3553 3546
3554 vRet = FormFieldArray; 3547 vRet = FormFieldArray;
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
4057 #define JS_FIELD_MINWIDTH 1 4050 #define JS_FIELD_MINWIDTH 1
4058 #define JS_FIELD_MINHEIGHT 1 4051 #define JS_FIELD_MINHEIGHT 1
4059 4052
4060 void Field::AddField(CPDFSDK_Document* pDocument, 4053 void Field::AddField(CPDFSDK_Document* pDocument,
4061 int nPageIndex, 4054 int nPageIndex,
4062 int nFieldType, 4055 int nFieldType,
4063 const CFX_WideString& sName, 4056 const CFX_WideString& sName,
4064 const CPDF_Rect& rcCoords) { 4057 const CPDF_Rect& rcCoords) {
4065 // Not supported. 4058 // Not supported.
4066 } 4059 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/Document.cpp ('k') | fpdfsdk/src/javascript/JS_Context.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698