diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-12-14 20:43:53 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-12-14 20:43:53 +0000 |
commit | 51ef4a6ca3b4ae9b618cb1c96f84697a2bf4a2b1 (patch) | |
tree | a365a0c3f25fff2f6511fbc23fd0e4d6b8d4eada /xfa/fxfa/cxfa_ffdocview.cpp | |
parent | 8489e901fb16fe508e23a36cd3eff93d8332c2a2 (diff) | |
download | pdfium-51ef4a6ca3b4ae9b618cb1c96f84697a2bf4a2b1.tar.xz |
Change CXFA_Node::GetChild to return proper types
Currently CXFA_Node::GetChild always returns a CXFA_Node* object. We
know the type we want when we call GetChild, so this CL changes the code
to add a template parameter to GetChild and return the correct CXFA_Node
subtype for the desired element.
Change-Id: I5aecf2e840504235dc246483abee48e0564841fe
Reviewed-on: https://pdfium-review.googlesource.com/21210
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffdocview.cpp')
-rw-r--r-- | xfa/fxfa/cxfa_ffdocview.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index 30ae7124de..ed91020dff 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -29,8 +29,11 @@ #include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h" #include "xfa/fxfa/cxfa_textprovider.h" #include "xfa/fxfa/cxfa_widgetacciterator.h" +#include "xfa/fxfa/parser/cxfa_acrobat.h" #include "xfa/fxfa/parser/cxfa_binditemsdata.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" +#include "xfa/fxfa/parser/cxfa_present.h" +#include "xfa/fxfa/parser/cxfa_subform.h" #include "xfa/fxfa/parser/cxfa_validate.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" @@ -112,7 +115,8 @@ void CXFA_FFDocView::StopLayout() { if (!pRootItem) return; - CXFA_Node* pSubformNode = pRootItem->GetChild(0, XFA_Element::Subform, false); + CXFA_Subform* pSubformNode = + pRootItem->GetChild<CXFA_Subform>(0, XFA_Element::Subform, false); if (!pSubformNode) return; @@ -267,16 +271,16 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, CXFA_Node* pConfigItem = ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Config)); if (pConfigItem) { - CXFA_Node* pValidateNode = nullptr; - CXFA_Node* pAcrobatNode = - pConfigItem->GetChild(0, XFA_Element::Acrobat, false); - pValidateNode = - pAcrobatNode ? pAcrobatNode->GetChild(0, XFA_Element::Validate, false) + CXFA_Acrobat* pAcrobatNode = + pConfigItem->GetChild<CXFA_Acrobat>(0, XFA_Element::Acrobat, false); + CXFA_Validate* pValidateNode = + pAcrobatNode ? pAcrobatNode->GetChild<CXFA_Validate>( + 0, XFA_Element::Validate, false) : nullptr; if (!pValidateNode) { - CXFA_Node* pPresentNode = - pConfigItem->GetChild(0, XFA_Element::Present, false); - pValidateNode = pPresentNode ? pPresentNode->GetChild( + CXFA_Present* pPresentNode = + pConfigItem->GetChild<CXFA_Present>(0, XFA_Element::Present, false); + pValidateNode = pPresentNode ? pPresentNode->GetChild<CXFA_Validate>( 0, XFA_Element::Validate, false) : nullptr; } @@ -295,7 +299,7 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, if (!pRootItem) return XFA_EVENTERROR_Error; - pNode = pRootItem->GetChild(0, XFA_Element::Subform, false); + pNode = pRootItem->GetChild<CXFA_Node>(0, XFA_Element::Subform, false); } ExecEventActivityByDeepFirst(pNode, pParam->m_eType, pParam->m_bIsFormReady, |