summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-22 15:29:20 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-22 19:56:04 +0000
commit3d06022ce5e7467c2ee12da97a2492b5be23885e (patch)
tree6b010d1fe11e3b12b94c45fb122e6f366e15df9d /xfa/fxfa/app
parent70e23c828033ad6abcd0bf9096cc7d6a92d53464 (diff)
downloadpdfium-3d06022ce5e7467c2ee12da97a2492b5be23885e.tar.xz
Remove unused docview flag
When creating the XFA doc view we always pass the same docview flag (0). So, the map will only ever have one item in it. This Cl simplifies the code by removing the map and just dealing with a single doc view. Change-Id: If17e2cda4c3f6c1f45dec921844f09538cc890fc Reviewed-on: https://pdfium-review.googlesource.com/3149 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r--xfa/fxfa/app/xfa_ffdoc.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp
index b6dba7f71a..22450a74fe 100644
--- a/xfa/fxfa/app/xfa_ffdoc.cpp
+++ b/xfa/fxfa/app/xfa_ffdoc.cpp
@@ -270,30 +270,27 @@ void CXFA_FFDoc::StopLoad() {
}
}
-CXFA_FFDocView* CXFA_FFDoc::CreateDocView(uint32_t dwView) {
- if (!m_TypeToDocViewMap[dwView])
- m_TypeToDocViewMap[dwView] = pdfium::MakeUnique<CXFA_FFDocView>(this);
+CXFA_FFDocView* CXFA_FFDoc::CreateDocView() {
+ if (!m_DocView)
+ m_DocView = pdfium::MakeUnique<CXFA_FFDocView>(this);
- return m_TypeToDocViewMap[dwView].get();
+ return m_DocView.get();
}
CXFA_FFDocView* CXFA_FFDoc::GetDocView(CXFA_LayoutProcessor* pLayout) {
- for (const auto& pair : m_TypeToDocViewMap) {
- if (pair.second->GetXFALayout() == pLayout)
- return pair.second.get();
- }
- return nullptr;
+ return m_DocView && m_DocView->GetXFALayout() == pLayout ? m_DocView.get()
+ : nullptr;
}
CXFA_FFDocView* CXFA_FFDoc::GetDocView() {
- auto it = m_TypeToDocViewMap.begin();
- return it != m_TypeToDocViewMap.end() ? it->second.get() : nullptr;
+ return m_DocView.get();
}
bool CXFA_FFDoc::OpenDoc(const CFX_RetainPtr<IFX_SeekableReadStream>& pStream) {
m_pStream = pStream;
return true;
}
+
bool CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) {
if (!pPDFDoc)
return false;
@@ -329,16 +326,15 @@ bool CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) {
}
bool CXFA_FFDoc::CloseDoc() {
- for (const auto& pair : m_TypeToDocViewMap)
- pair.second->RunDocClose();
+ if (m_DocView)
+ m_DocView->RunDocClose();
CXFA_Document* doc =
m_pDocumentParser ? m_pDocumentParser->GetDocument() : nullptr;
if (doc)
doc->ClearLayoutData();
- m_TypeToDocViewMap.clear();
-
+ m_DocView.reset();
m_pNotify.reset(nullptr);
m_pApp->GetXFAFontMgr()->ReleaseDocFonts(this);