summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffdocview.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-23 15:58:33 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-23 15:58:33 +0000
commit8632d41263962bffdaff5f5e91fd7c074846048f (patch)
tree5f8b92da4004fd3054754137b50cc015c427b9ab /xfa/fxfa/cxfa_ffdocview.cpp
parent1e5f87e7e1c1e5868ec675a0c45ddd97d2b4db2e (diff)
downloadpdfium-8632d41263962bffdaff5f5e91fd7c074846048f.tar.xz
Remove CXFA_FFDocView::GetWidgetAccByName
This CL folds GetWidgetAccByName back into GetWidgetByName. Change-Id: I48c0aa443c92adfff27c1001f6dc90084b7bc8c3 Reviewed-on: https://pdfium-review.googlesource.com/23530 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffdocview.cpp')
-rw-r--r--xfa/fxfa/cxfa_ffdocview.cpp34
1 files changed, 9 insertions, 25 deletions
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index 95b8b9cfb6..3a3637a1ef 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -483,37 +483,21 @@ int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode,
CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const WideString& wsName,
CXFA_FFWidget* pRefWidget) {
- CXFA_WidgetAcc* pRefAcc = nullptr;
- if (pRefWidget) {
- CXFA_Node* node = pRefWidget->GetNode();
- pRefAcc = node->IsWidgetReady() ? node->GetWidgetAcc() : nullptr;
- }
- CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc);
- if (!pAcc)
- return nullptr;
- return GetWidgetForNode(pAcc->GetNode());
-}
-
-CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName(
- const WideString& wsName,
- CXFA_WidgetAcc* pRefWidgetAcc) {
- WideString wsExpression;
- uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
- XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent;
CFXJSE_Engine* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext();
if (!pScriptContext)
return nullptr;
- CXFA_Node* refNode = nullptr;
- if (pRefWidgetAcc) {
- refNode = pRefWidgetAcc->GetNode();
- wsExpression = wsName;
- } else {
- wsExpression = L"$form." + wsName;
+ CXFA_Node* pRefNode = nullptr;
+ if (pRefWidget) {
+ CXFA_Node* node = pRefWidget->GetNode();
+ pRefNode = node->IsWidgetReady() ? node : nullptr;
}
+ WideString wsExpression = (!pRefNode ? L"$form." : L"") + wsName;
XFA_RESOLVENODE_RS resolveNodeRS;
- if (!pScriptContext->ResolveObjects(refNode, wsExpression.AsStringView(),
+ uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
+ XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent;
+ if (!pScriptContext->ResolveObjects(pRefNode, wsExpression.AsStringView(),
&resolveNodeRS, dwStyle, nullptr)) {
return nullptr;
}
@@ -521,7 +505,7 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName(
if (resolveNodeRS.dwFlags == XFA_ResolveNode_RSType_Nodes) {
CXFA_Node* pNode = resolveNodeRS.objects.front()->AsNode();
if (pNode && pNode->IsWidgetReady())
- return pNode->GetWidgetAcc();
+ return GetWidgetForNode(pNode);
}
return nullptr;
}