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

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

Issue 1244023004: Merge to XFA: document.delay and document.external are boolean properties. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: whitespace Created 5 years, 5 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 "../../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_Define.h" 9 #include "../../include/javascript/JS_Define.h"
10 #include "../../include/javascript/JS_Object.h" 10 #include "../../include/javascript/JS_Object.h"
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 } 936 }
937 937
938 FX_BOOL Document::delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror) 938 FX_BOOL Document::delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE rror)
939 { 939 {
940 if (vp.IsGetting()) 940 if (vp.IsGetting())
941 { 941 {
942 vp << m_bDelay; 942 vp << m_bDelay;
943 } 943 }
944 else 944 else
945 { 945 {
946 » » ASSERT(m_pDocument != NULL); 946 » » if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY))
947 j» » » return FALSE;
947 948
948 » » if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; 949 » » vp >> m_bDelay;
949
950 » » bool b;
951 » » vp >> b;
952
953 » » m_bDelay = b;
954
955 if (m_bDelay) 950 if (m_bDelay)
956 { 951 {
957 for (int i=0,sz=m_DelayData.GetSize(); i<sz; i++) 952 for (int i=0,sz=m_DelayData.GetSize(); i<sz; i++)
958 delete m_DelayData.GetAt(i); 953 delete m_DelayData.GetAt(i);
959 954
960 m_DelayData.RemoveAll(); 955 m_DelayData.RemoveAll();
961 } 956 }
962 else 957 else
963 { 958 {
964 for (int i=0,sz=m_DelayData.GetSize(); i<sz; i++) 959 for (int i=0,sz=m_DelayData.GetSize(); i<sz; i++)
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 return FALSE; 1097 return FALSE;
1103 } 1098 }
1104 vp << m_pDocument->GetPageCount(); 1099 vp << m_pDocument->GetPageCount();
1105 return TRUE; 1100 return TRUE;
1106 } 1101 }
1107 1102
1108 FX_BOOL Document::external(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) 1103 FX_BOOL Document::external(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
1109 { 1104 {
1110 //In Chrome case,should always return true. 1105 //In Chrome case,should always return true.
1111 if (vp.IsGetting()) { 1106 if (vp.IsGetting()) {
1112 vp << TRUE; 1107 vp << true;
1113 } 1108 }
1114 return TRUE; 1109 return TRUE;
1115 } 1110 }
1116 1111
1117 FX_BOOL Document::filesize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) 1112 FX_BOOL Document::filesize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
1118 { 1113 {
1119 if (vp.IsSetting()) { 1114 if (vp.IsSetting()) {
1120 CJS_Context* pContext = static_cast<CJS_Context*>(cc); 1115 CJS_Context* pContext = static_cast<CJS_Context*>(cc);
1121 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); 1116 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY);
1122 return FALSE; 1117 return FALSE;
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 for (int j=DelArray.GetSize()-1; j>=0; j--) 1917 for (int j=DelArray.GetSize()-1; j>=0; j--)
1923 { 1918 {
1924 m_DelayData.RemoveAt(DelArray[j]); 1919 m_DelayData.RemoveAt(DelArray[j]);
1925 } 1920 }
1926 } 1921 }
1927 1922
1928 CJS_Document* Document::GetCJSDoc() const 1923 CJS_Document* Document::GetCJSDoc() const
1929 { 1924 {
1930 return static_cast<CJS_Document*>(m_pJSObject); 1925 return static_cast<CJS_Document*>(m_pJSObject);
1931 } 1926 }
OLDNEW
« no previous file with comments | « fpdfsdk/include/javascript/Document.h ('k') | testing/resources/javascript/document_props_expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698