diff options
author | dsinclair <dsinclair@chromium.org> | 2016-09-14 06:11:08 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-14 06:11:08 -0700 |
commit | 89f8fa8694bbf209412845c250af48bbc539962b (patch) | |
tree | fa365a5f1a9c43e4d9d8851c36f04f14554ca07f /xfa/fxfa/app | |
parent | 2ca2da505ba75cd830539ffc98dfc482fd4daa41 (diff) | |
download | pdfium-89f8fa8694bbf209412845c250af48bbc539962b.tar.xz |
Remove unused code in CPDFXFA_Document
Remove methods that always just return without doing any work. Clean up the
IXFA_DocProvider interface calls for those methods and cleanup the callers
that were calling the methods.
Review-Url: https://codereview.chromium.org/2323523002
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r-- | xfa/fxfa/app/xfa_ffdoc.cpp | 54 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffsignature.cpp | 5 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fftextedit.cpp | 16 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fftextedit.h | 2 |
4 files changed, 8 insertions, 69 deletions
diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index 4e69db4eea..1aed9c640e 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -235,60 +235,14 @@ void XFA_XPDPacket_MergeRootNode(CXFA_Node* pOriginRoot, CXFA_Node* pNewRoot) { } } } + int32_t CXFA_FFDoc::DoLoad(IFX_Pause* pPause) { int32_t iStatus = m_pDocumentParser->DoParse(pPause); - if (iStatus == XFA_PARSESTATUS_Done && !m_pPDFDoc) { - CXFA_Node* pPDFNode = ToNode( - m_pDocumentParser->GetDocument()->GetXFAObject(XFA_HASHCODE_Pdf)); - if (!pPDFNode) { - return XFA_PARSESTATUS_SyntaxErr; - } - CFDE_XMLNode* pPDFXML = pPDFNode->GetXMLMappingNode(); - if (pPDFXML->GetType() != FDE_XMLNODE_Element) { - return XFA_PARSESTATUS_SyntaxErr; - } - int32_t iBufferSize = 0; - uint8_t* pByteBuffer = nullptr; - IFX_FileRead* pXFAReader = nullptr; - if (XFA_GetPDFContentsFromPDFXML(pPDFXML, pByteBuffer, iBufferSize)) { - pXFAReader = FX_CreateMemoryStream(pByteBuffer, iBufferSize, TRUE); - } else { - CFX_WideString wsHref; - static_cast<CFDE_XMLElement*>(pPDFXML)->GetString(L"href", wsHref); - if (!wsHref.IsEmpty()) { - pXFAReader = GetDocProvider()->OpenLinkedFile(this, wsHref); - } - } - if (!pXFAReader) - return XFA_PARSESTATUS_SyntaxErr; - - CPDF_Document* pPDFDocument = - GetDocProvider()->OpenPDF(this, pXFAReader, TRUE); - ASSERT(!m_pPDFDoc); - if (!OpenDoc(pPDFDocument)) - return XFA_PARSESTATUS_SyntaxErr; - - CXFA_Document* doc = m_pDocumentParser->GetDocument(); - std::unique_ptr<CXFA_SimpleParser> pParser( - new CXFA_SimpleParser(doc, true)); - if (!pParser) - return XFA_PARSESTATUS_SyntaxErr; - - CXFA_Node* pRootNode = nullptr; - if (pParser->StartParse(m_pStream, XFA_XDPPACKET_XDP) == - XFA_PARSESTATUS_Ready && - pParser->DoParse(nullptr) == XFA_PARSESTATUS_Done) { - pRootNode = pParser->GetRootNode(); - } - if (pRootNode && doc->GetRoot()) { - XFA_XPDPacket_MergeRootNode(doc->GetRoot(), pRootNode); - iStatus = XFA_PARSESTATUS_Done; - } else { - iStatus = XFA_PARSESTATUS_StatusErr; - } - } + if (iStatus == XFA_PARSESTATUS_Done && !m_pPDFDoc) + return XFA_PARSESTATUS_SyntaxErr; return iStatus; } + void CXFA_FFDoc::StopLoad() { m_pApp->GetXFAFontMgr()->LoadDocFonts(this); m_dwDocType = XFA_DOCTYPE_Static; diff --git a/xfa/fxfa/app/xfa_ffsignature.cpp b/xfa/fxfa/app/xfa_ffsignature.cpp index 695969274c..3d92f286b9 100644 --- a/xfa/fxfa/app/xfa_ffsignature.cpp +++ b/xfa/fxfa/app/xfa_ffsignature.cpp @@ -34,11 +34,8 @@ void CXFA_FFSignature::RenderWidget(CFX_Graphics* pGS, DrawBorder(pGS, borderUI, m_rtUI, &mtRotate); RenderCaption(pGS, &mtRotate); DrawHighlight(pGS, &mtRotate, dwStatus, FALSE); - CFX_RectF rtWidget = m_rtUI; - IXFA_DocProvider* pDocProvider = m_pDataAcc->GetDoc()->GetDocProvider(); - ASSERT(pDocProvider); - pDocProvider->RenderCustomWidget(this, pGS, &mtRotate, rtWidget); } + FX_BOOL CXFA_FFSignature::OnMouseEnter() { return FALSE; } diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index 6df4507e22..bd92a45e4c 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -387,18 +387,9 @@ void CXFA_FFTextEdit::OnTextFull(IFWL_Widget* pWidget) { } FX_BOOL CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) { - if (sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit) { + if (sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit) return TRUE; - } - return GetDoc()->GetDocProvider()->CheckWord(GetDoc(), sWord); -} -FX_BOOL CXFA_FFTextEdit::GetSuggestWords( - const CFX_ByteStringC& sWord, - std::vector<CFX_ByteString>& sSuggest) { - if (m_pDataAcc->GetUIType() != XFA_Element::TextEdit) { - return FALSE; - } - return GetDoc()->GetDocProvider()->GetSuggestWords(GetDoc(), sWord, sSuggest); + return FALSE; } void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) { @@ -426,8 +417,7 @@ void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { } case CFWL_EventType::GetSuggestedWords: { CFWL_EvtEdtGetSuggestWords* event = (CFWL_EvtEdtGetSuggestWords*)pEvent; - event->bSuggestWords = GetSuggestWords(event->bsWord.AsStringC(), - event->bsArraySuggestWords); + event->bSuggestWords = FALSE; break; } default: diff --git a/xfa/fxfa/app/xfa_fftextedit.h b/xfa/fxfa/app/xfa_fftextedit.h index c6d9c9c862..048008d700 100644 --- a/xfa/fxfa/app/xfa_fftextedit.h +++ b/xfa/fxfa/app/xfa_fftextedit.h @@ -52,8 +52,6 @@ class CXFA_FFTextEdit : public CXFA_FFField { const CFX_WideString& wsPrevText); void OnTextFull(IFWL_Widget* pWidget); FX_BOOL CheckWord(const CFX_ByteStringC& sWord); - FX_BOOL GetSuggestWords(const CFX_ByteStringC& sWord, - std::vector<CFX_ByteString>& sSuggest); protected: FX_BOOL CommitData() override; |