diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-10-06 11:45:28 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-10-06 11:45:28 -0700 |
commit | cd56a7d6fb05bd0babf316a84280a26ecc649d45 (patch) | |
tree | 65a4ff0aa976f364e46d1ec69ebbe34ddbc99e90 /fpdfsdk/src/javascript/Document.cpp | |
parent | 3745841a4c4ab915c98865c1dd71f9debc3e2f99 (diff) | |
download | pdfium-cd56a7d6fb05bd0babf316a84280a26ecc649d45.tar.xz |
Merge to XFA: Store object definition ID in each js_class.
Manual edits in JS_Define.h.
(cherry picked from commit f0a5b2803c09f3605dcd606e764ef604f0d2a8ea)
Original Review URL: https://codereview.chromium.org/1382263002 .
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1382683008 .
Diffstat (limited to 'fpdfsdk/src/javascript/Document.cpp')
-rw-r--r-- | fpdfsdk/src/javascript/Document.cpp | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp index 9a569af859..fe417ce1fc 100644 --- a/fpdfsdk/src/javascript/Document.cpp +++ b/fpdfsdk/src/javascript/Document.cpp @@ -325,9 +325,8 @@ FX_BOOL Document::getField(IFXJS_Context* cc, } CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - v8::Local<v8::Object> pFieldObj = - FXJS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext, - FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Field")); + v8::Local<v8::Object> pFieldObj = FXJS_NewFxDynamicObj( + pRuntime->GetIsolate(), pContext, CJS_Field::g_nObjDefnID); v8::Isolate* isolate = GetIsolate(cc); CJS_Field* pJSField = (CJS_Field*)FXJS_GetPrivate(isolate, pFieldObj); @@ -441,11 +440,6 @@ FX_BOOL Document::print(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) { - CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); - CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - ASSERT(pRuntime != NULL); - FX_BOOL bUI = TRUE; int nStart = 0; int nEnd = 0; @@ -460,8 +454,7 @@ FX_BOOL Document::print(IFXJS_Context* cc, if (params[8].GetType() == CJS_Value::VT_fxobject) { v8::Local<v8::Object> pObj = params[8].ToV8Object(); { - if (FXJS_GetObjDefnID(pObj) == - FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"PrintParamsObj")) { + if (FXJS_GetObjDefnID(pObj) == CJS_PrintParamsObj::g_nObjDefnID) { if (CJS_Object* pJSObj = params[8].ToCJSObject()) { if (PrintParamsObj* pprintparamsObj = (PrintParamsObj*)pJSObj->GetEmbedObject()) { @@ -1410,11 +1403,9 @@ FX_BOOL Document::addIcon(IFXJS_Context* cc, sError = JSGetStringFromID(pContext, IDS_STRING_JSTYPEERROR); return FALSE; } - v8::Local<v8::Object> pJSIcon = params[1].ToV8Object(); - CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - if (FXJS_GetObjDefnID(pJSIcon) != - FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Icon")) { + v8::Local<v8::Object> pJSIcon = params[1].ToV8Object(); + if (FXJS_GetObjDefnID(pJSIcon) != CJS_Icon::g_nObjDefnID) { sError = JSGetStringFromID(pContext, IDS_STRING_JSTYPEERROR); return FALSE; } @@ -1462,8 +1453,7 @@ FX_BOOL Document::icons(IFXJS_Context* cc, pIconElement = (*m_pIconTree)[i]; v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj( - pRuntime->GetIsolate(), pContext, - FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Icon")); + pRuntime->GetIsolate(), pContext, CJS_Icon::g_nObjDefnID); if (pObj.IsEmpty()) return FALSE; @@ -1506,8 +1496,7 @@ FX_BOOL Document::getIcon(IFXJS_Context* cc, Icon* pRetIcon = (*m_pIconTree)[i]->IconStream; v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj( - pRuntime->GetIsolate(), pContext, - FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Icon")); + pRuntime->GetIsolate(), pContext, CJS_Icon::g_nObjDefnID); if (pObj.IsEmpty()) return FALSE; @@ -1708,8 +1697,7 @@ FX_BOOL Document::getPrintParams(IFXJS_Context* cc, CJS_Context* pContext = (CJS_Context*)cc; CJS_Runtime* pRuntime = pContext->GetJSRuntime(); v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj( - pRuntime->GetIsolate(), pContext, - FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"PrintParamsObj")); + pRuntime->GetIsolate(), pContext, CJS_PrintParamsObj::g_nObjDefnID); // Not implemented yet. |