From 3645652fb6cad1f94c9647f033a8e300bc37d521 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 8 Feb 2018 21:01:01 +0000 Subject: Move XFA-specific methods out of CJS_V8. These belong more properly in CFXJS_Engine, and a small amount of casting is required to get to the sub-class. Change-Id: Id954d182b7a7d51fe0a522c04a50a1b362746c72 Reviewed-on: https://pdfium-review.googlesource.com/26050 Reviewed-by: dsinclair Commit-Queue: Tom Sepez --- fxjs/cjs_v8.cpp | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'fxjs/cjs_v8.cpp') diff --git a/fxjs/cjs_v8.cpp b/fxjs/cjs_v8.cpp index 0a1674076d..e6948a37cf 100644 --- a/fxjs/cjs_v8.cpp +++ b/fxjs/cjs_v8.cpp @@ -6,11 +6,6 @@ #include "fxjs/cjs_v8.h" -#ifdef PDF_ENABLE_XFA -#include "fxjs/cfxjse_context.h" -#include "xfa/fxfa/parser/cxfa_object.h" -#endif // PDF_ENABLE_XFA - CJS_V8::CJS_V8(v8::Isolate* isolate) : m_isolate(isolate) {} CJS_V8::~CJS_V8() = default; @@ -199,29 +194,3 @@ v8::Local CJS_V8::ToArray(v8::Local pValue) { v8::Local context = m_isolate->GetCurrentContext(); return v8::Local::Cast(pValue->ToObject(context).ToLocalChecked()); } - -#ifdef PDF_ENABLE_XFA -CXFA_Object* CJS_V8::ToXFAObject(v8::Local obj) { - ASSERT(!obj.IsEmpty()); - - if (!obj->IsObject()) - return nullptr; - - CFXJSE_HostObject* hostObj = - FXJSE_RetrieveObjectBinding(obj.As(), nullptr); - if (!hostObj || hostObj->type() != CFXJSE_HostObject::kXFA) - return nullptr; - return static_cast(hostObj); -} - -v8::Local CJS_V8::NewXFAObject( - CXFA_Object* obj, - v8::Global& tmpl) { - v8::EscapableHandleScope scope(m_isolate); - v8::Local klass = - v8::Local::New(m_isolate, tmpl); - v8::Local object = klass->InstanceTemplate()->NewInstance(); - FXJSE_UpdateObjectBinding(object, obj); - return scope.Escape(object); -} -#endif // PDF_ENABLE_XFA -- cgit v1.2.3