From 51ef4a6ca3b4ae9b618cb1c96f84697a2bf4a2b1 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 14 Dec 2017 20:43:53 +0000 Subject: 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 Commit-Queue: dsinclair --- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'xfa/fxfa/parser/xfa_document_datamerger_imp.cpp') diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 30d45787f5..22b339aba5 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -16,6 +16,7 @@ #include "third_party/base/logging.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/parser/cxfa_document.h" +#include "xfa/fxfa/parser/cxfa_items.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_localemgr.h" #include "xfa/fxfa/parser/cxfa_node.h" @@ -194,8 +195,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (pChild->GetElementType() != XFA_Element::Field) continue; - auto* pValue = static_cast( - pChild->GetChild(0, XFA_Element::Value, false)); + auto* pValue = + pChild->GetChild(0, XFA_Element::Value, false); if (!pValue) continue; @@ -203,7 +204,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (wsValue.IsEmpty()) continue; - CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items, false); + CXFA_Items* pItems = + pChild->GetChild(0, XFA_Element::Items, false); if (!pItems) continue; @@ -233,7 +235,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, CXFA_Node* pValue = pChild->JSObject()->GetProperty(0, XFA_Element::Value, true); - CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items, false); + CXFA_Items* pItems = + pChild->GetChild(0, XFA_Element::Items, false); CXFA_Node* pText = pItems ? pItems->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr; if (pText) -- cgit v1.2.3