summaryrefslogtreecommitdiff
path: root/fxjs/cjs_annot.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-02-05 22:27:22 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-02-05 22:27:22 +0000
commitf743552fbdb17f974c9b1675af81210fe0ffcc50 (patch)
treed0eccefff3c758151428e18eb803e93d8864046a /fxjs/cjs_annot.cpp
parent998fee395fc8a543968c7db3db9e3cf81dee57fc (diff)
downloadpdfium-f743552fbdb17f974c9b1675af81210fe0ffcc50.tar.xz
Fold CJS_EmbedObj classes into CJS_Object classes
This CL removes the CJS_EmbedObj class and various subclasses and folds the subclasses into their CJS_Object counterparts. Change-Id: If6b882a4995c0b1bf83ac783f5c27ba9216c2d5c Reviewed-on: https://pdfium-review.googlesource.com/25410 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cjs_annot.cpp')
-rw-r--r--fxjs/cjs_annot.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/fxjs/cjs_annot.cpp b/fxjs/cjs_annot.cpp
index 34084a9091..fc38e11c2f 100644
--- a/fxjs/cjs_annot.cpp
+++ b/fxjs/cjs_annot.cpp
@@ -26,6 +26,8 @@ const JSPropertySpec CJS_Annot::PropertySpecs[] = {
int CJS_Annot::ObjDefnID = -1;
+const char CJS_Annot::kName[] = "Annot";
+
// static
int CJS_Annot::GetObjDefnID() {
return ObjDefnID;
@@ -33,20 +35,16 @@ int CJS_Annot::GetObjDefnID() {
// static
void CJS_Annot::DefineJSObjects(CFXJS_Engine* pEngine) {
- ObjDefnID = pEngine->DefineObj("Annot", FXJSOBJTYPE_DYNAMIC,
+ ObjDefnID = pEngine->DefineObj(CJS_Annot::kName, FXJSOBJTYPE_DYNAMIC,
JSConstructor<CJS_Annot>, JSDestructor);
DefineProps(pEngine, ObjDefnID, PropertySpecs, FX_ArraySize(PropertySpecs));
}
-CJS_Annot::CJS_Annot(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {
- m_pEmbedObj = pdfium::MakeUnique<Annot>(this);
-}
-
-Annot::Annot(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {}
+CJS_Annot::CJS_Annot(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
-Annot::~Annot() = default;
+CJS_Annot::~CJS_Annot() = default;
-CJS_Return Annot::get_hidden(CJS_Runtime* pRuntime) {
+CJS_Return CJS_Annot::get_hidden(CJS_Runtime* pRuntime) {
if (!m_pAnnot)
return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
@@ -55,7 +53,8 @@ CJS_Return Annot::get_hidden(CJS_Runtime* pRuntime) {
CPDF_Annot::IsAnnotationHidden(pPDFAnnot->GetAnnotDict())));
}
-CJS_Return Annot::set_hidden(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
+CJS_Return CJS_Annot::set_hidden(CJS_Runtime* pRuntime,
+ v8::Local<v8::Value> vp) {
// May invalidate m_pAnnot.
bool bHidden = pRuntime->ToBoolean(vp);
if (!m_pAnnot)
@@ -78,14 +77,14 @@ CJS_Return Annot::set_hidden(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
return CJS_Return(true);
}
-CJS_Return Annot::get_name(CJS_Runtime* pRuntime) {
+CJS_Return CJS_Annot::get_name(CJS_Runtime* pRuntime) {
if (!m_pAnnot)
return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
return CJS_Return(
pRuntime->NewString(ToBAAnnot(m_pAnnot.Get())->GetAnnotName().c_str()));
}
-CJS_Return Annot::set_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
+CJS_Return CJS_Annot::set_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
// May invalidate m_pAnnot.
WideString annotName = pRuntime->ToWideString(vp);
if (!m_pAnnot)
@@ -95,7 +94,7 @@ CJS_Return Annot::set_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
return CJS_Return(true);
}
-CJS_Return Annot::get_type(CJS_Runtime* pRuntime) {
+CJS_Return CJS_Annot::get_type(CJS_Runtime* pRuntime) {
if (!m_pAnnot)
return CJS_Return(JSGetStringFromID(JSMessage::kBadObjectError));
return CJS_Return(pRuntime->NewString(
@@ -105,10 +104,6 @@ CJS_Return Annot::get_type(CJS_Runtime* pRuntime) {
.c_str()));
}
-CJS_Return Annot::set_type(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
+CJS_Return CJS_Annot::set_type(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
return CJS_Return(JSGetStringFromID(JSMessage::kReadOnlyError));
}
-
-void Annot::SetSDKAnnot(CPDFSDK_BAAnnot* annot) {
- m_pAnnot.Reset(annot);
-}