| OLD | NEW |
| 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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 } | 588 } |
| 589 return m_nSelStartDu; | 589 return m_nSelStartDu; |
| 590 } | 590 } |
| 591 | 591 |
| 592 FX_BOOL CJS_EventHandler::Shift() { | 592 FX_BOOL CJS_EventHandler::Shift() { |
| 593 return m_bShift; | 593 return m_bShift; |
| 594 } | 594 } |
| 595 | 595 |
| 596 Field* CJS_EventHandler::Source() { | 596 Field* CJS_EventHandler::Source() { |
| 597 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); | 597 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); |
| 598 v8::Local<v8::Object> pDocObj = FXJS_NewFxDynamicObj( | 598 v8::Local<v8::Object> pDocObj = |
| 599 pRuntime->GetIsolate(), pRuntime, CJS_Document::g_nObjDefnID); | 599 pRuntime->NewFxDynamicObj(CJS_Document::g_nObjDefnID); |
| 600 ASSERT(!pDocObj.IsEmpty()); | 600 ASSERT(!pDocObj.IsEmpty()); |
| 601 | 601 |
| 602 v8::Local<v8::Object> pFieldObj = FXJS_NewFxDynamicObj( | 602 v8::Local<v8::Object> pFieldObj = |
| 603 pRuntime->GetIsolate(), pRuntime, CJS_Field::g_nObjDefnID); | 603 pRuntime->NewFxDynamicObj(CJS_Field::g_nObjDefnID); |
| 604 ASSERT(!pFieldObj.IsEmpty()); | 604 ASSERT(!pFieldObj.IsEmpty()); |
| 605 | 605 |
| 606 CJS_Document* pJSDocument = | 606 CJS_Document* pJSDocument = |
| 607 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pDocObj); | 607 static_cast<CJS_Document*>(pRuntime->GetObjectPrivate(pDocObj)); |
| 608 Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); | 608 Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); |
| 609 pDocument->AttachDoc(m_pTargetDoc ? m_pTargetDoc | 609 pDocument->AttachDoc(m_pTargetDoc ? m_pTargetDoc |
| 610 : m_pJSContext->GetReaderDocument()); | 610 : m_pJSContext->GetReaderDocument()); |
| 611 | 611 |
| 612 CJS_Field* pJSField = | 612 CJS_Field* pJSField = |
| 613 (CJS_Field*)FXJS_GetPrivate(pRuntime->GetIsolate(), pFieldObj); | 613 static_cast<CJS_Field*>(pRuntime->GetObjectPrivate(pFieldObj)); |
| 614 Field* pField = (Field*)pJSField->GetEmbedObject(); | 614 Field* pField = (Field*)pJSField->GetEmbedObject(); |
| 615 pField->AttachField(pDocument, m_strSourceName); | 615 pField->AttachField(pDocument, m_strSourceName); |
| 616 return pField; | 616 return pField; |
| 617 } | 617 } |
| 618 | 618 |
| 619 Field* CJS_EventHandler::Target_Field() { | 619 Field* CJS_EventHandler::Target_Field() { |
| 620 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); | 620 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); |
| 621 v8::Local<v8::Object> pDocObj = FXJS_NewFxDynamicObj( | 621 v8::Local<v8::Object> pDocObj = |
| 622 pRuntime->GetIsolate(), pRuntime, CJS_Document::g_nObjDefnID); | 622 pRuntime->NewFxDynamicObj(CJS_Document::g_nObjDefnID); |
| 623 ASSERT(!pDocObj.IsEmpty()); | 623 ASSERT(!pDocObj.IsEmpty()); |
| 624 | 624 |
| 625 v8::Local<v8::Object> pFieldObj = FXJS_NewFxDynamicObj( | 625 v8::Local<v8::Object> pFieldObj = |
| 626 pRuntime->GetIsolate(), pRuntime, CJS_Field::g_nObjDefnID); | 626 pRuntime->NewFxDynamicObj(CJS_Field::g_nObjDefnID); |
| 627 ASSERT(!pFieldObj.IsEmpty()); | 627 ASSERT(!pFieldObj.IsEmpty()); |
| 628 | 628 |
| 629 CJS_Document* pJSDocument = | 629 CJS_Document* pJSDocument = |
| 630 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pDocObj); | 630 static_cast<CJS_Document*>(pRuntime->GetObjectPrivate(pDocObj)); |
| 631 Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); | 631 Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); |
| 632 pDocument->AttachDoc(m_pTargetDoc ? m_pTargetDoc | 632 pDocument->AttachDoc(m_pTargetDoc ? m_pTargetDoc |
| 633 : m_pJSContext->GetReaderDocument()); | 633 : m_pJSContext->GetReaderDocument()); |
| 634 | 634 |
| 635 CJS_Field* pJSField = | 635 CJS_Field* pJSField = |
| 636 (CJS_Field*)FXJS_GetPrivate(pRuntime->GetIsolate(), pFieldObj); | 636 static_cast<CJS_Field*>(pRuntime->GetObjectPrivate(pFieldObj)); |
| 637 Field* pField = (Field*)pJSField->GetEmbedObject(); | 637 Field* pField = (Field*)pJSField->GetEmbedObject(); |
| 638 pField->AttachField(pDocument, m_strTargetName); | 638 pField->AttachField(pDocument, m_strTargetName); |
| 639 return pField; | 639 return pField; |
| 640 } | 640 } |
| 641 | 641 |
| 642 CFX_WideString& CJS_EventHandler::Value() { | 642 CFX_WideString& CJS_EventHandler::Value() { |
| 643 return *m_pValue; | 643 return *m_pValue; |
| 644 } | 644 } |
| 645 | 645 |
| 646 FX_BOOL CJS_EventHandler::WillCommit() { | 646 FX_BOOL CJS_EventHandler::WillCommit() { |
| 647 return m_bWillCommit; | 647 return m_bWillCommit; |
| 648 } | 648 } |
| 649 | 649 |
| 650 CFX_WideString CJS_EventHandler::TargetName() { | 650 CFX_WideString CJS_EventHandler::TargetName() { |
| 651 return m_strTargetName; | 651 return m_strTargetName; |
| 652 } | 652 } |
| OLD | NEW |