FX_BOOL CJS_Document::InitInstance(IFXJS_Context* cc) { CJS_Context* pContext = (CJS_Context*)cc; ASSERT(pContext != NULL); Document* pDoc = (Document*)GetEmbedObject(); ASSERT(pDoc != NULL); pDoc->AttachDoc(pContext->GetReaderDocument()); pDoc->SetIsolate(pContext->GetJSRuntime()->GetIsolate()); return TRUE; };
Field* CJS_EventHandler::Target_Field() { CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); v8::Local<v8::Object> pDocObj = FXJS_NewFxDynamicObj( pRuntime->GetIsolate(), pRuntime, CJS_Document::g_nObjDefnID); ASSERT(!pDocObj.IsEmpty()); v8::Local<v8::Object> pFieldObj = FXJS_NewFxDynamicObj( pRuntime->GetIsolate(), pRuntime, CJS_Field::g_nObjDefnID); ASSERT(!pFieldObj.IsEmpty()); CJS_Document* pJSDocument = (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pDocObj); Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); pDocument->AttachDoc(m_pTargetDoc ? m_pTargetDoc : m_pJSContext->GetReaderDocument()); CJS_Field* pJSField = (CJS_Field*)FXJS_GetPrivate(pRuntime->GetIsolate(), pFieldObj); Field* pField = (Field*)pJSField->GetEmbedObject(); pField->AttachField(pDocument, m_strTargetName); return pField; }