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

Side by Side Diff: fpdfsdk/fpdfformfill.cpp

Issue 2179163004: Reland of Remove pageview from map immediately (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: FX_BOOL to bool Created 4 years, 4 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
« no previous file with comments | « fpdfsdk/formfiller/cffl_textfield.cpp ('k') | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "public/fpdf_formfill.h" 7 #include "public/fpdf_formfill.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 23 matching lines...) Expand all
34 return pSDKDoc ? pSDKDoc->GetInterForm() : nullptr; 34 return pSDKDoc ? pSDKDoc->GetInterForm() : nullptr;
35 } 35 }
36 36
37 CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle, 37 CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle,
38 FPDF_PAGE page) { 38 FPDF_PAGE page) {
39 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); 39 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
40 if (!pPage) 40 if (!pPage)
41 return nullptr; 41 return nullptr;
42 42
43 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); 43 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle);
44 return pSDKDoc ? pSDKDoc->GetPageView(pPage, TRUE) : nullptr; 44 return pSDKDoc ? pSDKDoc->GetPageView(pPage, true) : nullptr;
45 } 45 }
46 46
47 #ifdef PDF_ENABLE_XFA 47 #ifdef PDF_ENABLE_XFA
48 std::vector<CFX_ByteString>* FromFPDFStringHandle(FPDF_STRINGHANDLE handle) { 48 std::vector<CFX_ByteString>* FromFPDFStringHandle(FPDF_STRINGHANDLE handle) {
49 return reinterpret_cast<std::vector<CFX_ByteString>*>(handle); 49 return reinterpret_cast<std::vector<CFX_ByteString>*>(handle);
50 } 50 }
51 51
52 FPDF_STRINGHANDLE ToFPDFStringHandle(std::vector<CFX_ByteString>* strings) { 52 FPDF_STRINGHANDLE ToFPDFStringHandle(std::vector<CFX_ByteString>* strings) {
53 return reinterpret_cast<FPDF_STRINGHANDLE>(strings); 53 return reinterpret_cast<FPDF_STRINGHANDLE>(strings);
54 } 54 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 // Grayscale output 125 // Grayscale output
126 if (flags & FPDF_GRAYSCALE) { 126 if (flags & FPDF_GRAYSCALE) {
127 options.m_ColorMode = RENDER_COLOR_GRAY; 127 options.m_ColorMode = RENDER_COLOR_GRAY;
128 options.m_ForeColor = 0; 128 options.m_ForeColor = 0;
129 options.m_BackColor = 0xffffff; 129 options.m_BackColor = 0xffffff;
130 } 130 }
131 options.m_AddFlags = flags >> 8; 131 options.m_AddFlags = flags >> 8;
132 options.m_pOCContext = new CPDF_OCContext(pPDFDoc, CPDF_OCContext::View); 132 options.m_pOCContext = new CPDF_OCContext(pPDFDoc, CPDF_OCContext::View);
133 133
134 if (CPDFSDK_PageView* pPageView = pFXDoc->GetPageView(pPage)) 134 if (CPDFSDK_PageView* pPageView = pFXDoc->GetPageView(pPage, true))
135 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip); 135 pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip);
136 #endif // PDF_ENABLE_XFA 136 #endif // PDF_ENABLE_XFA
137 137
138 pDevice->RestoreState(false); 138 pDevice->RestoreState(false);
139 delete options.m_pOCContext; 139 delete options.m_pOCContext;
140 #ifdef PDF_ENABLE_XFA 140 #ifdef PDF_ENABLE_XFA
141 options.m_pOCContext = nullptr; 141 options.m_pOCContext = nullptr;
142 #endif // PDF_ENABLE_XFA 142 #endif // PDF_ENABLE_XFA
143 } 143 }
144 144
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 return; 648 return;
649 649
650 CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetSDKDocument(); 650 CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetSDKDocument();
651 if (!pSDKDoc) 651 if (!pSDKDoc)
652 return; 652 return;
653 653
654 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); 654 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
655 if (!pPage) 655 if (!pPage)
656 return; 656 return;
657 657
658 CPDFSDK_PageView* pPageView = pSDKDoc->GetPageView(pPage, FALSE); 658 CPDFSDK_PageView* pPageView = pSDKDoc->GetPageView(pPage, false);
659 if (pPageView) { 659 if (pPageView) {
660 pPageView->SetValid(FALSE); 660 pPageView->SetValid(FALSE);
661 // RemovePageView() takes care of the delete for us. 661 // RemovePageView() takes care of the delete for us.
662 pSDKDoc->RemovePageView(pPage); 662 pSDKDoc->RemovePageView(pPage);
663 } 663 }
664 } 664 }
665 665
666 DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle) { 666 DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle) {
667 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle); 667 CPDFSDK_Document* pSDKDoc = CPDFSDK_Document::FromFPDFFormHandle(hHandle);
668 if (pSDKDoc && ((CPDFDoc_Environment*)hHandle)->IsJSInitiated()) 668 if (pSDKDoc && ((CPDFDoc_Environment*)hHandle)->IsJSInitiated())
(...skipping 30 matching lines...) Expand all
699 DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, 699 DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page,
700 FPDF_FORMHANDLE hHandle, 700 FPDF_FORMHANDLE hHandle,
701 int aaType) { 701 int aaType) {
702 if (!hHandle) 702 if (!hHandle)
703 return; 703 return;
704 CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetSDKDocument(); 704 CPDFSDK_Document* pSDKDoc = ((CPDFDoc_Environment*)hHandle)->GetSDKDocument();
705 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page); 705 UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
706 CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page); 706 CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page);
707 if (!pPDFPage) 707 if (!pPDFPage)
708 return; 708 return;
709 if (pSDKDoc->GetPageView(pPage, FALSE)) { 709 if (pSDKDoc->GetPageView(pPage, false)) {
710 CPDFDoc_Environment* pEnv = pSDKDoc->GetEnv(); 710 CPDFDoc_Environment* pEnv = pSDKDoc->GetEnv();
711 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); 711 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander();
712 CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict; 712 CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict;
713 CPDF_AAction aa(pPageDict->GetDictBy("AA")); 713 CPDF_AAction aa(pPageDict->GetDictBy("AA"));
714 if (FPDFPAGE_AACTION_OPEN == aaType) { 714 if (FPDFPAGE_AACTION_OPEN == aaType) {
715 if (aa.ActionExist(CPDF_AAction::OpenPage)) { 715 if (aa.ActionExist(CPDF_AAction::OpenPage)) {
716 CPDF_Action action = aa.GetAction(CPDF_AAction::OpenPage); 716 CPDF_Action action = aa.GetAction(CPDF_AAction::OpenPage);
717 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc); 717 pActionHandler->DoAction_Page(action, CPDF_AAction::OpenPage, pSDKDoc);
718 } 718 }
719 } else { 719 } else {
720 if (aa.ActionExist(CPDF_AAction::ClosePage)) { 720 if (aa.ActionExist(CPDF_AAction::ClosePage)) {
721 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); 721 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage);
722 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); 722 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc);
723 } 723 }
724 } 724 }
725 } 725 }
726 } 726 }
OLDNEW
« no previous file with comments | « fpdfsdk/formfiller/cffl_textfield.cpp ('k') | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698