summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-16 13:42:49 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-16 13:42:49 +0000
commitb066704a22ba4f242567f508c12bf2545cbed9e1 (patch)
treeb0ef12e2873bf7018d4b17a41b626428fb789923 /xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
parent4011677aed8b258fcf87cf52b0d541ef04c832ff (diff)
downloadpdfium-b066704a22ba4f242567f508c12bf2545cbed9e1.tar.xz
Convert TryCData and TryContent to optionals
This CL changes the TryCData and TryContent to return pdfium::Optional<WideString> 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 <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/xfa_document_datamerger_imp.cpp')
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp20
1 files changed, 11 insertions, 9 deletions
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();