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

Unified Diff: fpdfsdk/javascript/Document.cpp

Issue 2154503002: Remove type info from CJS_Value, interrogate v8 instead (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: nit Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | fpdfsdk/javascript/JS_Define.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/javascript/Document.cpp
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index 258dddbe108a07c336a4583290f69ccbc36f7933..caaeba884e4f6ece8c53363df8e7b6d34925dde8 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -411,22 +411,20 @@ FX_BOOL Document::print(IJS_Context* cc,
int nlength = params.size();
if (nlength == 9) {
- if (params[8].GetType() == CJS_Value::VT_fxobject) {
+ if (params[8].GetType() == CJS_Value::VT_object) {
v8::Local<v8::Object> pObj = params[8].ToV8Object();
- {
- if (FXJS_GetObjDefnID(pObj) == CJS_PrintParamsObj::g_nObjDefnID) {
- if (CJS_Object* pJSObj = params[8].ToCJSObject()) {
- if (PrintParamsObj* pprintparamsObj =
- (PrintParamsObj*)pJSObj->GetEmbedObject()) {
- bUI = pprintparamsObj->bUI;
- nStart = pprintparamsObj->nStart;
- nEnd = pprintparamsObj->nEnd;
- bSilent = pprintparamsObj->bSilent;
- bShrinkToFit = pprintparamsObj->bShrinkToFit;
- bPrintAsImage = pprintparamsObj->bPrintAsImage;
- bReverse = pprintparamsObj->bReverse;
- bAnnotations = pprintparamsObj->bAnnotations;
- }
+ if (FXJS_GetObjDefnID(pObj) == CJS_PrintParamsObj::g_nObjDefnID) {
+ if (CJS_Object* pJSObj = params[8].ToCJSObject()) {
+ if (PrintParamsObj* pprintparamsObj =
+ static_cast<PrintParamsObj*>(pJSObj->GetEmbedObject())) {
+ bUI = pprintparamsObj->bUI;
+ nStart = pprintparamsObj->nStart;
+ nEnd = pprintparamsObj->nEnd;
+ bSilent = pprintparamsObj->bSilent;
+ bShrinkToFit = pprintparamsObj->bShrinkToFit;
+ bPrintAsImage = pprintparamsObj->bPrintAsImage;
+ bReverse = pprintparamsObj->bReverse;
+ bAnnotations = pprintparamsObj->bAnnotations;
}
}
}
@@ -592,18 +590,16 @@ FX_BOOL Document::submitForm(IJS_Context* cc,
v8::Local<v8::Object> pObj = params[0].ToV8Object();
v8::Local<v8::Value> pValue = FXJS_GetObjectElement(isolate, pObj, L"cURL");
if (!pValue.IsEmpty())
- strURL =
- CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString();
+ strURL = CJS_Value(pRuntime, pValue).ToCFXWideString();
pValue = FXJS_GetObjectElement(isolate, pObj, L"bFDF");
- bFDF = CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToBool();
+ bFDF = CJS_Value(pRuntime, pValue).ToBool();
pValue = FXJS_GetObjectElement(isolate, pObj, L"bEmpty");
- bEmpty = CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToBool();
+ bEmpty = CJS_Value(pRuntime, pValue).ToBool();
pValue = FXJS_GetObjectElement(isolate, pObj, L"aFields");
- aFields.Attach(
- CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToV8Array());
+ aFields.Attach(CJS_Value(pRuntime, pValue).ToV8Array());
}
CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm();
@@ -686,25 +682,22 @@ FX_BOOL Document::mailDoc(IJS_Context* cc,
v8::Local<v8::Object> pObj = params[0].ToV8Object();
v8::Local<v8::Value> pValue = FXJS_GetObjectElement(isolate, pObj, L"bUI");
- bUI = CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToInt();
+ bUI = CJS_Value(pRuntime, pValue).ToInt();
pValue = FXJS_GetObjectElement(isolate, pObj, L"cTo");
- cTo = CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString();
+ cTo = CJS_Value(pRuntime, pValue).ToCFXWideString();
pValue = FXJS_GetObjectElement(isolate, pObj, L"cCc");
- cCc = CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString();
+ cCc = CJS_Value(pRuntime, pValue).ToCFXWideString();
pValue = FXJS_GetObjectElement(isolate, pObj, L"cBcc");
- cBcc =
- CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString();
+ cBcc = CJS_Value(pRuntime, pValue).ToCFXWideString();
pValue = FXJS_GetObjectElement(isolate, pObj, L"cSubject");
- cSubject =
- CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString();
+ cSubject = CJS_Value(pRuntime, pValue).ToCFXWideString();
pValue = FXJS_GetObjectElement(isolate, pObj, L"cMsg");
- cMsg =
- CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString();
+ cMsg = CJS_Value(pRuntime, pValue).ToCFXWideString();
}
pRuntime->BeginBlock();
« no previous file with comments | « no previous file | fpdfsdk/javascript/JS_Define.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698