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 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 841 cwCreationDate.c_str()); | 841 cwCreationDate.c_str()); |
| 842 FXJS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str()); | 842 FXJS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str()); |
| 843 FXJS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str()); | 843 FXJS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str()); |
| 844 | 844 |
| 845 // It's to be compatible to non-standard info dictionary. | 845 // It's to be compatible to non-standard info dictionary. |
| 846 FX_POSITION pos = pDictionary->GetStartPos(); | 846 FX_POSITION pos = pDictionary->GetStartPos(); |
| 847 while (pos) { | 847 while (pos) { |
| 848 CFX_ByteString bsKey; | 848 CFX_ByteString bsKey; |
| 849 CPDF_Object* pValueObj = pDictionary->GetNextElement(pos, bsKey); | 849 CPDF_Object* pValueObj = pDictionary->GetNextElement(pos, bsKey); |
| 850 CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey, bsKey.GetLength()); | 850 CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey, bsKey.GetLength()); |
| 851 if ((pValueObj->GetType() == PDFOBJ_STRING) || | 851 if (pValueObj->IsString() || (pValueObj->GetType() == PDFOBJ_NAME)) { |
| 852 (pValueObj->GetType() == PDFOBJ_NAME)) | |
| 853 FXJS_PutObjectString(isolate, pObj, wsKey.c_str(), | 852 FXJS_PutObjectString(isolate, pObj, wsKey.c_str(), |
| 854 pValueObj->GetUnicodeText().c_str()); | 853 pValueObj->GetUnicodeText().c_str()); |
| 854 } | |
| 855 | |
| 855 if (pValueObj->IsNumber()) { | 856 if (pValueObj->IsNumber()) { |
|
Tom Sepez
2015/10/21 17:12:50
nit: probably else if since it can't be both a num
dsinclair
2015/10/21 17:40:01
Done.
| |
| 856 FXJS_PutObjectNumber(isolate, pObj, wsKey.c_str(), | 857 FXJS_PutObjectNumber(isolate, pObj, wsKey.c_str(), |
| 857 (float)pValueObj->GetNumber()); | 858 (float)pValueObj->GetNumber()); |
| 858 } | 859 } |
| 860 | |
| 859 if (pValueObj->IsBoolean()) { | 861 if (pValueObj->IsBoolean()) { |
| 860 FXJS_PutObjectBoolean(isolate, pObj, wsKey.c_str(), | 862 FXJS_PutObjectBoolean(isolate, pObj, wsKey.c_str(), |
| 861 (bool)pValueObj->GetInteger()); | 863 (bool)pValueObj->GetInteger()); |
| 862 } | 864 } |
| 863 } | 865 } |
| 864 vp << pObj; | 866 vp << pObj; |
| 865 } | 867 } |
| 866 return TRUE; | 868 return TRUE; |
| 867 } | 869 } |
| 868 | 870 |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1823 CFX_DWordArray DelArray; | 1825 CFX_DWordArray DelArray; |
| 1824 | 1826 |
| 1825 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { | 1827 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { |
| 1826 m_DelayData.RemoveAt(DelArray[j]); | 1828 m_DelayData.RemoveAt(DelArray[j]); |
| 1827 } | 1829 } |
| 1828 } | 1830 } |
| 1829 | 1831 |
| 1830 CJS_Document* Document::GetCJSDoc() const { | 1832 CJS_Document* Document::GetCJSDoc() const { |
| 1831 return static_cast<CJS_Document*>(m_pJSObject); | 1833 return static_cast<CJS_Document*>(m_pJSObject); |
| 1832 } | 1834 } |
| OLD | NEW |