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 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 cwCreationDate.c_str()); | 843 cwCreationDate.c_str()); |
844 FXJS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str()); | 844 FXJS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str()); |
845 FXJS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str()); | 845 FXJS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str()); |
846 | 846 |
847 // It's to be compatible to non-standard info dictionary. | 847 // It's to be compatible to non-standard info dictionary. |
848 FX_POSITION pos = pDictionary->GetStartPos(); | 848 FX_POSITION pos = pDictionary->GetStartPos(); |
849 while (pos) { | 849 while (pos) { |
850 CFX_ByteString bsKey; | 850 CFX_ByteString bsKey; |
851 CPDF_Object* pValueObj = pDictionary->GetNextElement(pos, bsKey); | 851 CPDF_Object* pValueObj = pDictionary->GetNextElement(pos, bsKey); |
852 CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey, bsKey.GetLength()); | 852 CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey, bsKey.GetLength()); |
853 if (pValueObj->IsString() || (pValueObj->GetType() == PDFOBJ_NAME)) { | 853 |
| 854 if (pValueObj->IsString() || pValueObj->IsName()) { |
854 FXJS_PutObjectString(isolate, pObj, wsKey.c_str(), | 855 FXJS_PutObjectString(isolate, pObj, wsKey.c_str(), |
855 pValueObj->GetUnicodeText().c_str()); | 856 pValueObj->GetUnicodeText().c_str()); |
856 } | 857 } else if (pValueObj->IsNumber()) { |
857 | |
858 if (pValueObj->IsNumber()) { | |
859 FXJS_PutObjectNumber(isolate, pObj, wsKey.c_str(), | 858 FXJS_PutObjectNumber(isolate, pObj, wsKey.c_str(), |
860 (float)pValueObj->GetNumber()); | 859 (float)pValueObj->GetNumber()); |
861 } | 860 } else if (pValueObj->IsBoolean()) { |
862 | |
863 if (pValueObj->IsBoolean()) { | |
864 FXJS_PutObjectBoolean(isolate, pObj, wsKey.c_str(), | 861 FXJS_PutObjectBoolean(isolate, pObj, wsKey.c_str(), |
865 (bool)pValueObj->GetInteger()); | 862 (bool)pValueObj->GetInteger()); |
866 } | 863 } |
867 } | 864 } |
868 vp << pObj; | 865 vp << pObj; |
869 } | 866 } |
870 return TRUE; | 867 return TRUE; |
871 } | 868 } |
872 | 869 |
873 FX_BOOL Document::creationDate(IJS_Context* cc, | 870 FX_BOOL Document::creationDate(IJS_Context* cc, |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1834 CFX_DWordArray DelArray; | 1831 CFX_DWordArray DelArray; |
1835 | 1832 |
1836 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { | 1833 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { |
1837 m_DelayData.RemoveAt(DelArray[j]); | 1834 m_DelayData.RemoveAt(DelArray[j]); |
1838 } | 1835 } |
1839 } | 1836 } |
1840 | 1837 |
1841 CJS_Document* Document::GetCJSDoc() const { | 1838 CJS_Document* Document::GetCJSDoc() const { |
1842 return static_cast<CJS_Document*>(m_pJSObject); | 1839 return static_cast<CJS_Document*>(m_pJSObject); |
1843 } | 1840 } |
OLD | NEW |