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 "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 8 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 8 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 } | 152 } |
| 153 | 153 |
| 154 CPDFXFA_Page* CPDFXFA_Document::GetPage(int page_index) { | 154 CPDFXFA_Page* CPDFXFA_Document::GetPage(int page_index) { |
| 155 if (page_index < 0) | 155 if (page_index < 0) |
| 156 return nullptr; | 156 return nullptr; |
| 157 CPDFXFA_Page* pPage = nullptr; | 157 CPDFXFA_Page* pPage = nullptr; |
| 158 int nCount = m_XFAPageList.GetSize(); | 158 int nCount = m_XFAPageList.GetSize(); |
| 159 if (nCount > 0 && page_index < nCount) { | 159 if (nCount > 0 && page_index < nCount) { |
| 160 pPage = m_XFAPageList.GetAt(page_index); | 160 pPage = m_XFAPageList.GetAt(page_index); |
| 161 if (pPage) | 161 if (pPage) |
| 162 pPage->AddRef(); | 162 pPage->AddRef(); |
|
Tom Sepez
2016/04/12 23:40:00
nit: pity this isn't called Retain(), then we coul
Lei Zhang
2016/04/13 00:56:52
Ya, but that's another rabbit hole and I'm not goi
| |
| 163 } else { | 163 } else { |
| 164 m_nPageCount = GetPageCount(); | 164 m_nPageCount = GetPageCount(); |
| 165 m_XFAPageList.SetSize(m_nPageCount); | 165 m_XFAPageList.SetSize(m_nPageCount); |
| 166 } | 166 } |
| 167 if (pPage) | 167 if (pPage) |
| 168 return pPage; | 168 return pPage; |
| 169 pPage = new CPDFXFA_Page(this, page_index); | 169 pPage = new CPDFXFA_Page(this, page_index); |
| 170 if (!pPage->LoadPage()) { | 170 if (!pPage->LoadPage()) { |
| 171 delete pPage; | 171 pPage->Release(); |
| 172 return nullptr; | 172 return nullptr; |
| 173 } | 173 } |
| 174 m_XFAPageList.SetAt(page_index, pPage); | 174 m_XFAPageList.SetAt(page_index, pPage); |
| 175 return pPage; | 175 return pPage; |
| 176 } | 176 } |
| 177 | 177 |
| 178 CPDFXFA_Page* CPDFXFA_Document::GetPage(CXFA_FFPageView* pPage) { | 178 CPDFXFA_Page* CPDFXFA_Document::GetPage(CXFA_FFPageView* pPage) { |
| 179 if (!pPage) | 179 if (!pPage) |
| 180 return NULL; | 180 return NULL; |
| 181 | 181 |
| (...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1272 } | 1272 } |
| 1273 | 1273 |
| 1274 return _GetHValueByName(szPropName, hValue, | 1274 return _GetHValueByName(szPropName, hValue, |
| 1275 m_pSDKDoc->GetEnv()->GetJSRuntime()); | 1275 m_pSDKDoc->GetEnv()->GetJSRuntime()); |
| 1276 } | 1276 } |
| 1277 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, | 1277 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, |
| 1278 FXJSE_HVALUE hValue, | 1278 FXJSE_HVALUE hValue, |
| 1279 IJS_Runtime* runTime) { | 1279 IJS_Runtime* runTime) { |
| 1280 return runTime->GetHValueByName(utf8Name, hValue); | 1280 return runTime->GetHValueByName(utf8Name, hValue); |
| 1281 } | 1281 } |
| OLD | NEW |