summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffdocview.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/cxfa_ffdocview.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/cxfa_ffdocview.cpp')
-rw-r--r--xfa/fxfa/cxfa_ffdocview.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index 57cd7d2f95..d076fdeddb 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -720,18 +720,20 @@ void CXFA_FFDocView::RunBindItems() {
CXFA_BindItemsData bindItemsData(item);
CFXJSE_Engine* pScriptContext =
pWidgetNode->GetDocument()->GetScriptContext();
- WideStringView wsRef;
+ WideString wsRef;
bindItemsData.GetRef(wsRef);
uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent |
XFA_RESOLVENODE_ALL;
XFA_RESOLVENODE_RS rs;
- pScriptContext->ResolveObjects(pWidgetNode, wsRef, rs, dwStyle);
+ pScriptContext->ResolveObjects(pWidgetNode, wsRef.AsStringView(), rs,
+ dwStyle);
pAcc->DeleteItem(-1, false, false);
if (rs.dwFlags != XFA_RESOLVENODE_RSTYPE_Nodes || rs.objects.empty())
continue;
- WideStringView wsValueRef, wsLabelRef;
+ WideString wsValueRef;
+ WideString wsLabelRef;
bindItemsData.GetValueRef(wsValueRef);
bindItemsData.GetLabelRef(wsLabelRef);
const bool bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef;
@@ -739,7 +741,7 @@ void CXFA_FFDocView::RunBindItems() {
const bool bValueUseContent = wsValueRef.IsEmpty() || wsValueRef == L"$";
WideString wsValue;
WideString wsLabel;
- uint32_t uValueHash = FX_HashCode_GetW(wsValueRef, false);
+ uint32_t uValueHash = FX_HashCode_GetW(wsValueRef.AsStringView(), false);
for (CXFA_Object* refObject : rs.objects) {
CXFA_Node* refNode = refObject->AsNode();
if (!refNode)
@@ -757,7 +759,8 @@ void CXFA_FFDocView::RunBindItems() {
if (bLabelUseContent) {
wsLabel = refNode->JSNode()->GetContent(false);
} else {
- CXFA_Node* nodeLabel = refNode->GetFirstChildByName(wsLabelRef);
+ CXFA_Node* nodeLabel =
+ refNode->GetFirstChildByName(wsLabelRef.AsStringView());
if (nodeLabel)
wsLabel = nodeLabel->JSNode()->GetContent(false);
}