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

Side by Side Diff: fpdfsdk/src/fsdk_baseform.cpp

Issue 1389163007: Pass IJS_Runtime, not IJS_Context, to native object constructors. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits, no pass-by-non-const-ref Created 5 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 "../../third_party/base/nonstd_unique_ptr.h" 7 #include "../../third_party/base/nonstd_unique_ptr.h"
8 #include "../include/fsdk_define.h" 8 #include "../include/fsdk_define.h"
9 #include "../include/fsdk_mgr.h" 9 #include "../include/fsdk_mgr.h"
10 #include "../include/fsdk_baseannot.h" 10 #include "../include/fsdk_baseannot.h"
(...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 if (!csJS.IsEmpty()) { 1777 if (!csJS.IsEmpty()) {
1778 IJS_Context* pContext = pRuntime->NewContext(); 1778 IJS_Context* pContext = pRuntime->NewContext();
1779 ASSERT(pContext != NULL); 1779 ASSERT(pContext != NULL);
1780 1780
1781 CFX_WideString sOldValue = pField->GetValue(); 1781 CFX_WideString sOldValue = pField->GetValue();
1782 CFX_WideString sValue = sOldValue; 1782 CFX_WideString sValue = sOldValue;
1783 FX_BOOL bRC = TRUE; 1783 FX_BOOL bRC = TRUE;
1784 pContext->OnField_Calculate(pFormField, pField, sValue, bRC); 1784 pContext->OnField_Calculate(pFormField, pField, sValue, bRC);
1785 1785
1786 CFX_WideString sInfo; 1786 CFX_WideString sInfo;
1787 FX_BOOL bRet = pContext->RunScript(csJS, sInfo); 1787 FX_BOOL bRet = pContext->RunScript(csJS, &sInfo);
1788 pRuntime->ReleaseContext(pContext); 1788 pRuntime->ReleaseContext(pContext);
1789 1789
1790 if (bRet) { 1790 if (bRet) {
1791 if (bRC) { 1791 if (bRC) {
1792 if (sValue.Compare(sOldValue) != 0) 1792 if (sValue.Compare(sOldValue) != 0)
1793 pField->SetValue(sValue, TRUE); 1793 pField->SetValue(sValue, TRUE);
1794 } 1794 }
1795 } 1795 }
1796 } 1796 }
1797 } 1797 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 CFX_WideString script = action.GetJavaScript(); 1839 CFX_WideString script = action.GetJavaScript();
1840 if (!script.IsEmpty()) { 1840 if (!script.IsEmpty()) {
1841 CFX_WideString Value = sValue; 1841 CFX_WideString Value = sValue;
1842 1842
1843 IJS_Context* pContext = pRuntime->NewContext(); 1843 IJS_Context* pContext = pRuntime->NewContext();
1844 ASSERT(pContext != NULL); 1844 ASSERT(pContext != NULL);
1845 1845
1846 pContext->OnField_Format(pFormField, Value, TRUE); 1846 pContext->OnField_Format(pFormField, Value, TRUE);
1847 1847
1848 CFX_WideString sInfo; 1848 CFX_WideString sInfo;
1849 FX_BOOL bRet = pContext->RunScript(script, sInfo); 1849 FX_BOOL bRet = pContext->RunScript(script, &sInfo);
1850 pRuntime->ReleaseContext(pContext); 1850 pRuntime->ReleaseContext(pContext);
1851 1851
1852 if (bRet) { 1852 if (bRet) {
1853 sValue = Value; 1853 sValue = Value;
1854 bFormated = TRUE; 1854 bFormated = TRUE;
1855 } 1855 }
1856 } 1856 }
1857 } 1857 }
1858 } 1858 }
1859 1859
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
2657 ASSERT(pAnnot != NULL); 2657 ASSERT(pAnnot != NULL);
2658 2658
2659 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); 2659 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
2660 ASSERT(pPDFAnnot != NULL); 2660 ASSERT(pPDFAnnot != NULL);
2661 2661
2662 CPDF_Rect rcAnnot; 2662 CPDF_Rect rcAnnot;
2663 pPDFAnnot->GetRect(rcAnnot); 2663 pPDFAnnot->GetRect(rcAnnot);
2664 2664
2665 return rcAnnot; 2665 return rcAnnot;
2666 } 2666 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698