summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-14 21:19:44 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-14 21:19:44 +0000
commitaee28693976cc246eea8230a999906802e52cab7 (patch)
tree612e6dbc9b79c978208a623138f70f881acb539f /xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
parent5a423ef8708e61d43f1556ab09c2e09f496d700d (diff)
downloadpdfium-aee28693976cc246eea8230a999906802e52cab7.tar.xz
Cleanup XFA default value code
This CL adds helper methods to CXFA_Node to retrieve the default values for attributes with the correct data types. Change-Id: I644435b4b430819f1060a95fa4fffe4ba2826cfe Reviewed-on: https://pdfium-review.googlesource.com/18450 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.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 67256f2385..128ad7b2ad 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -424,13 +424,13 @@ CXFA_Node* ScopeMatchGlobalBinding(CXFA_Node* pDataScope,
}
CXFA_Node* FindGlobalDataNode(CXFA_Document* pDocument,
- WideStringView wsName,
+ const WideString& wsName,
CXFA_Node* pDataScope,
XFA_Element eMatchNodeType) {
if (wsName.IsEmpty())
return nullptr;
- uint32_t dwNameHash = FX_HashCode_GetW(wsName, false);
+ uint32_t dwNameHash = FX_HashCode_GetW(wsName.AsStringView(), false);
CXFA_Node* pBounded = GetGlobalBinding(pDocument, dwNameHash);
if (!pBounded) {
pBounded =
@@ -442,13 +442,13 @@ CXFA_Node* FindGlobalDataNode(CXFA_Document* pDocument,
}
CXFA_Node* FindOnceDataNode(CXFA_Document* pDocument,
- WideStringView wsName,
+ const WideString& wsName,
CXFA_Node* pDataScope,
XFA_Element eMatchNodeType) {
if (wsName.IsEmpty())
return nullptr;
- uint32_t dwNameHash = FX_HashCode_GetW(wsName, false);
+ uint32_t dwNameHash = FX_HashCode_GetW(wsName.AsStringView(), false);
CXFA_Node* pLastDataScope = nullptr;
for (CXFA_Node* pCurDataScope = pDataScope;
pCurDataScope && pCurDataScope->GetPacketID() == XFA_XDPPACKET_Datasets;
@@ -469,7 +469,7 @@ CXFA_Node* FindOnceDataNode(CXFA_Document* pDocument,
}
CXFA_Node* FindDataRefDataNode(CXFA_Document* pDocument,
- WideStringView wsRef,
+ const WideString& wsRef,
CXFA_Node* pDataScope,
XFA_Element eMatchNodeType,
CXFA_Node* pTemplateNode,
@@ -480,8 +480,8 @@ CXFA_Node* FindDataRefDataNode(CXFA_Document* pDocument,
dFlags |= (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings);
XFA_RESOLVENODE_RS rs;
- pDocument->GetScriptContext()->ResolveObjects(pDataScope, wsRef, rs, dFlags,
- pTemplateNode);
+ pDocument->GetScriptContext()->ResolveObjects(
+ pDataScope, wsRef.AsStringView(), rs, dFlags, pTemplateNode);
if (rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeAll ||
rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll ||
rs.objects.size() > 1) {
@@ -513,7 +513,7 @@ CXFA_Node* CloneOrMergeInstanceManager(CXFA_Document* pDocument,
CXFA_Node* pFormParent,
CXFA_Node* pTemplateNode,
std::vector<CXFA_Node*>* subforms) {
- WideStringView wsSubformName =
+ WideString wsSubformName =
pTemplateNode->JSNode()->GetCData(XFA_Attribute::Name);
WideString wsInstMgrNodeName = L"_" + wsSubformName;
uint32_t dwInstNameHash =
@@ -1165,13 +1165,13 @@ void UpdateBindingRelations(CXFA_Document* pDocument,
bMatchRef = bDataRef;
bParentDataRef = true;
if (!pDataNode && bDataRef) {
- WideStringView wsRef =
+ WideString wsRef =
pTemplateNodeBind->JSNode()->GetCData(XFA_Attribute::Ref);
uint32_t dFlags =
XFA_RESOLVENODE_Children | XFA_RESOLVENODE_CreateNode;
XFA_RESOLVENODE_RS rs;
- pDocument->GetScriptContext()->ResolveObjects(pDataScope, wsRef, rs,
- dFlags, pTemplateNode);
+ pDocument->GetScriptContext()->ResolveObjects(
+ pDataScope, wsRef.AsStringView(), rs, dFlags, pTemplateNode);
CXFA_Object* pObject =
!rs.objects.empty() ? rs.objects.front() : nullptr;
pDataNode = ToNode(pObject);
@@ -1465,7 +1465,7 @@ void CXFA_Document::DoDataMerge() {
this, pFormRoot, pTemplateChosen, false, nullptr);
ASSERT(pSubformSetNode);
if (!pDataTopLevel) {
- WideStringView wsFormName =
+ WideString wsFormName =
pSubformSetNode->JSNode()->GetCData(XFA_Attribute::Name);
WideString wsDataTopLevelName(wsFormName.IsEmpty() ? L"form" : wsFormName);
CFX_XMLElement* pDataTopLevelXMLNode =