From d808dfd5ad8c4eae1f2ea58b9b54a7d4e45a649e Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 26 Oct 2017 15:04:17 -0400 Subject: Cleanup JS define methods This CL moves DefineProps, DefineMethods and DefineConsts to the CJS_Object and removes from the subclasses. The JSConstructor and JSDestructor are moved to be templated static methods in JS_Defines. Change-Id: Ibe5ee063a32ae2332b8affc843d97ee6da21f4ee Reviewed-on: https://pdfium-review.googlesource.com/16930 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- fpdfsdk/javascript/cjs_style.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'fpdfsdk/javascript/cjs_style.cpp') diff --git a/fpdfsdk/javascript/cjs_style.cpp b/fpdfsdk/javascript/cjs_style.cpp index 872851fb7c..57064133a5 100644 --- a/fpdfsdk/javascript/cjs_style.cpp +++ b/fpdfsdk/javascript/cjs_style.cpp @@ -18,18 +18,8 @@ JSConstSpec CJS_Style::ConstSpecs[] = { const char* CJS_Style::g_pClassName = "style"; int CJS_Style::g_nObjDefnID = -1; -void CJS_Style::DefineConsts(CFXJS_Engine* pEngine) { - for (size_t i = 0; i < FX_ArraySize(ConstSpecs) - 1; ++i) { - pEngine->DefineObjConst( - g_nObjDefnID, ConstSpecs[i].pName, - ConstSpecs[i].eType == JSConstSpec::Number - ? pEngine->NewNumber(ConstSpecs[i].number).As() - : pEngine->NewString(ConstSpecs[i].pStr).As()); - } -} - void CJS_Style::DefineJSObjects(CFXJS_Engine* pEngine, FXJSOBJTYPE eObjType) { g_nObjDefnID = pEngine->DefineObj(CJS_Style::g_pClassName, eObjType, nullptr, nullptr); - DefineConsts(pEngine); + DefineConsts(pEngine, g_nObjDefnID, ConstSpecs); } -- cgit v1.2.3