summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/javascript/Consts.cpp109
-rw-r--r--fpdfsdk/javascript/JS_Define.h2
-rw-r--r--fxjs/fxjs_v8.cpp5
-rw-r--r--fxjs/fxjs_v8.h2
4 files changed, 58 insertions, 60 deletions
diff --git a/fpdfsdk/javascript/Consts.cpp b/fpdfsdk/javascript/Consts.cpp
index a9fe01dadc..59bb9c6336 100644
--- a/fpdfsdk/javascript/Consts.cpp
+++ b/fpdfsdk/javascript/Consts.cpp
@@ -11,91 +11,90 @@
#include "fpdfsdk/javascript/JS_Value.h"
JSConstSpec CJS_Border::ConstSpecs[] = {
- {L"s", JSConstSpec::String, 0, L"solid"},
- {L"b", JSConstSpec::String, 0, L"beveled"},
- {L"d", JSConstSpec::String, 0, L"dashed"},
- {L"i", JSConstSpec::String, 0, L"inset"},
- {L"u", JSConstSpec::String, 0, L"underline"},
+ {"s", JSConstSpec::String, 0, L"solid"},
+ {"b", JSConstSpec::String, 0, L"beveled"},
+ {"d", JSConstSpec::String, 0, L"dashed"},
+ {"i", JSConstSpec::String, 0, L"inset"},
+ {"u", JSConstSpec::String, 0, L"underline"},
{0, JSConstSpec::Number, 0, 0}};
IMPLEMENT_JS_CLASS_CONST(CJS_Border, border)
-JSConstSpec CJS_Display::ConstSpecs[] = {
- {L"visible", JSConstSpec::Number, 0, 0},
- {L"hidden", JSConstSpec::Number, 1, 0},
- {L"noPrint", JSConstSpec::Number, 2, 0},
- {L"noView", JSConstSpec::Number, 3, 0},
- {0, JSConstSpec::Number, 0, 0}};
+JSConstSpec CJS_Display::ConstSpecs[] = {{"visible", JSConstSpec::Number, 0, 0},
+ {"hidden", JSConstSpec::Number, 1, 0},
+ {"noPrint", JSConstSpec::Number, 2, 0},
+ {"noView", JSConstSpec::Number, 3, 0},
+ {0, JSConstSpec::Number, 0, 0}};
IMPLEMENT_JS_CLASS_CONST(CJS_Display, display)
JSConstSpec CJS_Font::ConstSpecs[] = {
- {L"Times", JSConstSpec::String, 0, L"Times-Roman"},
- {L"TimesB", JSConstSpec::String, 0, L"Times-Bold"},
- {L"TimesI", JSConstSpec::String, 0, L"Times-Italic"},
- {L"TimesBI", JSConstSpec::String, 0, L"Times-BoldItalic"},
- {L"Helv", JSConstSpec::String, 0, L"Helvetica"},
- {L"HelvB", JSConstSpec::String, 0, L"Helvetica-Bold"},
- {L"HelvI", JSConstSpec::String, 0, L"Helvetica-Oblique"},
- {L"HelvBI", JSConstSpec::String, 0, L"Helvetica-BoldOblique"},
- {L"Cour", JSConstSpec::String, 0, L"Courier"},
- {L"CourB", JSConstSpec::String, 0, L"Courier-Bold"},
- {L"CourI", JSConstSpec::String, 0, L"Courier-Oblique"},
- {L"CourBI", JSConstSpec::String, 0, L"Courier-BoldOblique"},
- {L"Symbol", JSConstSpec::String, 0, L"Symbol"},
- {L"ZapfD", JSConstSpec::String, 0, L"ZapfDingbats"},
+ {"Times", JSConstSpec::String, 0, L"Times-Roman"},
+ {"TimesB", JSConstSpec::String, 0, L"Times-Bold"},
+ {"TimesI", JSConstSpec::String, 0, L"Times-Italic"},
+ {"TimesBI", JSConstSpec::String, 0, L"Times-BoldItalic"},
+ {"Helv", JSConstSpec::String, 0, L"Helvetica"},
+ {"HelvB", JSConstSpec::String, 0, L"Helvetica-Bold"},
+ {"HelvI", JSConstSpec::String, 0, L"Helvetica-Oblique"},
+ {"HelvBI", JSConstSpec::String, 0, L"Helvetica-BoldOblique"},
+ {"Cour", JSConstSpec::String, 0, L"Courier"},
+ {"CourB", JSConstSpec::String, 0, L"Courier-Bold"},
+ {"CourI", JSConstSpec::String, 0, L"Courier-Oblique"},
+ {"CourBI", JSConstSpec::String, 0, L"Courier-BoldOblique"},
+ {"Symbol", JSConstSpec::String, 0, L"Symbol"},
+ {"ZapfD", JSConstSpec::String, 0, L"ZapfDingbats"},
{0, JSConstSpec::Number, 0, 0}};
IMPLEMENT_JS_CLASS_CONST(CJS_Font, font)
JSConstSpec CJS_Highlight::ConstSpecs[] = {
- {L"n", JSConstSpec::String, 0, L"none"},
- {L"i", JSConstSpec::String, 0, L"invert"},
- {L"p", JSConstSpec::String, 0, L"push"},
- {L"o", JSConstSpec::String, 0, L"outline"},
+ {"n", JSConstSpec::String, 0, L"none"},
+ {"i", JSConstSpec::String, 0, L"invert"},
+ {"p", JSConstSpec::String, 0, L"push"},
+ {"o", JSConstSpec::String, 0, L"outline"},
{0, JSConstSpec::Number, 0, 0}};
IMPLEMENT_JS_CLASS_CONST(CJS_Highlight, highlight)
JSConstSpec CJS_Position::ConstSpecs[] = {
- {L"textOnly", JSConstSpec::Number, 0, 0},
- {L"iconOnly", JSConstSpec::Number, 1, 0},
- {L"iconTextV", JSConstSpec::Number, 2, 0},
- {L"textIconV", JSConstSpec::Number, 3, 0},
- {L"iconTextH", JSConstSpec::Number, 4, 0},
- {L"textIconH", JSConstSpec::Number, 5, 0},
- {L"overlay", JSConstSpec::Number, 6, 0},
+ {"textOnly", JSConstSpec::Number, 0, 0},
+ {"iconOnly", JSConstSpec::Number, 1, 0},
+ {"iconTextV", JSConstSpec::Number, 2, 0},
+ {"textIconV", JSConstSpec::Number, 3, 0},
+ {"iconTextH", JSConstSpec::Number, 4, 0},
+ {"textIconH", JSConstSpec::Number, 5, 0},
+ {"overlay", JSConstSpec::Number, 6, 0},
{0, JSConstSpec::Number, 0, 0}};
IMPLEMENT_JS_CLASS_CONST(CJS_Position, position)
JSConstSpec CJS_ScaleHow::ConstSpecs[] = {
- {L"proportional", JSConstSpec::Number, 0, 0},
- {L"anamorphic", JSConstSpec::Number, 1, 0},
+ {"proportional", JSConstSpec::Number, 0, 0},
+ {"anamorphic", JSConstSpec::Number, 1, 0},
{0, JSConstSpec::Number, 0, 0}};
IMPLEMENT_JS_CLASS_CONST(CJS_ScaleHow, scaleHow)
JSConstSpec CJS_ScaleWhen::ConstSpecs[] = {
- {L"always", JSConstSpec::Number, 0, 0},
- {L"never", JSConstSpec::Number, 1, 0},
- {L"tooBig", JSConstSpec::Number, 2, 0},
- {L"tooSmall", JSConstSpec::Number, 3, 0},
+ {"always", JSConstSpec::Number, 0, 0},
+ {"never", JSConstSpec::Number, 1, 0},
+ {"tooBig", JSConstSpec::Number, 2, 0},
+ {"tooSmall", JSConstSpec::Number, 3, 0},
{0, JSConstSpec::Number, 0, 0}};
IMPLEMENT_JS_CLASS_CONST(CJS_ScaleWhen, scaleWhen)
JSConstSpec CJS_Style::ConstSpecs[] = {
- {L"ch", JSConstSpec::String, 0, L"check"},
- {L"cr", JSConstSpec::String, 0, L"cross"},
- {L"di", JSConstSpec::String, 0, L"diamond"},
- {L"ci", JSConstSpec::String, 0, L"circle"},
- {L"st", JSConstSpec::String, 0, L"star"},
- {L"sq", JSConstSpec::String, 0, L"square"},
+ {"ch", JSConstSpec::String, 0, L"check"},
+ {"cr", JSConstSpec::String, 0, L"cross"},
+ {"di", JSConstSpec::String, 0, L"diamond"},
+ {"ci", JSConstSpec::String, 0, L"circle"},
+ {"st", JSConstSpec::String, 0, L"star"},
+ {"sq", JSConstSpec::String, 0, L"square"},
{0, JSConstSpec::Number, 0, 0}};
IMPLEMENT_JS_CLASS_CONST(CJS_Style, style)
JSConstSpec CJS_Zoomtype::ConstSpecs[] = {
- {L"none", JSConstSpec::String, 0, L"NoVary"},
- {L"fitP", JSConstSpec::String, 0, L"FitPage"},
- {L"fitW", JSConstSpec::String, 0, L"FitWidth"},
- {L"fitH", JSConstSpec::String, 0, L"FitHeight"},
- {L"fitV", JSConstSpec::String, 0, L"FitVisibleWidth"},
- {L"pref", JSConstSpec::String, 0, L"Preferred"},
- {L"refW", JSConstSpec::String, 0, L"ReflowWidth"},
+ {"none", JSConstSpec::String, 0, L"NoVary"},
+ {"fitP", JSConstSpec::String, 0, L"FitPage"},
+ {"fitW", JSConstSpec::String, 0, L"FitWidth"},
+ {"fitH", JSConstSpec::String, 0, L"FitHeight"},
+ {"fitV", JSConstSpec::String, 0, L"FitVisibleWidth"},
+ {"pref", JSConstSpec::String, 0, L"Preferred"},
+ {"refW", JSConstSpec::String, 0, L"ReflowWidth"},
{0, JSConstSpec::Number, 0, 0}};
IMPLEMENT_JS_CLASS_CONST(CJS_Zoomtype, zoomtype)
diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h
index 0875cc9fc6..0bd3a5e722 100644
--- a/fpdfsdk/javascript/JS_Define.h
+++ b/fpdfsdk/javascript/JS_Define.h
@@ -17,7 +17,7 @@
struct JSConstSpec {
enum Type { Number = 0, String = 1 };
- const wchar_t* pName;
+ const char* pName;
Type eType;
double number;
const wchar_t* pStr;
diff --git a/fxjs/fxjs_v8.cpp b/fxjs/fxjs_v8.cpp
index f876f8c53f..1f049a0dd3 100644
--- a/fxjs/fxjs_v8.cpp
+++ b/fxjs/fxjs_v8.cpp
@@ -315,14 +315,13 @@ void CFXJS_Engine::DefineObjAllProperties(
}
void CFXJS_Engine::DefineObjConst(int nObjDefnID,
- const wchar_t* sConstName,
+ const char* sConstName,
v8::Local<v8::Value> pDefault) {
v8::Isolate::Scope isolate_scope(m_isolate);
v8::HandleScope handle_scope(m_isolate);
- CFX_ByteString bsConstName = FX_UTF8Encode(CFX_WideStringC(sConstName));
CFXJS_ObjDefinition* pObjDef =
CFXJS_ObjDefinition::ForID(m_isolate, nObjDefnID);
- pObjDef->GetInstanceTemplate()->Set(m_isolate, bsConstName.c_str(), pDefault);
+ pObjDef->GetInstanceTemplate()->Set(m_isolate, sConstName, pDefault);
}
void CFXJS_Engine::DefineGlobalMethod(const char* sMethodName,
diff --git a/fxjs/fxjs_v8.h b/fxjs/fxjs_v8.h
index 34e299b4e2..8283184e47 100644
--- a/fxjs/fxjs_v8.h
+++ b/fxjs/fxjs_v8.h
@@ -160,7 +160,7 @@ class CFXJS_Engine {
v8::NamedPropertySetterCallback pPropPut,
v8::NamedPropertyDeleterCallback pPropDel);
void DefineObjConst(int nObjDefnID,
- const wchar_t* sConstName,
+ const char* sConstName,
v8::Local<v8::Value> pDefault);
void DefineGlobalMethod(const char* sMethodName,
v8::FunctionCallback pMethodCall);