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 "fpdfsdk/include/fsdk_mgr.h" | 7 #include "fpdfsdk/include/fsdk_mgr.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 898 CPDF_InterForm::EnableUpdateAP(enableAPUpdate); | 898 CPDF_InterForm::EnableUpdateAP(enableAPUpdate); |
| 899 const size_t nCount = m_pAnnotList->Count(); | 899 const size_t nCount = m_pAnnotList->Count(); |
| 900 #endif // PDF_ENABLE_XFA | 900 #endif // PDF_ENABLE_XFA |
| 901 | 901 |
| 902 SetLock(TRUE); | 902 SetLock(TRUE); |
| 903 | 903 |
| 904 #ifdef PDF_ENABLE_XFA | 904 #ifdef PDF_ENABLE_XFA |
| 905 m_page->AddRef(); | 905 m_page->AddRef(); |
| 906 if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { | 906 if (m_pSDKDoc->GetXFADocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { |
| 907 CXFA_FFPageView* pageView = m_page->GetXFAPageView(); | 907 CXFA_FFPageView* pageView = m_page->GetXFAPageView(); |
| 908 IXFA_WidgetIterator* pWidgetHander = pageView->CreateWidgetIterator( | 908 std::unique_ptr<IXFA_WidgetIterator> pWidgetHander( |
| 909 XFA_TRAVERSEWAY_Form, XFA_WIDGETFILTER_Visible | | 909 pageView->CreateWidgetIterator(XFA_TRAVERSEWAY_Form, |
| 910 XFA_WIDGETFILTER_Viewable | | 910 XFA_WIDGETFILTER_Visible | |
| 911 XFA_WIDGETFILTER_AllType); | 911 XFA_WIDGETFILTER_Viewable | |
| 912 XFA_WIDGETFILTER_AllType)); | |
| 912 if (!pWidgetHander) { | 913 if (!pWidgetHander) { |
| 913 m_page->Release(); | |
|
Lei Zhang
2016/05/14 00:43:53
Isn't this still needed to balance out line 905?
Tom Sepez
2016/05/16 16:15:58
Acknowledged. Done.
| |
| 914 SetLock(FALSE); | 914 SetLock(FALSE); |
| 915 return; | 915 return; |
| 916 } | 916 } |
| 917 | 917 |
| 918 while (CXFA_FFWidget* pXFAAnnot = pWidgetHander->MoveToNext()) { | 918 while (CXFA_FFWidget* pXFAAnnot = pWidgetHander->MoveToNext()) { |
| 919 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pXFAAnnot, this); | 919 CPDFSDK_Annot* pAnnot = pAnnotHandlerMgr->NewAnnot(pXFAAnnot, this); |
| 920 if (!pAnnot) | 920 if (!pAnnot) |
| 921 continue; | 921 continue; |
| 922 | |
| 923 m_fxAnnotArray.push_back(pAnnot); | 922 m_fxAnnotArray.push_back(pAnnot); |
| 924 pAnnotHandlerMgr->Annot_OnLoad(pAnnot); | 923 pAnnotHandlerMgr->Annot_OnLoad(pAnnot); |
| 925 } | 924 } |
| 926 pWidgetHander->Release(); | |
| 927 } else { | 925 } else { |
| 928 CPDF_Page* pPage = m_page->GetPDFPage(); | 926 CPDF_Page* pPage = m_page->GetPDFPage(); |
| 929 ASSERT(pPage); | 927 ASSERT(pPage); |
| 930 FX_BOOL enableAPUpdate = CPDF_InterForm::UpdatingAPEnabled(); | 928 FX_BOOL enableAPUpdate = CPDF_InterForm::UpdatingAPEnabled(); |
| 931 // Disable the default AP construction. | 929 // Disable the default AP construction. |
| 932 CPDF_InterForm::EnableUpdateAP(FALSE); | 930 CPDF_InterForm::EnableUpdateAP(FALSE); |
| 933 m_pAnnotList.reset(new CPDF_AnnotList(pPage)); | 931 m_pAnnotList.reset(new CPDF_AnnotList(pPage)); |
| 934 CPDF_InterForm::EnableUpdateAP(enableAPUpdate); | 932 CPDF_InterForm::EnableUpdateAP(enableAPUpdate); |
| 935 | 933 |
| 936 const size_t nCount = m_pAnnotList->Count(); | 934 const size_t nCount = m_pAnnotList->Count(); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1015 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); | 1013 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); |
| 1016 if (!pFocusAnnot) | 1014 if (!pFocusAnnot) |
| 1017 return nullptr; | 1015 return nullptr; |
| 1018 | 1016 |
| 1019 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { | 1017 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { |
| 1020 if (pAnnot == pFocusAnnot) | 1018 if (pAnnot == pFocusAnnot) |
| 1021 return pAnnot; | 1019 return pAnnot; |
| 1022 } | 1020 } |
| 1023 return nullptr; | 1021 return nullptr; |
| 1024 } | 1022 } |
| OLD | NEW |