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

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

Issue 1334833003: Merge to XFA: Remove some abstractions in fxjs_v8.h. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 3 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
« no previous file with comments | « fpdfsdk/src/javascript/JS_Context.cpp ('k') | fpdfsdk/src/javascript/JS_Object.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "../../include/javascript/JavaScript.h" 7 #include "../../include/javascript/JavaScript.h"
8 #include "../../include/javascript/IJavaScript.h" 8 #include "../../include/javascript/IJavaScript.h"
9 #include "../../include/javascript/JS_EventHandler.h" 9 #include "../../include/javascript/JS_EventHandler.h"
10 #include "../../include/javascript/JS_Context.h" 10 #include "../../include/javascript/JS_Context.h"
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ASSERT(m_pJSContext != NULL); 614 ASSERT(m_pJSContext != NULL);
615 615
616 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); 616 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime();
617 617
618 JSFXObject pDocObj = JS_NewFxDynamicObj( 618 v8::Local<v8::Object> pDocObj =
619 *pRuntime, m_pJSContext, JS_GetObjDefnID(*pRuntime, L"Document")); 619 JS_NewFxDynamicObj(pRuntime->GetIsolate(), m_pJSContext,
620 JS_GetObjDefnID(pRuntime->GetIsolate(), L"Document"));
620 ASSERT(pDocObj.IsEmpty() == FALSE); 621 ASSERT(pDocObj.IsEmpty() == FALSE);
621 JSFXObject pFieldObj = JS_NewFxDynamicObj( 622 v8::Local<v8::Object> pFieldObj =
622 *pRuntime, m_pJSContext, JS_GetObjDefnID(*pRuntime, L"Field")); 623 JS_NewFxDynamicObj(pRuntime->GetIsolate(), m_pJSContext,
624 JS_GetObjDefnID(pRuntime->GetIsolate(), L"Field"));
623 ASSERT(pFieldObj.IsEmpty() == FALSE); 625 ASSERT(pFieldObj.IsEmpty() == FALSE);
624 626
625 CJS_Document* pJSDocument = (CJS_Document*)JS_GetPrivate(pDocObj); 627 CJS_Document* pJSDocument = (CJS_Document*)JS_GetPrivate(pDocObj);
626 ASSERT(pJSDocument != NULL); 628 ASSERT(pJSDocument != NULL);
627 Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); 629 Document* pDocument = (Document*)pJSDocument->GetEmbedObject();
628 ASSERT(pDocument != NULL); 630 ASSERT(pDocument != NULL);
629 if (m_pTargetDoc != NULL) 631 if (m_pTargetDoc != NULL)
630 pDocument->AttachDoc(m_pTargetDoc); 632 pDocument->AttachDoc(m_pTargetDoc);
631 else 633 else
632 pDocument->AttachDoc(m_pJSContext->GetReaderDocument()); 634 pDocument->AttachDoc(m_pJSContext->GetReaderDocument());
(...skipping 10 matching lines...) Expand all
643 ASSERT(pField != NULL); 645 ASSERT(pField != NULL);
644 pField->AttachField(pDocument, m_strSourceName); 646 pField->AttachField(pDocument, m_strSourceName);
645 return pField; 647 return pField;
646 } 648 }
647 649
648 Field* CJS_EventHandler::Target_Field() { 650 Field* CJS_EventHandler::Target_Field() {
649 ASSERT(m_pJSContext != NULL); 651 ASSERT(m_pJSContext != NULL);
650 652
651 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); 653 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime();
652 654
653 JSFXObject pDocObj = JS_NewFxDynamicObj( 655 v8::Local<v8::Object> pDocObj =
654 *pRuntime, m_pJSContext, JS_GetObjDefnID(*pRuntime, L"Document")); 656 JS_NewFxDynamicObj(pRuntime->GetIsolate(), m_pJSContext,
657 JS_GetObjDefnID(pRuntime->GetIsolate(), L"Document"));
655 ASSERT(pDocObj.IsEmpty() == FALSE); 658 ASSERT(pDocObj.IsEmpty() == FALSE);
656 JSFXObject pFieldObj = JS_NewFxDynamicObj( 659 v8::Local<v8::Object> pFieldObj =
657 *pRuntime, m_pJSContext, JS_GetObjDefnID(*pRuntime, L"Field")); 660 JS_NewFxDynamicObj(pRuntime->GetIsolate(), m_pJSContext,
661 JS_GetObjDefnID(pRuntime->GetIsolate(), L"Field"));
658 ASSERT(pFieldObj.IsEmpty() == FALSE); 662 ASSERT(pFieldObj.IsEmpty() == FALSE);
659 663
660 CJS_Document* pJSDocument = (CJS_Document*)JS_GetPrivate(pDocObj); 664 CJS_Document* pJSDocument = (CJS_Document*)JS_GetPrivate(pDocObj);
661 ASSERT(pJSDocument != NULL); 665 ASSERT(pJSDocument != NULL);
662 Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); 666 Document* pDocument = (Document*)pJSDocument->GetEmbedObject();
663 ASSERT(pDocument != NULL); 667 ASSERT(pDocument != NULL);
664 if (m_pTargetDoc != NULL) 668 if (m_pTargetDoc != NULL)
665 pDocument->AttachDoc(m_pTargetDoc); 669 pDocument->AttachDoc(m_pTargetDoc);
666 else 670 else
667 pDocument->AttachDoc(m_pJSContext->GetReaderDocument()); 671 pDocument->AttachDoc(m_pJSContext->GetReaderDocument());
(...skipping 12 matching lines...) Expand all
680 return *m_pValue; 684 return *m_pValue;
681 } 685 }
682 686
683 FX_BOOL CJS_EventHandler::WillCommit() { 687 FX_BOOL CJS_EventHandler::WillCommit() {
684 return m_bWillCommit; 688 return m_bWillCommit;
685 } 689 }
686 690
687 CFX_WideString CJS_EventHandler::TargetName() { 691 CFX_WideString CJS_EventHandler::TargetName() {
688 return m_strTargetName; 692 return m_strTargetName;
689 } 693 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/JS_Context.cpp ('k') | fpdfsdk/src/javascript/JS_Object.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698