From b066704a22ba4f242567f508c12bf2545cbed9e1 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 16 Nov 2017 13:42:49 +0000 Subject: Convert TryCData and TryContent to optionals This CL changes the TryCData and TryContent to return pdfium::Optional values instead of returning a bool and taking an out WideString. Change-Id: I9c9d877803f9f1977191e12d6a907c29784c10b2 Reviewed-on: https://pdfium-review.googlesource.com/18510 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 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 94c82f85e8..29bcd5f3b9 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -218,9 +218,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (!pText) continue; - WideString wsContent; - if (pText->JSNode()->TryContent(wsContent, false, true) && - (wsContent == wsValue)) { + WideString wsContent = pText->JSNode()->GetContent(false); + if (wsContent == wsValue) { pChecked = pChild; wsFormattedValue = wsValue; pDataNode->JSNode()->SetAttributeValue(wsValue, wsFormattedValue, @@ -250,7 +249,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, WideString wsContent; if (pText) - pText->JSNode()->TryContent(wsContent, false, true); + wsContent = pText->JSNode()->GetContent(false); FormValueNode_SetChildContent(pValue, wsContent, XFA_Element::Text); } @@ -285,10 +284,11 @@ void CreateDataBinding(CXFA_Node* pFormNode, return; } - WideString wsXMLValue; - pDataNode->JSNode()->TryContent(wsXMLValue, false, true); + WideString wsXMLValue = pDataNode->JSNode()->GetContent(false); + WideString wsNormalizeValue; pWidgetData->GetNormalizeDataValue(wsXMLValue, wsNormalizeValue); + pDataNode->JSNode()->SetAttributeValue(wsNormalizeValue, wsXMLValue, false, false); switch (eUIType) { @@ -323,10 +323,12 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (!items.empty()) { bool single = items.size() == 1; wsNormalizeValue.clear(); - WideString wsItem; + for (CXFA_Node* pNode : items) { - pNode->JSNode()->TryContent(wsItem, false, true); - wsItem = single ? wsItem : wsItem + L"\n"; + WideString wsItem = pNode->JSNode()->GetContent(false); + if (single) + wsItem += L"\n"; + wsNormalizeValue += wsItem; } CXFA_ExDataData exData = defValueData.GetExData(); -- cgit v1.2.3