Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: fpdfsdk/javascript/JS_EventHandler.cpp

Issue 2394313002: Convert IJS_Runtime to CPDFSDK_FormFillEnvironment (Closed)
Patch Set: Rebase to master Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/javascript/JS_EventHandler.h" 7 #include "fpdfsdk/javascript/JS_EventHandler.h"
8 8
9 #include "fpdfsdk/javascript/Document.h" 9 #include "fpdfsdk/javascript/Document.h"
10 #include "fpdfsdk/javascript/Field.h" 10 #include "fpdfsdk/javascript/Field.h"
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 pRuntime->NewFxDynamicObj(CJS_Document::g_nObjDefnID); 595 pRuntime->NewFxDynamicObj(CJS_Document::g_nObjDefnID);
596 ASSERT(!pDocObj.IsEmpty()); 596 ASSERT(!pDocObj.IsEmpty());
597 597
598 v8::Local<v8::Object> pFieldObj = 598 v8::Local<v8::Object> pFieldObj =
599 pRuntime->NewFxDynamicObj(CJS_Field::g_nObjDefnID); 599 pRuntime->NewFxDynamicObj(CJS_Field::g_nObjDefnID);
600 ASSERT(!pFieldObj.IsEmpty()); 600 ASSERT(!pFieldObj.IsEmpty());
601 601
602 CJS_Document* pJSDocument = 602 CJS_Document* pJSDocument =
603 static_cast<CJS_Document*>(pRuntime->GetObjectPrivate(pDocObj)); 603 static_cast<CJS_Document*>(pRuntime->GetObjectPrivate(pDocObj));
604 Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); 604 Document* pDocument = (Document*)pJSDocument->GetEmbedObject();
605 pDocument->AttachDoc(m_pTargetFormFillEnv 605 pDocument->SetFormFillEnv(m_pTargetFormFillEnv
606 ? m_pTargetFormFillEnv->GetSDKDocument() 606 ? m_pTargetFormFillEnv
607 : m_pJSContext->GetFormFillEnv()->GetSDKDocument()); 607 : m_pJSContext->GetFormFillEnv());
608 608
609 CJS_Field* pJSField = 609 CJS_Field* pJSField =
610 static_cast<CJS_Field*>(pRuntime->GetObjectPrivate(pFieldObj)); 610 static_cast<CJS_Field*>(pRuntime->GetObjectPrivate(pFieldObj));
611 Field* pField = (Field*)pJSField->GetEmbedObject(); 611 Field* pField = (Field*)pJSField->GetEmbedObject();
612 pField->AttachField(pDocument, m_strSourceName); 612 pField->AttachField(pDocument, m_strSourceName);
613 return pField; 613 return pField;
614 } 614 }
615 615
616 Field* CJS_EventHandler::Target_Field() { 616 Field* CJS_EventHandler::Target_Field() {
617 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); 617 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime();
618 v8::Local<v8::Object> pDocObj = 618 v8::Local<v8::Object> pDocObj =
619 pRuntime->NewFxDynamicObj(CJS_Document::g_nObjDefnID); 619 pRuntime->NewFxDynamicObj(CJS_Document::g_nObjDefnID);
620 ASSERT(!pDocObj.IsEmpty()); 620 ASSERT(!pDocObj.IsEmpty());
621 621
622 v8::Local<v8::Object> pFieldObj = 622 v8::Local<v8::Object> pFieldObj =
623 pRuntime->NewFxDynamicObj(CJS_Field::g_nObjDefnID); 623 pRuntime->NewFxDynamicObj(CJS_Field::g_nObjDefnID);
624 ASSERT(!pFieldObj.IsEmpty()); 624 ASSERT(!pFieldObj.IsEmpty());
625 625
626 CJS_Document* pJSDocument = 626 CJS_Document* pJSDocument =
627 static_cast<CJS_Document*>(pRuntime->GetObjectPrivate(pDocObj)); 627 static_cast<CJS_Document*>(pRuntime->GetObjectPrivate(pDocObj));
628 Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); 628 Document* pDocument = (Document*)pJSDocument->GetEmbedObject();
629 pDocument->AttachDoc(m_pTargetFormFillEnv 629 pDocument->SetFormFillEnv(m_pTargetFormFillEnv
630 ? m_pTargetFormFillEnv->GetSDKDocument() 630 ? m_pTargetFormFillEnv
631 : m_pJSContext->GetFormFillEnv()->GetSDKDocument()); 631 : m_pJSContext->GetFormFillEnv());
632 632
633 CJS_Field* pJSField = 633 CJS_Field* pJSField =
634 static_cast<CJS_Field*>(pRuntime->GetObjectPrivate(pFieldObj)); 634 static_cast<CJS_Field*>(pRuntime->GetObjectPrivate(pFieldObj));
635 Field* pField = (Field*)pJSField->GetEmbedObject(); 635 Field* pField = (Field*)pJSField->GetEmbedObject();
636 pField->AttachField(pDocument, m_strTargetName); 636 pField->AttachField(pDocument, m_strTargetName);
637 return pField; 637 return pField;
638 } 638 }
639 639
640 CFX_WideString& CJS_EventHandler::Value() { 640 CFX_WideString& CJS_EventHandler::Value() {
641 return *m_pValue; 641 return *m_pValue;
642 } 642 }
643 643
644 FX_BOOL CJS_EventHandler::WillCommit() { 644 FX_BOOL CJS_EventHandler::WillCommit() {
645 return m_bWillCommit; 645 return m_bWillCommit;
646 } 646 }
647 647
648 CFX_WideString CJS_EventHandler::TargetName() { 648 CFX_WideString CJS_EventHandler::TargetName() {
649 return m_strTargetName; 649 return m_strTargetName;
650 } 650 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698