diff options
author | tsepez <tsepez@chromium.org> | 2016-07-15 17:58:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-15 17:58:02 -0700 |
commit | 40faa79da0bc902d7f1f5cc43464b94e6dfa5d22 (patch) | |
tree | 3e6ef034906a3cb46eb833b3e2309b34f7549c1d /fpdfsdk/javascript/Document.cpp | |
parent | 514e8c914c0e6c2c69167d03786a83b1ebd15d70 (diff) | |
download | pdfium-40faa79da0bc902d7f1f5cc43464b94e6dfa5d22.tar.xz |
Remove type info from CJS_Value, interrogate v8 instead
Review-Url: https://codereview.chromium.org/2154503002
Diffstat (limited to 'fpdfsdk/javascript/Document.cpp')
-rw-r--r-- | fpdfsdk/javascript/Document.cpp | 53 |
1 files changed, 23 insertions, 30 deletions
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index 258dddbe10..caaeba884e 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(); |