| 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 "JS_EventHandler.h" | 7 #include "JS_EventHandler.h" |
| 8 | 8 |
| 9 #include "../../include/javascript/IJavaScript.h" | 9 #include "../../include/javascript/IJavaScript.h" |
| 10 #include "Document.h" | 10 #include "Document.h" |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 return m_nSelStartDu; | 606 return m_nSelStartDu; |
| 607 } | 607 } |
| 608 | 608 |
| 609 FX_BOOL CJS_EventHandler::Shift() { | 609 FX_BOOL CJS_EventHandler::Shift() { |
| 610 return m_bShift; | 610 return m_bShift; |
| 611 } | 611 } |
| 612 | 612 |
| 613 Field* CJS_EventHandler::Source() { | 613 Field* CJS_EventHandler::Source() { |
| 614 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); | 614 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); |
| 615 v8::Local<v8::Object> pDocObj = FXJS_NewFxDynamicObj( | 615 v8::Local<v8::Object> pDocObj = FXJS_NewFxDynamicObj( |
| 616 pRuntime->GetIsolate(), m_pJSContext, CJS_Document::g_nObjDefnID); | 616 pRuntime->GetIsolate(), pRuntime, CJS_Document::g_nObjDefnID); |
| 617 ASSERT(!pDocObj.IsEmpty()); | 617 ASSERT(!pDocObj.IsEmpty()); |
| 618 | 618 |
| 619 v8::Local<v8::Object> pFieldObj = FXJS_NewFxDynamicObj( | 619 v8::Local<v8::Object> pFieldObj = FXJS_NewFxDynamicObj( |
| 620 pRuntime->GetIsolate(), m_pJSContext, CJS_Field::g_nObjDefnID); | 620 pRuntime->GetIsolate(), pRuntime, CJS_Field::g_nObjDefnID); |
| 621 ASSERT(!pFieldObj.IsEmpty()); | 621 ASSERT(!pFieldObj.IsEmpty()); |
| 622 | 622 |
| 623 CJS_Document* pJSDocument = | 623 CJS_Document* pJSDocument = |
| 624 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pDocObj); | 624 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pDocObj); |
| 625 Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); | 625 Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); |
| 626 pDocument->AttachDoc(m_pTargetDoc ? m_pTargetDoc | 626 pDocument->AttachDoc(m_pTargetDoc ? m_pTargetDoc |
| 627 : m_pJSContext->GetReaderDocument()); | 627 : m_pJSContext->GetReaderDocument()); |
| 628 | 628 |
| 629 CJS_Field* pJSField = | 629 CJS_Field* pJSField = |
| 630 (CJS_Field*)FXJS_GetPrivate(pRuntime->GetIsolate(), pFieldObj); | 630 (CJS_Field*)FXJS_GetPrivate(pRuntime->GetIsolate(), pFieldObj); |
| 631 Field* pField = (Field*)pJSField->GetEmbedObject(); | 631 Field* pField = (Field*)pJSField->GetEmbedObject(); |
| 632 pField->AttachField(pDocument, m_strSourceName); | 632 pField->AttachField(pDocument, m_strSourceName); |
| 633 return pField; | 633 return pField; |
| 634 } | 634 } |
| 635 | 635 |
| 636 Field* CJS_EventHandler::Target_Field() { | 636 Field* CJS_EventHandler::Target_Field() { |
| 637 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); | 637 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); |
| 638 v8::Local<v8::Object> pDocObj = FXJS_NewFxDynamicObj( | 638 v8::Local<v8::Object> pDocObj = FXJS_NewFxDynamicObj( |
| 639 pRuntime->GetIsolate(), m_pJSContext, CJS_Document::g_nObjDefnID); | 639 pRuntime->GetIsolate(), pRuntime, CJS_Document::g_nObjDefnID); |
| 640 ASSERT(!pDocObj.IsEmpty()); | 640 ASSERT(!pDocObj.IsEmpty()); |
| 641 | 641 |
| 642 v8::Local<v8::Object> pFieldObj = FXJS_NewFxDynamicObj( | 642 v8::Local<v8::Object> pFieldObj = FXJS_NewFxDynamicObj( |
| 643 pRuntime->GetIsolate(), m_pJSContext, CJS_Field::g_nObjDefnID); | 643 pRuntime->GetIsolate(), pRuntime, CJS_Field::g_nObjDefnID); |
| 644 ASSERT(!pFieldObj.IsEmpty()); | 644 ASSERT(!pFieldObj.IsEmpty()); |
| 645 | 645 |
| 646 CJS_Document* pJSDocument = | 646 CJS_Document* pJSDocument = |
| 647 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pDocObj); | 647 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pDocObj); |
| 648 Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); | 648 Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); |
| 649 pDocument->AttachDoc(m_pTargetDoc ? m_pTargetDoc | 649 pDocument->AttachDoc(m_pTargetDoc ? m_pTargetDoc |
| 650 : m_pJSContext->GetReaderDocument()); | 650 : m_pJSContext->GetReaderDocument()); |
| 651 | 651 |
| 652 CJS_Field* pJSField = | 652 CJS_Field* pJSField = |
| 653 (CJS_Field*)FXJS_GetPrivate(pRuntime->GetIsolate(), pFieldObj); | 653 (CJS_Field*)FXJS_GetPrivate(pRuntime->GetIsolate(), pFieldObj); |
| 654 Field* pField = (Field*)pJSField->GetEmbedObject(); | 654 Field* pField = (Field*)pJSField->GetEmbedObject(); |
| 655 pField->AttachField(pDocument, m_strTargetName); | 655 pField->AttachField(pDocument, m_strTargetName); |
| 656 return pField; | 656 return pField; |
| 657 } | 657 } |
| 658 | 658 |
| 659 CFX_WideString& CJS_EventHandler::Value() { | 659 CFX_WideString& CJS_EventHandler::Value() { |
| 660 return *m_pValue; | 660 return *m_pValue; |
| 661 } | 661 } |
| 662 | 662 |
| 663 FX_BOOL CJS_EventHandler::WillCommit() { | 663 FX_BOOL CJS_EventHandler::WillCommit() { |
| 664 return m_bWillCommit; | 664 return m_bWillCommit; |
| 665 } | 665 } |
| 666 | 666 |
| 667 CFX_WideString CJS_EventHandler::TargetName() { | 667 CFX_WideString CJS_EventHandler::TargetName() { |
| 668 return m_strTargetName; | 668 return m_strTargetName; |
| 669 } | 669 } |
| OLD | NEW |