summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-10-25 20:21:09 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-26 16:58:57 +0000
commit993a19931a6ad343310b7d5d076d9e45af0ed528 (patch)
treeb4276bbef82f1d129be10a8d54dd104ed483429c
parent352e251c6af1f2a3c2eca24468f98eae30099185 (diff)
downloadpdfium-993a19931a6ad343310b7d5d076d9e45af0ed528.tar.xz
Split Consts into individual files
This CL splits the individual CJS classes out of the Consts.{cpp|h} files into their own files. Change-Id: I4497ee2dcb46205c1dc3f521d44a9046a8d7f067 Reviewed-on: https://pdfium-review.googlesource.com/16850 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r--BUILD.gn24
-rw-r--r--fpdfsdk/javascript/Consts.cpp214
-rw-r--r--fpdfsdk/javascript/Consts.h103
-rw-r--r--fpdfsdk/javascript/JS_Define.h10
-rw-r--r--fpdfsdk/javascript/cjs_border.cpp17
-rw-r--r--fpdfsdk/javascript/cjs_border.h21
-rw-r--r--fpdfsdk/javascript/cjs_display.cpp15
-rw-r--r--fpdfsdk/javascript/cjs_display.h21
-rw-r--r--fpdfsdk/javascript/cjs_font.cpp26
-rw-r--r--fpdfsdk/javascript/cjs_font.h21
-rw-r--r--fpdfsdk/javascript/cjs_globalarrays.cpp73
-rw-r--r--fpdfsdk/javascript/cjs_globalarrays.h17
-rw-r--r--fpdfsdk/javascript/cjs_globalconsts.cpp46
-rw-r--r--fpdfsdk/javascript/cjs_globalconsts.h17
-rw-r--r--fpdfsdk/javascript/cjs_highlight.cpp16
-rw-r--r--fpdfsdk/javascript/cjs_highlight.h21
-rw-r--r--fpdfsdk/javascript/cjs_position.cpp19
-rw-r--r--fpdfsdk/javascript/cjs_position.h21
-rw-r--r--fpdfsdk/javascript/cjs_runtime.cpp12
-rw-r--r--fpdfsdk/javascript/cjs_scalehow.cpp14
-rw-r--r--fpdfsdk/javascript/cjs_scalehow.h21
-rw-r--r--fpdfsdk/javascript/cjs_scalewhen.cpp16
-rw-r--r--fpdfsdk/javascript/cjs_scalewhen.h21
-rw-r--r--fpdfsdk/javascript/cjs_style.cpp18
-rw-r--r--fpdfsdk/javascript/cjs_style.h21
-rw-r--r--fpdfsdk/javascript/cjs_zoomtype.cpp19
-rw-r--r--fpdfsdk/javascript/cjs_zoomtype.h21
27 files changed, 545 insertions, 320 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 8807e8a061..eb9ed7566e 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1190,8 +1190,6 @@ static_library("javascript") {
sources += [
"fpdfsdk/javascript/Annot.cpp",
"fpdfsdk/javascript/Annot.h",
- "fpdfsdk/javascript/Consts.cpp",
- "fpdfsdk/javascript/Consts.h",
"fpdfsdk/javascript/Document.cpp",
"fpdfsdk/javascript/Document.h",
"fpdfsdk/javascript/Field.cpp",
@@ -1213,10 +1211,32 @@ static_library("javascript") {
"fpdfsdk/javascript/PublicMethods.h",
"fpdfsdk/javascript/app.cpp",
"fpdfsdk/javascript/app.h",
+ "fpdfsdk/javascript/cjs_border.cpp",
+ "fpdfsdk/javascript/cjs_border.h",
+ "fpdfsdk/javascript/cjs_display.cpp",
+ "fpdfsdk/javascript/cjs_display.h",
"fpdfsdk/javascript/cjs_event_context.cpp",
"fpdfsdk/javascript/cjs_event_context.h",
+ "fpdfsdk/javascript/cjs_font.cpp",
+ "fpdfsdk/javascript/cjs_font.h",
+ "fpdfsdk/javascript/cjs_globalarrays.cpp",
+ "fpdfsdk/javascript/cjs_globalarrays.h",
+ "fpdfsdk/javascript/cjs_globalconsts.cpp",
+ "fpdfsdk/javascript/cjs_globalconsts.h",
+ "fpdfsdk/javascript/cjs_highlight.cpp",
+ "fpdfsdk/javascript/cjs_highlight.h",
+ "fpdfsdk/javascript/cjs_position.cpp",
+ "fpdfsdk/javascript/cjs_position.h",
"fpdfsdk/javascript/cjs_runtime.cpp",
"fpdfsdk/javascript/cjs_runtime.h",
+ "fpdfsdk/javascript/cjs_scalehow.cpp",
+ "fpdfsdk/javascript/cjs_scalehow.h",
+ "fpdfsdk/javascript/cjs_scalewhen.cpp",
+ "fpdfsdk/javascript/cjs_scalewhen.h",
+ "fpdfsdk/javascript/cjs_style.cpp",
+ "fpdfsdk/javascript/cjs_style.h",
+ "fpdfsdk/javascript/cjs_zoomtype.cpp",
+ "fpdfsdk/javascript/cjs_zoomtype.h",
"fpdfsdk/javascript/color.cpp",
"fpdfsdk/javascript/color.h",
"fpdfsdk/javascript/console.cpp",
diff --git a/fpdfsdk/javascript/Consts.cpp b/fpdfsdk/javascript/Consts.cpp
deleted file mode 100644
index 4dfd5c8ce1..0000000000
--- a/fpdfsdk/javascript/Consts.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "fpdfsdk/javascript/Consts.h"
-
-#include "fpdfsdk/javascript/JS_Define.h"
-#include "fpdfsdk/javascript/JS_Object.h"
-#include "fpdfsdk/javascript/JS_Value.h"
-
-#define IMPLEMENT_JS_CLASS_CONST(js_class_name, class_name) \
- IMPLEMENT_JS_CLASS_BASE_PART(js_class_name, class_name) \
- IMPLEMENT_JS_CLASS_CONST_PART(js_class_name, class_name) \
- void js_class_name::DefineJSObjects(CFXJS_Engine* pEngine, \
- FXJSOBJTYPE eObjType) { \
- g_nObjDefnID = pEngine->DefineObj(js_class_name::g_pClassName, eObjType, \
- nullptr, nullptr); \
- DefineConsts(pEngine); \
- }
-
-JSConstSpec CJS_Border::ConstSpecs[] = {
- {"s", JSConstSpec::String, 0, "solid"},
- {"b", JSConstSpec::String, 0, "beveled"},
- {"d", JSConstSpec::String, 0, "dashed"},
- {"i", JSConstSpec::String, 0, "inset"},
- {"u", JSConstSpec::String, 0, "underline"},
- {0, JSConstSpec::Number, 0, 0}};
-IMPLEMENT_JS_CLASS_CONST(CJS_Border, border)
-
-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[] = {
- {"Times", JSConstSpec::String, 0, "Times-Roman"},
- {"TimesB", JSConstSpec::String, 0, "Times-Bold"},
- {"TimesI", JSConstSpec::String, 0, "Times-Italic"},
- {"TimesBI", JSConstSpec::String, 0, "Times-BoldItalic"},
- {"Helv", JSConstSpec::String, 0, "Helvetica"},
- {"HelvB", JSConstSpec::String, 0, "Helvetica-Bold"},
- {"HelvI", JSConstSpec::String, 0, "Helvetica-Oblique"},
- {"HelvBI", JSConstSpec::String, 0, "Helvetica-BoldOblique"},
- {"Cour", JSConstSpec::String, 0, "Courier"},
- {"CourB", JSConstSpec::String, 0, "Courier-Bold"},
- {"CourI", JSConstSpec::String, 0, "Courier-Oblique"},
- {"CourBI", JSConstSpec::String, 0, "Courier-BoldOblique"},
- {"Symbol", JSConstSpec::String, 0, "Symbol"},
- {"ZapfD", JSConstSpec::String, 0, "ZapfDingbats"},
- {0, JSConstSpec::Number, 0, 0}};
-IMPLEMENT_JS_CLASS_CONST(CJS_Font, font)
-
-JSConstSpec CJS_Highlight::ConstSpecs[] = {
- {"n", JSConstSpec::String, 0, "none"},
- {"i", JSConstSpec::String, 0, "invert"},
- {"p", JSConstSpec::String, 0, "push"},
- {"o", JSConstSpec::String, 0, "outline"},
- {0, JSConstSpec::Number, 0, 0}};
-IMPLEMENT_JS_CLASS_CONST(CJS_Highlight, highlight)
-
-JSConstSpec CJS_Position::ConstSpecs[] = {
- {"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[] = {
- {"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[] = {
- {"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[] = {
- {"ch", JSConstSpec::String, 0, "check"},
- {"cr", JSConstSpec::String, 0, "cross"},
- {"di", JSConstSpec::String, 0, "diamond"},
- {"ci", JSConstSpec::String, 0, "circle"},
- {"st", JSConstSpec::String, 0, "star"},
- {"sq", JSConstSpec::String, 0, "square"},
- {0, JSConstSpec::Number, 0, 0}};
-IMPLEMENT_JS_CLASS_CONST(CJS_Style, style)
-
-JSConstSpec CJS_Zoomtype::ConstSpecs[] = {
- {"none", JSConstSpec::String, 0, "NoVary"},
- {"fitP", JSConstSpec::String, 0, "FitPage"},
- {"fitW", JSConstSpec::String, 0, "FitWidth"},
- {"fitH", JSConstSpec::String, 0, "FitHeight"},
- {"fitV", JSConstSpec::String, 0, "FitVisibleWidth"},
- {"pref", JSConstSpec::String, 0, "Preferred"},
- {"refW", JSConstSpec::String, 0, "ReflowWidth"},
- {0, JSConstSpec::Number, 0, 0}};
-IMPLEMENT_JS_CLASS_CONST(CJS_Zoomtype, zoomtype)
-
-#define GLOBAL_STRING(rt, name, value) \
- (rt)->DefineGlobalConst( \
- (name), [](const v8::FunctionCallbackInfo<v8::Value>& info) { \
- info.GetReturnValue().Set( \
- CFXJS_Engine::CurrentEngineFromIsolate(info.GetIsolate()) \
- ->NewString(value)); \
- })
-
-void CJS_GlobalConsts::DefineJSObjects(CJS_Runtime* pRuntime) {
- GLOBAL_STRING(pRuntime, L"IDS_GREATER_THAN",
- L"Invalid value: must be greater than or equal to % s.");
-
- GLOBAL_STRING(pRuntime, L"IDS_GT_AND_LT",
- L"Invalid value: must be greater than or equal to % s "
- L"and less than or equal to % s.");
-
- GLOBAL_STRING(pRuntime, L"IDS_LESS_THAN",
- L"Invalid value: must be less than or equal to % s.");
-
- GLOBAL_STRING(pRuntime, L"IDS_INVALID_MONTH", L"**Invalid**");
- GLOBAL_STRING(
- pRuntime, L"IDS_INVALID_DATE",
- L"Invalid date / time: please ensure that the date / time exists.Field");
-
- GLOBAL_STRING(pRuntime, L"IDS_INVALID_VALUE",
- L"The value entered does not match the format of the field");
-
- GLOBAL_STRING(pRuntime, L"IDS_AM", L"am");
- GLOBAL_STRING(pRuntime, L"IDS_PM", L"pm");
- GLOBAL_STRING(pRuntime, L"IDS_MONTH_INFO",
- L"January[1] February[2] March[3] April[4] May[5] "
- L"June[6] July[7] August[8] September[9] October[10] "
- L"November[11] December[12] Sept[9] Jan[1] Feb[2] Mar[3] "
- L"Apr[4] Jun[6] Jul[7] Aug[8] Sep[9] Oct[10] Nov[11] "
- L"Dec[12]");
-
- GLOBAL_STRING(pRuntime, L"IDS_STARTUP_CONSOLE_MSG", L"** ^ _ ^ **");
-}
-
-#define GLOBAL_ARRAY(rt, name, ...) \
- { \
- const wchar_t* values[] = {__VA_ARGS__}; \
- v8::Local<v8::Array> array = (rt)->NewArray(); \
- for (size_t i = 0; i < FX_ArraySize(values); ++i) \
- array->Set(i, (rt)->NewString(values[i])); \
- (rt)->SetConstArray((name), array); \
- (rt)->DefineGlobalConst( \
- (name), [](const v8::FunctionCallbackInfo<v8::Value>& info) { \
- CJS_Runtime* pCurrentRuntime = \
- CJS_Runtime::CurrentRuntimeFromIsolate(info.GetIsolate()); \
- if (pCurrentRuntime) \
- info.GetReturnValue().Set(pCurrentRuntime->GetConstArray(name)); \
- }); \
- }
-
-void CJS_GlobalArrays::DefineJSObjects(CJS_Runtime* pRuntime) {
- GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_ENTRY_DOT_SEP", L"[+-]?\\d*\\.?\\d*");
- GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_COMMIT_DOT_SEP",
- L"[+-]?\\d+(\\.\\d+)?", // -1.0 or -1
- L"[+-]?\\.\\d+", // -.1
- L"[+-]?\\d+\\."); // -1.
-
- GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_ENTRY_COMMA_SEP", L"[+-]?\\d*,?\\d*");
- GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_COMMIT_COMMA_SEP",
- L"[+-]?\\d+([.,]\\d+)?", // -1,0 or -1
- L"[+-]?[.,]\\d+", // -,1
- L"[+-]?\\d+[.,]"); // -1,
-
- GLOBAL_ARRAY(pRuntime, L"RE_ZIP_ENTRY", L"\\d{0,5}");
- GLOBAL_ARRAY(pRuntime, L"RE_ZIP_COMMIT", L"\\d{5}");
- GLOBAL_ARRAY(pRuntime, L"RE_ZIP4_ENTRY", L"\\d{0,5}(\\.|[- ])?\\d{0,4}");
- GLOBAL_ARRAY(pRuntime, L"RE_ZIP4_COMMIT", L"\\d{5}(\\.|[- ])?\\d{4}");
- GLOBAL_ARRAY(pRuntime, L"RE_PHONE_ENTRY",
- // 555-1234 or 408 555-1234
- L"\\d{0,3}(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}",
-
- // (408
- L"\\(\\d{0,3}",
-
- // (408) 555-1234
- // (allow the addition of parens as an afterthought)
- L"\\(\\d{0,3}\\)(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}",
-
- // (408 555-1234
- L"\\(\\d{0,3}(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}",
-
- // 408) 555-1234
- L"\\d{0,3}\\)(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}",
-
- // international
- L"011(\\.|[- \\d])*");
-
- GLOBAL_ARRAY(
- pRuntime, L"RE_PHONE_COMMIT", L"\\d{3}(\\.|[- ])?\\d{4}", // 555-1234
- L"\\d{3}(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", // 408 555-1234
- L"\\(\\d{3}\\)(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", // (408) 555-1234
- L"011(\\.|[- \\d])*"); // international
-
- GLOBAL_ARRAY(pRuntime, L"RE_SSN_ENTRY",
- L"\\d{0,3}(\\.|[- ])?\\d{0,2}(\\.|[- ])?\\d{0,4}");
-
- GLOBAL_ARRAY(pRuntime, L"RE_SSN_COMMIT",
- L"\\d{3}(\\.|[- ])?\\d{2}(\\.|[- ])?\\d{4}");
-}
diff --git a/fpdfsdk/javascript/Consts.h b/fpdfsdk/javascript/Consts.h
deleted file mode 100644
index 3b292c2d7a..0000000000
--- a/fpdfsdk/javascript/Consts.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FPDFSDK_JAVASCRIPT_CONSTS_H_
-#define FPDFSDK_JAVASCRIPT_CONSTS_H_
-
-#include "fpdfsdk/javascript/JS_Define.h"
-
-class CJS_Border : public CJS_Object {
- public:
- explicit CJS_Border(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
- ~CJS_Border() override {}
-
- DECLARE_JS_CLASS_BASE_PART();
- DECLARE_JS_CLASS_CONST_PART();
-};
-
-class CJS_Display : public CJS_Object {
- public:
- explicit CJS_Display(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
- ~CJS_Display() override {}
-
- DECLARE_JS_CLASS_BASE_PART();
- DECLARE_JS_CLASS_CONST_PART();
-};
-
-class CJS_Font : public CJS_Object {
- public:
- explicit CJS_Font(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
- ~CJS_Font() override {}
-
- DECLARE_JS_CLASS_BASE_PART();
- DECLARE_JS_CLASS_CONST_PART();
-};
-
-class CJS_Highlight : public CJS_Object {
- public:
- explicit CJS_Highlight(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
- ~CJS_Highlight() override {}
-
- DECLARE_JS_CLASS_BASE_PART();
- DECLARE_JS_CLASS_CONST_PART();
-};
-
-class CJS_Position : public CJS_Object {
- public:
- explicit CJS_Position(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
- ~CJS_Position() override {}
-
- DECLARE_JS_CLASS_BASE_PART();
- DECLARE_JS_CLASS_CONST_PART();
-};
-
-class CJS_ScaleHow : public CJS_Object {
- public:
- explicit CJS_ScaleHow(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
- ~CJS_ScaleHow() override {}
-
- DECLARE_JS_CLASS_BASE_PART();
- DECLARE_JS_CLASS_CONST_PART();
-};
-
-class CJS_ScaleWhen : public CJS_Object {
- public:
- explicit CJS_ScaleWhen(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
- ~CJS_ScaleWhen() override {}
-
- DECLARE_JS_CLASS_BASE_PART();
- DECLARE_JS_CLASS_CONST_PART();
-};
-
-class CJS_Style : public CJS_Object {
- public:
- explicit CJS_Style(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
- ~CJS_Style() override {}
-
- DECLARE_JS_CLASS_BASE_PART();
- DECLARE_JS_CLASS_CONST_PART();
-};
-
-class CJS_Zoomtype : public CJS_Object {
- public:
- explicit CJS_Zoomtype(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
- ~CJS_Zoomtype() override {}
-
- DECLARE_JS_CLASS_BASE_PART();
- DECLARE_JS_CLASS_CONST_PART();
-};
-
-class CJS_GlobalConsts : public CJS_Object {
- public:
- static void DefineJSObjects(CJS_Runtime* pRuntime);
-};
-
-class CJS_GlobalArrays : public CJS_Object {
- public:
- static void DefineJSObjects(CJS_Runtime* pRuntmie);
-};
-
-#endif // FPDFSDK_JAVASCRIPT_CONSTS_H_
diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h
index b5afc95e51..22ce7cbacc 100644
--- a/fpdfsdk/javascript/JS_Define.h
+++ b/fpdfsdk/javascript/JS_Define.h
@@ -165,6 +165,16 @@ void JSMethod(const char* method_name_string,
} \
}
+#define IMPLEMENT_JS_CLASS_CONST(js_class_name, class_name) \
+ IMPLEMENT_JS_CLASS_BASE_PART(js_class_name, class_name) \
+ IMPLEMENT_JS_CLASS_CONST_PART(js_class_name, class_name) \
+ void js_class_name::DefineJSObjects(CFXJS_Engine* pEngine, \
+ FXJSOBJTYPE eObjType) { \
+ g_nObjDefnID = pEngine->DefineObj(js_class_name::g_pClassName, eObjType, \
+ nullptr, nullptr); \
+ DefineConsts(pEngine); \
+ }
+
// Rich JS classes provide constants, methods, properties, and the ability
// to construct native object state.
#define DECLARE_JS_CLASS() \
diff --git a/fpdfsdk/javascript/cjs_border.cpp b/fpdfsdk/javascript/cjs_border.cpp
new file mode 100644
index 0000000000..2a310ac905
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_border.cpp
@@ -0,0 +1,17 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fpdfsdk/javascript/cjs_border.h"
+
+JSConstSpec CJS_Border::ConstSpecs[] = {
+ {"s", JSConstSpec::String, 0, "solid"},
+ {"b", JSConstSpec::String, 0, "beveled"},
+ {"d", JSConstSpec::String, 0, "dashed"},
+ {"i", JSConstSpec::String, 0, "inset"},
+ {"u", JSConstSpec::String, 0, "underline"},
+ {0, JSConstSpec::Number, 0, 0}};
+
+IMPLEMENT_JS_CLASS_CONST(CJS_Border, border)
diff --git a/fpdfsdk/javascript/cjs_border.h b/fpdfsdk/javascript/cjs_border.h
new file mode 100644
index 0000000000..6dd362ae01
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_border.h
@@ -0,0 +1,21 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_JAVASCRIPT_CJS_BORDER_H_
+#define FPDFSDK_JAVASCRIPT_CJS_BORDER_H_
+
+#include "fpdfsdk/javascript/JS_Define.h"
+
+class CJS_Border : public CJS_Object {
+ public:
+ explicit CJS_Border(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
+ ~CJS_Border() override {}
+
+ DECLARE_JS_CLASS_BASE_PART();
+ DECLARE_JS_CLASS_CONST_PART();
+};
+
+#endif // FPDFSDK_JAVASCRIPT_CJS_BORDER_H_
diff --git a/fpdfsdk/javascript/cjs_display.cpp b/fpdfsdk/javascript/cjs_display.cpp
new file mode 100644
index 0000000000..4b6000f568
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_display.cpp
@@ -0,0 +1,15 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fpdfsdk/javascript/cjs_display.h"
+
+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)
diff --git a/fpdfsdk/javascript/cjs_display.h b/fpdfsdk/javascript/cjs_display.h
new file mode 100644
index 0000000000..9965170229
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_display.h
@@ -0,0 +1,21 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_JAVASCRIPT_CJS_DISPLAY_H_
+#define FPDFSDK_JAVASCRIPT_CJS_DISPLAY_H_
+
+#include "fpdfsdk/javascript/JS_Define.h"
+
+class CJS_Display : public CJS_Object {
+ public:
+ explicit CJS_Display(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
+ ~CJS_Display() override {}
+
+ DECLARE_JS_CLASS_BASE_PART();
+ DECLARE_JS_CLASS_CONST_PART();
+};
+
+#endif // FPDFSDK_JAVASCRIPT_CJS_DISPLAY_H_
diff --git a/fpdfsdk/javascript/cjs_font.cpp b/fpdfsdk/javascript/cjs_font.cpp
new file mode 100644
index 0000000000..cd7047df29
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_font.cpp
@@ -0,0 +1,26 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fpdfsdk/javascript/cjs_font.h"
+
+JSConstSpec CJS_Font::ConstSpecs[] = {
+ {"Times", JSConstSpec::String, 0, "Times-Roman"},
+ {"TimesB", JSConstSpec::String, 0, "Times-Bold"},
+ {"TimesI", JSConstSpec::String, 0, "Times-Italic"},
+ {"TimesBI", JSConstSpec::String, 0, "Times-BoldItalic"},
+ {"Helv", JSConstSpec::String, 0, "Helvetica"},
+ {"HelvB", JSConstSpec::String, 0, "Helvetica-Bold"},
+ {"HelvI", JSConstSpec::String, 0, "Helvetica-Oblique"},
+ {"HelvBI", JSConstSpec::String, 0, "Helvetica-BoldOblique"},
+ {"Cour", JSConstSpec::String, 0, "Courier"},
+ {"CourB", JSConstSpec::String, 0, "Courier-Bold"},
+ {"CourI", JSConstSpec::String, 0, "Courier-Oblique"},
+ {"CourBI", JSConstSpec::String, 0, "Courier-BoldOblique"},
+ {"Symbol", JSConstSpec::String, 0, "Symbol"},
+ {"ZapfD", JSConstSpec::String, 0, "ZapfDingbats"},
+ {0, JSConstSpec::Number, 0, 0}};
+
+IMPLEMENT_JS_CLASS_CONST(CJS_Font, font)
diff --git a/fpdfsdk/javascript/cjs_font.h b/fpdfsdk/javascript/cjs_font.h
new file mode 100644
index 0000000000..05cca730c0
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_font.h
@@ -0,0 +1,21 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_JAVASCRIPT_CJS_FONT_H_
+#define FPDFSDK_JAVASCRIPT_CJS_FONT_H_
+
+#include "fpdfsdk/javascript/JS_Define.h"
+
+class CJS_Font : public CJS_Object {
+ public:
+ explicit CJS_Font(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
+ ~CJS_Font() override {}
+
+ DECLARE_JS_CLASS_BASE_PART();
+ DECLARE_JS_CLASS_CONST_PART();
+};
+
+#endif // FPDFSDK_JAVASCRIPT_CJS_FONT_H_
diff --git a/fpdfsdk/javascript/cjs_globalarrays.cpp b/fpdfsdk/javascript/cjs_globalarrays.cpp
new file mode 100644
index 0000000000..ff0d5e5f71
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_globalarrays.cpp
@@ -0,0 +1,73 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fpdfsdk/javascript/cjs_globalarrays.h"
+
+#define GLOBAL_ARRAY(rt, name, ...) \
+ { \
+ const wchar_t* values[] = {__VA_ARGS__}; \
+ v8::Local<v8::Array> array = (rt)->NewArray(); \
+ for (size_t i = 0; i < FX_ArraySize(values); ++i) \
+ array->Set(i, (rt)->NewString(values[i])); \
+ (rt)->SetConstArray((name), array); \
+ (rt)->DefineGlobalConst( \
+ (name), [](const v8::FunctionCallbackInfo<v8::Value>& info) { \
+ CJS_Runtime* pCurrentRuntime = \
+ CJS_Runtime::CurrentRuntimeFromIsolate(info.GetIsolate()); \
+ if (pCurrentRuntime) \
+ info.GetReturnValue().Set(pCurrentRuntime->GetConstArray(name)); \
+ }); \
+ }
+
+void CJS_GlobalArrays::DefineJSObjects(CJS_Runtime* pRuntime) {
+ GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_ENTRY_DOT_SEP", L"[+-]?\\d*\\.?\\d*");
+ GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_COMMIT_DOT_SEP",
+ L"[+-]?\\d+(\\.\\d+)?", // -1.0 or -1
+ L"[+-]?\\.\\d+", // -.1
+ L"[+-]?\\d+\\."); // -1.
+
+ GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_ENTRY_COMMA_SEP", L"[+-]?\\d*,?\\d*");
+ GLOBAL_ARRAY(pRuntime, L"RE_NUMBER_COMMIT_COMMA_SEP",
+ L"[+-]?\\d+([.,]\\d+)?", // -1,0 or -1
+ L"[+-]?[.,]\\d+", // -,1
+ L"[+-]?\\d+[.,]"); // -1,
+
+ GLOBAL_ARRAY(pRuntime, L"RE_ZIP_ENTRY", L"\\d{0,5}");
+ GLOBAL_ARRAY(pRuntime, L"RE_ZIP_COMMIT", L"\\d{5}");
+ GLOBAL_ARRAY(pRuntime, L"RE_ZIP4_ENTRY", L"\\d{0,5}(\\.|[- ])?\\d{0,4}");
+ GLOBAL_ARRAY(pRuntime, L"RE_ZIP4_COMMIT", L"\\d{5}(\\.|[- ])?\\d{4}");
+ GLOBAL_ARRAY(pRuntime, L"RE_PHONE_ENTRY",
+ // 555-1234 or 408 555-1234
+ L"\\d{0,3}(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}",
+
+ // (408
+ L"\\(\\d{0,3}",
+
+ // (408) 555-1234
+ // (allow the addition of parens as an afterthought)
+ L"\\(\\d{0,3}\\)(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}",
+
+ // (408 555-1234
+ L"\\(\\d{0,3}(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}",
+
+ // 408) 555-1234
+ L"\\d{0,3}\\)(\\.|[- ])?\\d{0,3}(\\.|[- ])?\\d{0,4}",
+
+ // international
+ L"011(\\.|[- \\d])*");
+
+ GLOBAL_ARRAY(
+ pRuntime, L"RE_PHONE_COMMIT", L"\\d{3}(\\.|[- ])?\\d{4}", // 555-1234
+ L"\\d{3}(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", // 408 555-1234
+ L"\\(\\d{3}\\)(\\.|[- ])?\\d{3}(\\.|[- ])?\\d{4}", // (408) 555-1234
+ L"011(\\.|[- \\d])*"); // international
+
+ GLOBAL_ARRAY(pRuntime, L"RE_SSN_ENTRY",
+ L"\\d{0,3}(\\.|[- ])?\\d{0,2}(\\.|[- ])?\\d{0,4}");
+
+ GLOBAL_ARRAY(pRuntime, L"RE_SSN_COMMIT",
+ L"\\d{3}(\\.|[- ])?\\d{2}(\\.|[- ])?\\d{4}");
+}
diff --git a/fpdfsdk/javascript/cjs_globalarrays.h b/fpdfsdk/javascript/cjs_globalarrays.h
new file mode 100644
index 0000000000..ead57d8c8c
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_globalarrays.h
@@ -0,0 +1,17 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_JAVASCRIPT_CJS_GLOBALARRAYS_H_
+#define FPDFSDK_JAVASCRIPT_CJS_GLOBALARRAYS_H_
+
+#include "fpdfsdk/javascript/JS_Define.h"
+
+class CJS_GlobalArrays : public CJS_Object {
+ public:
+ static void DefineJSObjects(CJS_Runtime* pRuntmie);
+};
+
+#endif // FPDFSDK_JAVASCRIPT_CJS_GLOBALARRAYS_H_
diff --git a/fpdfsdk/javascript/cjs_globalconsts.cpp b/fpdfsdk/javascript/cjs_globalconsts.cpp
new file mode 100644
index 0000000000..063d8a1adc
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_globalconsts.cpp
@@ -0,0 +1,46 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fpdfsdk/javascript/cjs_globalconsts.h"
+
+#define GLOBAL_STRING(rt, name, value) \
+ (rt)->DefineGlobalConst( \
+ (name), [](const v8::FunctionCallbackInfo<v8::Value>& info) { \
+ info.GetReturnValue().Set( \
+ CFXJS_Engine::CurrentEngineFromIsolate(info.GetIsolate()) \
+ ->NewString(value)); \
+ })
+
+void CJS_GlobalConsts::DefineJSObjects(CJS_Runtime* pRuntime) {
+ GLOBAL_STRING(pRuntime, L"IDS_GREATER_THAN",
+ L"Invalid value: must be greater than or equal to % s.");
+
+ GLOBAL_STRING(pRuntime, L"IDS_GT_AND_LT",
+ L"Invalid value: must be greater than or equal to % s "
+ L"and less than or equal to % s.");
+
+ GLOBAL_STRING(pRuntime, L"IDS_LESS_THAN",
+ L"Invalid value: must be less than or equal to % s.");
+
+ GLOBAL_STRING(pRuntime, L"IDS_INVALID_MONTH", L"**Invalid**");
+ GLOBAL_STRING(
+ pRuntime, L"IDS_INVALID_DATE",
+ L"Invalid date / time: please ensure that the date / time exists.Field");
+
+ GLOBAL_STRING(pRuntime, L"IDS_INVALID_VALUE",
+ L"The value entered does not match the format of the field");
+
+ GLOBAL_STRING(pRuntime, L"IDS_AM", L"am");
+ GLOBAL_STRING(pRuntime, L"IDS_PM", L"pm");
+ GLOBAL_STRING(pRuntime, L"IDS_MONTH_INFO",
+ L"January[1] February[2] March[3] April[4] May[5] "
+ L"June[6] July[7] August[8] September[9] October[10] "
+ L"November[11] December[12] Sept[9] Jan[1] Feb[2] Mar[3] "
+ L"Apr[4] Jun[6] Jul[7] Aug[8] Sep[9] Oct[10] Nov[11] "
+ L"Dec[12]");
+
+ GLOBAL_STRING(pRuntime, L"IDS_STARTUP_CONSOLE_MSG", L"** ^ _ ^ **");
+}
diff --git a/fpdfsdk/javascript/cjs_globalconsts.h b/fpdfsdk/javascript/cjs_globalconsts.h
new file mode 100644
index 0000000000..ce27a4e97d
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_globalconsts.h
@@ -0,0 +1,17 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_JAVASCRIPT_CJS_GLOBALCONSTS_H_
+#define FPDFSDK_JAVASCRIPT_CJS_GLOBALCONSTS_H_
+
+#include "fpdfsdk/javascript/JS_Define.h"
+
+class CJS_GlobalConsts : public CJS_Object {
+ public:
+ static void DefineJSObjects(CJS_Runtime* pRuntime);
+};
+
+#endif // FPDFSDK_JAVASCRIPT_CJS_GLOBALCONSTS_H_
diff --git a/fpdfsdk/javascript/cjs_highlight.cpp b/fpdfsdk/javascript/cjs_highlight.cpp
new file mode 100644
index 0000000000..3c70543ac0
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_highlight.cpp
@@ -0,0 +1,16 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fpdfsdk/javascript/cjs_highlight.h"
+
+JSConstSpec CJS_Highlight::ConstSpecs[] = {
+ {"n", JSConstSpec::String, 0, "none"},
+ {"i", JSConstSpec::String, 0, "invert"},
+ {"p", JSConstSpec::String, 0, "push"},
+ {"o", JSConstSpec::String, 0, "outline"},
+ {0, JSConstSpec::Number, 0, 0}};
+
+IMPLEMENT_JS_CLASS_CONST(CJS_Highlight, highlight)
diff --git a/fpdfsdk/javascript/cjs_highlight.h b/fpdfsdk/javascript/cjs_highlight.h
new file mode 100644
index 0000000000..39f6c0fadc
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_highlight.h
@@ -0,0 +1,21 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_JAVASCRIPT_CJS_HIGHLIGHT_H_
+#define FPDFSDK_JAVASCRIPT_CJS_HIGHLIGHT_H_
+
+#include "fpdfsdk/javascript/JS_Define.h"
+
+class CJS_Highlight : public CJS_Object {
+ public:
+ explicit CJS_Highlight(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
+ ~CJS_Highlight() override {}
+
+ DECLARE_JS_CLASS_BASE_PART();
+ DECLARE_JS_CLASS_CONST_PART();
+};
+
+#endif // FPDFSDK_JAVASCRIPT_CJS_HIGHLIGHT_H_
diff --git a/fpdfsdk/javascript/cjs_position.cpp b/fpdfsdk/javascript/cjs_position.cpp
new file mode 100644
index 0000000000..9180ff54dd
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_position.cpp
@@ -0,0 +1,19 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fpdfsdk/javascript/cjs_position.h"
+
+JSConstSpec CJS_Position::ConstSpecs[] = {
+ {"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)
diff --git a/fpdfsdk/javascript/cjs_position.h b/fpdfsdk/javascript/cjs_position.h
new file mode 100644
index 0000000000..9b81b622ab
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_position.h
@@ -0,0 +1,21 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_JAVASCRIPT_CJS_POSITION_H_
+#define FPDFSDK_JAVASCRIPT_CJS_POSITION_H_
+
+#include "fpdfsdk/javascript/JS_Define.h"
+
+class CJS_Position : public CJS_Object {
+ public:
+ explicit CJS_Position(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
+ ~CJS_Position() override {}
+
+ DECLARE_JS_CLASS_BASE_PART();
+ DECLARE_JS_CLASS_CONST_PART();
+};
+
+#endif // FPDFSDK_JAVASCRIPT_CJS_POSITION_H_
diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp
index 1d9adc8f74..0209933748 100644
--- a/fpdfsdk/javascript/cjs_runtime.cpp
+++ b/fpdfsdk/javascript/cjs_runtime.cpp
@@ -10,7 +10,6 @@
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/javascript/Annot.h"
-#include "fpdfsdk/javascript/Consts.h"
#include "fpdfsdk/javascript/Document.h"
#include "fpdfsdk/javascript/Field.h"
#include "fpdfsdk/javascript/Icon.h"
@@ -21,7 +20,18 @@
#include "fpdfsdk/javascript/JS_Value.h"
#include "fpdfsdk/javascript/PublicMethods.h"
#include "fpdfsdk/javascript/app.h"
+#include "fpdfsdk/javascript/cjs_border.h"
+#include "fpdfsdk/javascript/cjs_display.h"
#include "fpdfsdk/javascript/cjs_event_context.h"
+#include "fpdfsdk/javascript/cjs_font.h"
+#include "fpdfsdk/javascript/cjs_globalarrays.h"
+#include "fpdfsdk/javascript/cjs_globalconsts.h"
+#include "fpdfsdk/javascript/cjs_highlight.h"
+#include "fpdfsdk/javascript/cjs_position.h"
+#include "fpdfsdk/javascript/cjs_scalehow.h"
+#include "fpdfsdk/javascript/cjs_scalewhen.h"
+#include "fpdfsdk/javascript/cjs_style.h"
+#include "fpdfsdk/javascript/cjs_zoomtype.h"
#include "fpdfsdk/javascript/color.h"
#include "fpdfsdk/javascript/console.h"
#include "fpdfsdk/javascript/event.h"
diff --git a/fpdfsdk/javascript/cjs_scalehow.cpp b/fpdfsdk/javascript/cjs_scalehow.cpp
new file mode 100644
index 0000000000..8f0938bda8
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_scalehow.cpp
@@ -0,0 +1,14 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fpdfsdk/javascript/cjs_scalehow.h"
+
+JSConstSpec CJS_ScaleHow::ConstSpecs[] = {
+ {"proportional", JSConstSpec::Number, 0, 0},
+ {"anamorphic", JSConstSpec::Number, 1, 0},
+ {0, JSConstSpec::Number, 0, 0}};
+
+IMPLEMENT_JS_CLASS_CONST(CJS_ScaleHow, scaleHow)
diff --git a/fpdfsdk/javascript/cjs_scalehow.h b/fpdfsdk/javascript/cjs_scalehow.h
new file mode 100644
index 0000000000..352486d461
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_scalehow.h
@@ -0,0 +1,21 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_JAVASCRIPT_CJS_SCALEHOW_H_
+#define FPDFSDK_JAVASCRIPT_CJS_SCALEHOW_H_
+
+#include "fpdfsdk/javascript/JS_Define.h"
+
+class CJS_ScaleHow : public CJS_Object {
+ public:
+ explicit CJS_ScaleHow(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
+ ~CJS_ScaleHow() override {}
+
+ DECLARE_JS_CLASS_BASE_PART();
+ DECLARE_JS_CLASS_CONST_PART();
+};
+
+#endif // FPDFSDK_JAVASCRIPT_CJS_SCALEHOW_H_
diff --git a/fpdfsdk/javascript/cjs_scalewhen.cpp b/fpdfsdk/javascript/cjs_scalewhen.cpp
new file mode 100644
index 0000000000..b48f32933a
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_scalewhen.cpp
@@ -0,0 +1,16 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fpdfsdk/javascript/cjs_scalewhen.h"
+
+JSConstSpec CJS_ScaleWhen::ConstSpecs[] = {
+ {"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)
diff --git a/fpdfsdk/javascript/cjs_scalewhen.h b/fpdfsdk/javascript/cjs_scalewhen.h
new file mode 100644
index 0000000000..7f570eb0e7
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_scalewhen.h
@@ -0,0 +1,21 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_JAVASCRIPT_CJS_SCALEWHEN_H_
+#define FPDFSDK_JAVASCRIPT_CJS_SCALEWHEN_H_
+
+#include "fpdfsdk/javascript/JS_Define.h"
+
+class CJS_ScaleWhen : public CJS_Object {
+ public:
+ explicit CJS_ScaleWhen(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
+ ~CJS_ScaleWhen() override {}
+
+ DECLARE_JS_CLASS_BASE_PART();
+ DECLARE_JS_CLASS_CONST_PART();
+};
+
+#endif // FPDFSDK_JAVASCRIPT_CJS_SCALEWHEN_H_
diff --git a/fpdfsdk/javascript/cjs_style.cpp b/fpdfsdk/javascript/cjs_style.cpp
new file mode 100644
index 0000000000..63da925a0f
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_style.cpp
@@ -0,0 +1,18 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fpdfsdk/javascript/cjs_style.h"
+
+JSConstSpec CJS_Style::ConstSpecs[] = {
+ {"ch", JSConstSpec::String, 0, "check"},
+ {"cr", JSConstSpec::String, 0, "cross"},
+ {"di", JSConstSpec::String, 0, "diamond"},
+ {"ci", JSConstSpec::String, 0, "circle"},
+ {"st", JSConstSpec::String, 0, "star"},
+ {"sq", JSConstSpec::String, 0, "square"},
+ {0, JSConstSpec::Number, 0, 0}};
+
+IMPLEMENT_JS_CLASS_CONST(CJS_Style, style)
diff --git a/fpdfsdk/javascript/cjs_style.h b/fpdfsdk/javascript/cjs_style.h
new file mode 100644
index 0000000000..062ae0fb8e
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_style.h
@@ -0,0 +1,21 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_JAVASCRIPT_CJS_STYLE_H_
+#define FPDFSDK_JAVASCRIPT_CJS_STYLE_H_
+
+#include "fpdfsdk/javascript/JS_Define.h"
+
+class CJS_Style : public CJS_Object {
+ public:
+ explicit CJS_Style(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
+ ~CJS_Style() override {}
+
+ DECLARE_JS_CLASS_BASE_PART();
+ DECLARE_JS_CLASS_CONST_PART();
+};
+
+#endif // FPDFSDK_JAVASCRIPT_CJS_STYLE_H_
diff --git a/fpdfsdk/javascript/cjs_zoomtype.cpp b/fpdfsdk/javascript/cjs_zoomtype.cpp
new file mode 100644
index 0000000000..c025f6995f
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_zoomtype.cpp
@@ -0,0 +1,19 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "fpdfsdk/javascript/cjs_zoomtype.h"
+
+JSConstSpec CJS_Zoomtype::ConstSpecs[] = {
+ {"none", JSConstSpec::String, 0, "NoVary"},
+ {"fitP", JSConstSpec::String, 0, "FitPage"},
+ {"fitW", JSConstSpec::String, 0, "FitWidth"},
+ {"fitH", JSConstSpec::String, 0, "FitHeight"},
+ {"fitV", JSConstSpec::String, 0, "FitVisibleWidth"},
+ {"pref", JSConstSpec::String, 0, "Preferred"},
+ {"refW", JSConstSpec::String, 0, "ReflowWidth"},
+ {0, JSConstSpec::Number, 0, 0}};
+
+IMPLEMENT_JS_CLASS_CONST(CJS_Zoomtype, zoomtype)
diff --git a/fpdfsdk/javascript/cjs_zoomtype.h b/fpdfsdk/javascript/cjs_zoomtype.h
new file mode 100644
index 0000000000..fea0ae9e8f
--- /dev/null
+++ b/fpdfsdk/javascript/cjs_zoomtype.h
@@ -0,0 +1,21 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_JAVASCRIPT_CJS_ZOOMTYPE_H_
+#define FPDFSDK_JAVASCRIPT_CJS_ZOOMTYPE_H_
+
+#include "fpdfsdk/javascript/JS_Define.h"
+
+class CJS_Zoomtype : public CJS_Object {
+ public:
+ explicit CJS_Zoomtype(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
+ ~CJS_Zoomtype() override {}
+
+ DECLARE_JS_CLASS_BASE_PART();
+ DECLARE_JS_CLASS_CONST_PART();
+};
+
+#endif // FPDFSDK_JAVASCRIPT_CJS_ZOOMTYPE_H_