Chromium Code Reviews| 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 "Document.h" | 7 #include "Document.h" |
| 8 | 8 |
| 9 #include "../../../third_party/base/numerics/safe_math.h" | 9 #include "../../../third_party/base/numerics/safe_math.h" |
| 10 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. | 10 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 } | 559 } |
| 560 | 560 |
| 561 // reset filed values within a document. | 561 // reset filed values within a document. |
| 562 // comment: | 562 // comment: |
| 563 // note: if the fields names r not rational, aodbe is dumb for it. | 563 // note: if the fields names r not rational, aodbe is dumb for it. |
| 564 | 564 |
| 565 FX_BOOL Document::resetForm(IJS_Context* cc, | 565 FX_BOOL Document::resetForm(IJS_Context* cc, |
| 566 const CJS_Parameters& params, | 566 const CJS_Parameters& params, |
| 567 CJS_Value& vRet, | 567 CJS_Value& vRet, |
| 568 CFX_WideString& sError) { | 568 CFX_WideString& sError) { |
| 569 ASSERT(m_pDocument != NULL); | |
| 570 | |
| 571 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || | 569 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || |
| 572 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || | 570 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || |
| 573 m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) | 571 m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) |
| 574 return FALSE; | 572 return FALSE; |
| 575 | 573 |
| 576 CPDFSDK_InterForm* pInterForm = | 574 CPDFSDK_InterForm* pInterForm = |
| 577 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); | 575 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); |
| 578 ASSERT(pInterForm != NULL); | |
| 579 | |
| 580 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); | 576 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); |
| 581 ASSERT(pPDFForm != NULL); | 577 CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); |
| 582 | 578 CJS_Array aName(pRuntime); |
| 583 v8::Isolate* isolate = GetIsolate(cc); | |
| 584 CJS_Array aName(isolate); | |
| 585 | 579 |
| 586 if (params.size() > 0) { | 580 if (params.size() > 0) { |
| 587 switch (params[0].GetType()) { | 581 switch (params[0].GetType()) { |
| 588 default: | 582 default: |
| 589 aName.Attach(params[0].ToV8Array()); | 583 aName.Attach(params[0].ToV8Array()); |
| 590 break; | 584 break; |
| 591 case CJS_Value::VT_string: | 585 case CJS_Value::VT_string: |
| 592 aName.SetElement(0, params[0]); | 586 aName.SetElement(0, params[0]); |
| 593 break; | 587 break; |
| 594 } | 588 } |
| 595 | 589 |
| 596 CFX_PtrArray aFields; | 590 CFX_PtrArray aFields; |
| 597 | 591 |
| 598 for (int i = 0, isz = aName.GetLength(); i < isz; i++) { | 592 for (int i = 0, isz = aName.GetLength(); i < isz; i++) { |
| 599 CJS_Value valElement(isolate); | 593 CJS_Value valElement(pRuntime); |
| 600 aName.GetElement(i, valElement); | 594 aName.GetElement(i, valElement); |
| 601 CFX_WideString swVal = valElement.ToCFXWideString(); | 595 CFX_WideString swVal = valElement.ToCFXWideString(); |
| 602 | |
| 603 for (int j = 0, jsz = pPDFForm->CountFields(swVal); j < jsz; j++) { | 596 for (int j = 0, jsz = pPDFForm->CountFields(swVal); j < jsz; j++) { |
| 604 aFields.Add((void*)pPDFForm->GetField(j, swVal)); | 597 aFields.Add((void*)pPDFForm->GetField(j, swVal)); |
| 605 } | 598 } |
| 606 } | 599 } |
| 607 | 600 |
| 608 if (aFields.GetSize() > 0) { | 601 if (aFields.GetSize() > 0) { |
| 609 pPDFForm->ResetForm(aFields, TRUE, TRUE); | 602 pPDFForm->ResetForm(aFields, TRUE, TRUE); |
| 610 m_pDocument->SetChangeMark(); | 603 m_pDocument->SetChangeMark(); |
| 611 } | 604 } |
| 612 } else { | 605 } else { |
| 613 pPDFForm->ResetForm(TRUE); | 606 pPDFForm->ResetForm(TRUE); |
| 614 m_pDocument->SetChangeMark(); | 607 m_pDocument->SetChangeMark(); |
| 615 } | 608 } |
| 616 | 609 |
| 617 return TRUE; | 610 return TRUE; |
| 618 } | 611 } |
| 619 | 612 |
| 620 FX_BOOL Document::saveAs(IJS_Context* cc, | 613 FX_BOOL Document::saveAs(IJS_Context* cc, |
| 621 const CJS_Parameters& params, | 614 const CJS_Parameters& params, |
| 622 CJS_Value& vRet, | 615 CJS_Value& vRet, |
| 623 CFX_WideString& sError) { | 616 CFX_WideString& sError) { |
| 624 // Unsafe, not supported. | 617 // Unsafe, not supported. |
| 625 return TRUE; | 618 return TRUE; |
| 626 } | 619 } |
| 627 | 620 |
| 628 FX_BOOL Document::submitForm(IJS_Context* cc, | 621 FX_BOOL Document::submitForm(IJS_Context* cc, |
| 629 const CJS_Parameters& params, | 622 const CJS_Parameters& params, |
| 630 CJS_Value& vRet, | 623 CJS_Value& vRet, |
| 631 CFX_WideString& sError) { | 624 CFX_WideString& sError) { |
| 632 ASSERT(m_pDocument != NULL); | |
| 633 CJS_Context* pContext = (CJS_Context*)cc; | 625 CJS_Context* pContext = (CJS_Context*)cc; |
| 634 int nSize = params.size(); | 626 int nSize = params.size(); |
| 635 if (nSize < 1) { | 627 if (nSize < 1) { |
| 636 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); | 628 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); |
| 637 return FALSE; | 629 return FALSE; |
| 638 } | 630 } |
| 639 | 631 |
| 632 CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); | |
| 633 v8::Isolate* isolate = pRuntime->GetIsolate(); | |
| 634 CJS_Array aFields(pRuntime); | |
| 640 CFX_WideString strURL; | 635 CFX_WideString strURL; |
| 641 FX_BOOL bFDF = TRUE; | 636 FX_BOOL bFDF = TRUE; |
| 642 FX_BOOL bEmpty = FALSE; | 637 FX_BOOL bEmpty = FALSE; |
| 643 v8::Isolate* isolate = GetIsolate(cc); | |
| 644 CJS_Array aFields(isolate); | |
| 645 | 638 |
| 646 CJS_Value v = params[0]; | 639 CJS_Value v = params[0]; |
| 647 if (v.GetType() == CJS_Value::VT_string) { | 640 if (v.GetType() == CJS_Value::VT_string) { |
| 648 strURL = params[0].ToCFXWideString(); | 641 strURL = params[0].ToCFXWideString(); |
| 649 if (nSize > 1) | 642 if (nSize > 1) |
| 650 bFDF = params[1].ToBool(); | 643 bFDF = params[1].ToBool(); |
| 651 if (nSize > 2) | 644 if (nSize > 2) |
| 652 bEmpty = params[2].ToBool(); | 645 bEmpty = params[2].ToBool(); |
| 653 if (nSize > 3) | 646 if (nSize > 3) |
| 654 aFields.Attach(params[3].ToV8Array()); | 647 aFields.Attach(params[3].ToV8Array()); |
| 655 } else if (v.GetType() == CJS_Value::VT_object) { | 648 } else if (v.GetType() == CJS_Value::VT_object) { |
| 656 v8::Local<v8::Object> pObj = params[0].ToV8Object(); | 649 v8::Local<v8::Object> pObj = params[0].ToV8Object(); |
| 657 v8::Local<v8::Value> pValue = FXJS_GetObjectElement(isolate, pObj, L"cURL"); | 650 v8::Local<v8::Value> pValue = FXJS_GetObjectElement(isolate, pObj, L"cURL"); |
| 658 if (!pValue.IsEmpty()) | 651 if (!pValue.IsEmpty()) |
| 659 strURL = | 652 strURL = |
| 660 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 653 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 654 | |
| 661 pValue = FXJS_GetObjectElement(isolate, pObj, L"bFDF"); | 655 pValue = FXJS_GetObjectElement(isolate, pObj, L"bFDF"); |
| 662 bFDF = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToBool(); | 656 bFDF = CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToBool(); |
| 657 | |
| 663 pValue = FXJS_GetObjectElement(isolate, pObj, L"bEmpty"); | 658 pValue = FXJS_GetObjectElement(isolate, pObj, L"bEmpty"); |
| 664 bEmpty = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToBool(); | 659 bEmpty = CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToBool(); |
| 660 | |
| 665 pValue = FXJS_GetObjectElement(isolate, pObj, L"aFields"); | 661 pValue = FXJS_GetObjectElement(isolate, pObj, L"aFields"); |
| 666 aFields.Attach( | 662 aFields.Attach( |
| 667 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToV8Array()); | 663 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToV8Array()); |
| 668 } | 664 } |
| 669 | 665 |
| 670 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | |
| 671 CPDFSDK_InterForm* pInterForm = | 666 CPDFSDK_InterForm* pInterForm = |
| 672 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); | 667 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); |
| 673 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); | 668 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); |
| 674 FX_BOOL bAll = (aFields.GetLength() == 0); | 669 FX_BOOL bAll = (aFields.GetLength() == 0); |
| 675 if (bAll && bEmpty) { | 670 if (bAll && bEmpty) { |
| 676 if (pPDFInterForm->CheckRequiredFields()) { | 671 if (pPDFInterForm->CheckRequiredFields()) { |
| 677 pRuntime->BeginBlock(); | 672 pRuntime->BeginBlock(); |
| 678 pInterForm->SubmitForm(strURL, FALSE); | 673 pInterForm->SubmitForm(strURL, FALSE); |
| 679 pRuntime->EndBlock(); | 674 pRuntime->EndBlock(); |
| 680 } | 675 } |
| 681 return TRUE; | 676 return TRUE; |
| 682 } | 677 } |
| 683 | 678 |
| 684 CFX_PtrArray fieldObjects; | 679 CFX_PtrArray fieldObjects; |
| 685 for (int i = 0, sz = aFields.GetLength(); i < sz; i++) { | 680 for (int i = 0, sz = aFields.GetLength(); i < sz; i++) { |
| 686 CJS_Value valName(isolate); | 681 CJS_Value valName(pRuntime); |
| 687 aFields.GetElement(i, valName); | 682 aFields.GetElement(i, valName); |
| 688 | 683 |
| 689 CFX_WideString sName = valName.ToCFXWideString(); | 684 CFX_WideString sName = valName.ToCFXWideString(); |
| 690 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); | 685 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); |
| 691 for (int j = 0, jsz = pPDFForm->CountFields(sName); j < jsz; ++j) { | 686 for (int j = 0, jsz = pPDFForm->CountFields(sName); j < jsz; ++j) { |
| 692 CPDF_FormField* pField = pPDFForm->GetField(j, sName); | 687 CPDF_FormField* pField = pPDFForm->GetField(j, sName); |
| 693 if (!bEmpty && pField->GetValue().IsEmpty()) | 688 if (!bEmpty && pField->GetValue().IsEmpty()) |
| 694 continue; | 689 continue; |
| 695 | 690 |
| 696 fieldObjects.Add(pField); | 691 fieldObjects.Add(pField); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 728 FX_BOOL Document::bookmarkRoot(IJS_Context* cc, | 723 FX_BOOL Document::bookmarkRoot(IJS_Context* cc, |
| 729 CJS_PropValue& vp, | 724 CJS_PropValue& vp, |
| 730 CFX_WideString& sError) { | 725 CFX_WideString& sError) { |
| 731 return TRUE; | 726 return TRUE; |
| 732 } | 727 } |
| 733 | 728 |
| 734 FX_BOOL Document::mailDoc(IJS_Context* cc, | 729 FX_BOOL Document::mailDoc(IJS_Context* cc, |
| 735 const CJS_Parameters& params, | 730 const CJS_Parameters& params, |
| 736 CJS_Value& vRet, | 731 CJS_Value& vRet, |
| 737 CFX_WideString& sError) { | 732 CFX_WideString& sError) { |
| 738 ASSERT(m_pDocument != NULL); | |
| 739 | |
| 740 FX_BOOL bUI = TRUE; | 733 FX_BOOL bUI = TRUE; |
| 741 CFX_WideString cTo = L""; | 734 CFX_WideString cTo = L""; |
| 742 CFX_WideString cCc = L""; | 735 CFX_WideString cCc = L""; |
| 743 CFX_WideString cBcc = L""; | 736 CFX_WideString cBcc = L""; |
| 744 CFX_WideString cSubject = L""; | 737 CFX_WideString cSubject = L""; |
| 745 CFX_WideString cMsg = L""; | 738 CFX_WideString cMsg = L""; |
| 746 | 739 |
| 747 if (params.size() >= 1) | 740 if (params.size() >= 1) |
| 748 bUI = params[0].ToBool(); | 741 bUI = params[0].ToBool(); |
| 749 if (params.size() >= 2) | 742 if (params.size() >= 2) |
| 750 cTo = params[1].ToCFXWideString(); | 743 cTo = params[1].ToCFXWideString(); |
| 751 if (params.size() >= 3) | 744 if (params.size() >= 3) |
| 752 cCc = params[2].ToCFXWideString(); | 745 cCc = params[2].ToCFXWideString(); |
| 753 if (params.size() >= 4) | 746 if (params.size() >= 4) |
| 754 cBcc = params[3].ToCFXWideString(); | 747 cBcc = params[3].ToCFXWideString(); |
| 755 if (params.size() >= 5) | 748 if (params.size() >= 5) |
| 756 cSubject = params[4].ToCFXWideString(); | 749 cSubject = params[4].ToCFXWideString(); |
| 757 if (params.size() >= 6) | 750 if (params.size() >= 6) |
| 758 cMsg = params[5].ToCFXWideString(); | 751 cMsg = params[5].ToCFXWideString(); |
| 759 | 752 |
| 760 v8::Isolate* isolate = GetIsolate(cc); | 753 CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); |
| 754 v8::Isolate* isolate = pRuntime->GetIsolate(); | |
| 761 | 755 |
| 762 if (params.size() >= 1 && params[0].GetType() == CJS_Value::VT_object) { | 756 if (params.size() >= 1 && params[0].GetType() == CJS_Value::VT_object) { |
| 763 v8::Local<v8::Object> pObj = params[0].ToV8Object(); | 757 v8::Local<v8::Object> pObj = params[0].ToV8Object(); |
| 764 | 758 |
| 765 v8::Local<v8::Value> pValue = FXJS_GetObjectElement(isolate, pObj, L"bUI"); | 759 v8::Local<v8::Value> pValue = FXJS_GetObjectElement(isolate, pObj, L"bUI"); |
| 766 bUI = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToInt(); | 760 bUI = CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToInt(); |
| 767 | 761 |
| 768 pValue = FXJS_GetObjectElement(isolate, pObj, L"cTo"); | 762 pValue = FXJS_GetObjectElement(isolate, pObj, L"cTo"); |
| 769 cTo = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 763 cTo = CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 770 | 764 |
| 771 pValue = FXJS_GetObjectElement(isolate, pObj, L"cCc"); | 765 pValue = FXJS_GetObjectElement(isolate, pObj, L"cCc"); |
| 772 cCc = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 766 cCc = CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 773 | 767 |
| 774 pValue = FXJS_GetObjectElement(isolate, pObj, L"cBcc"); | 768 pValue = FXJS_GetObjectElement(isolate, pObj, L"cBcc"); |
| 775 cBcc = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 769 cBcc = |
| 770 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | |
| 776 | 771 |
| 777 pValue = FXJS_GetObjectElement(isolate, pObj, L"cSubject"); | 772 pValue = FXJS_GetObjectElement(isolate, pObj, L"cSubject"); |
| 778 cSubject = | 773 cSubject = |
| 779 CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 774 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); |
| 780 | 775 |
| 781 pValue = FXJS_GetObjectElement(isolate, pObj, L"cMsg"); | 776 pValue = FXJS_GetObjectElement(isolate, pObj, L"cMsg"); |
| 782 cMsg = CJS_Value(isolate, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | 777 cMsg = |
| 778 CJS_Value(pRuntime, pValue, GET_VALUE_TYPE(pValue)).ToCFXWideString(); | |
| 783 } | 779 } |
| 784 | 780 |
| 785 CJS_Context* pContext = (CJS_Context*)cc; | |
| 786 ASSERT(pContext != NULL); | |
| 787 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | |
| 788 ASSERT(pRuntime != NULL); | |
| 789 | |
| 790 pRuntime->BeginBlock(); | 781 pRuntime->BeginBlock(); |
| 791 CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp(); | 782 CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp(); |
| 792 pEnv->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), | 783 pEnv->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), |
| 793 cBcc.c_str(), cMsg.c_str()); | 784 cBcc.c_str(), cMsg.c_str()); |
| 794 pRuntime->EndBlock(); | 785 pRuntime->EndBlock(); |
| 795 | 786 |
| 796 return TRUE; | 787 return TRUE; |
| 797 } | 788 } |
| 798 | 789 |
| 799 FX_BOOL Document::author(IJS_Context* cc, | 790 FX_BOOL Document::author(IJS_Context* cc, |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1386 pNewIcon->NextIcon = NULL; | 1377 pNewIcon->NextIcon = NULL; |
| 1387 pNewIcon->IconStream = pIcon; | 1378 pNewIcon->IconStream = pIcon; |
| 1388 m_pIconTree->InsertIconElement(pNewIcon); | 1379 m_pIconTree->InsertIconElement(pNewIcon); |
| 1389 return TRUE; | 1380 return TRUE; |
| 1390 } | 1381 } |
| 1391 | 1382 |
| 1392 FX_BOOL Document::icons(IJS_Context* cc, | 1383 FX_BOOL Document::icons(IJS_Context* cc, |
| 1393 CJS_PropValue& vp, | 1384 CJS_PropValue& vp, |
| 1394 CFX_WideString& sError) { | 1385 CFX_WideString& sError) { |
| 1395 if (vp.IsSetting()) { | 1386 if (vp.IsSetting()) { |
| 1396 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1387 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
|
Lei Zhang
2015/10/08 05:40:51
Just move this 1 level up and remove the same var
| |
| 1397 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1388 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
| 1398 return FALSE; | 1389 return FALSE; |
| 1399 } | 1390 } |
| 1400 | 1391 |
| 1401 if (!m_pIconTree) { | 1392 if (!m_pIconTree) { |
| 1402 vp.SetNull(); | 1393 vp.SetNull(); |
| 1403 return TRUE; | 1394 return TRUE; |
| 1404 } | 1395 } |
| 1405 | 1396 |
| 1406 CJS_Array Icons(m_isolate); | 1397 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
| 1398 CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); | |
| 1399 CJS_Array Icons(pRuntime); | |
| 1407 IconElement* pIconElement = NULL; | 1400 IconElement* pIconElement = NULL; |
| 1408 int iIconTreeLength = m_pIconTree->GetLength(); | 1401 int iIconTreeLength = m_pIconTree->GetLength(); |
| 1409 | |
| 1410 CJS_Context* pContext = (CJS_Context*)cc; | |
| 1411 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | |
| 1412 | |
| 1413 for (int i = 0; i < iIconTreeLength; i++) { | 1402 for (int i = 0; i < iIconTreeLength; i++) { |
| 1414 pIconElement = (*m_pIconTree)[i]; | 1403 pIconElement = (*m_pIconTree)[i]; |
| 1415 | 1404 |
| 1416 v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj( | 1405 v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj( |
| 1417 pRuntime->GetIsolate(), pContext, CJS_Icon::g_nObjDefnID); | 1406 pRuntime->GetIsolate(), pContext, CJS_Icon::g_nObjDefnID); |
| 1418 if (pObj.IsEmpty()) | 1407 if (pObj.IsEmpty()) |
| 1419 return FALSE; | 1408 return FALSE; |
| 1420 | 1409 |
| 1421 CJS_Icon* pJS_Icon = (CJS_Icon*)FXJS_GetPrivate(m_isolate, pObj); | 1410 CJS_Icon* pJS_Icon = (CJS_Icon*)FXJS_GetPrivate(m_isolate, pObj); |
| 1422 if (!pJS_Icon) | 1411 if (!pJS_Icon) |
| 1423 return FALSE; | 1412 return FALSE; |
| 1424 | 1413 |
| 1425 Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject(); | 1414 Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject(); |
| 1426 if (!pIcon) | 1415 if (!pIcon) |
| 1427 return FALSE; | 1416 return FALSE; |
| 1428 | 1417 |
| 1429 pIcon->SetStream(pIconElement->IconStream->GetStream()); | 1418 pIcon->SetStream(pIconElement->IconStream->GetStream()); |
| 1430 pIcon->SetIconName(pIconElement->IconName); | 1419 pIcon->SetIconName(pIconElement->IconName); |
| 1431 Icons.SetElement(i, CJS_Value(m_isolate, pJS_Icon)); | 1420 Icons.SetElement(i, CJS_Value(pRuntime, pJS_Icon)); |
| 1432 } | 1421 } |
| 1433 | 1422 |
| 1434 vp << Icons; | 1423 vp << Icons; |
| 1435 return TRUE; | 1424 return TRUE; |
| 1436 } | 1425 } |
| 1437 | 1426 |
| 1438 FX_BOOL Document::getIcon(IJS_Context* cc, | 1427 FX_BOOL Document::getIcon(IJS_Context* cc, |
| 1439 const CJS_Parameters& params, | 1428 const CJS_Parameters& params, |
| 1440 CJS_Value& vRet, | 1429 CJS_Value& vRet, |
| 1441 CFX_WideString& sError) { | 1430 CFX_WideString& sError) { |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1838 CFX_DWordArray DelArray; | 1827 CFX_DWordArray DelArray; |
| 1839 | 1828 |
| 1840 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { | 1829 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { |
| 1841 m_DelayData.RemoveAt(DelArray[j]); | 1830 m_DelayData.RemoveAt(DelArray[j]); |
| 1842 } | 1831 } |
| 1843 } | 1832 } |
| 1844 | 1833 |
| 1845 CJS_Document* Document::GetCJSDoc() const { | 1834 CJS_Document* Document::GetCJSDoc() const { |
| 1846 return static_cast<CJS_Document*>(m_pJSObject); | 1835 return static_cast<CJS_Document*>(m_pJSObject); |
| 1847 } | 1836 } |
| OLD | NEW |