summaryrefslogtreecommitdiff
path: root/fxjs/xfa/cjx_tree.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-29 20:49:26 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-29 20:49:26 +0000
commit4dd1b07b00842f33be3ebccdc8e4fd3219191c63 (patch)
treec48766c0fd8e7a4c88226fafbb4b4ad09d2c9760 /fxjs/xfa/cjx_tree.cpp
parent59cdc7dc88310bd8cdf2ace60e0f567561d38dbb (diff)
downloadpdfium-4dd1b07b00842f33be3ebccdc8e4fd3219191c63.tar.xz
Fold single caller methods into callsite
This CL folds the GetNodeSameClassIndex, GetNodeSameNameIndex from CXFA_Node into the CJX_Tree callsites. Change-Id: Ia4f7750543e786ddd82abb4b6b4bde1bf1710f19 Reviewed-on: https://pdfium-review.googlesource.com/24471 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/xfa/cjx_tree.cpp')
-rw-r--r--fxjs/xfa/cjx_tree.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/fxjs/xfa/cjx_tree.cpp b/fxjs/xfa/cjx_tree.cpp
index e20115b9bc..c11d77b125 100644
--- a/fxjs/xfa/cjx_tree.cpp
+++ b/fxjs/xfa/cjx_tree.cpp
@@ -175,7 +175,13 @@ void CJX_Tree::index(CFXJSE_Value* pValue,
ThrowInvalidPropertyException();
return;
}
- pValue->SetInteger(ToNode(GetXFAObject())->GetNodeSameNameIndex());
+
+ CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
+ if (!pScriptContext) {
+ pValue->SetInteger(-1);
+ return;
+ }
+ pValue->SetInteger(pScriptContext->GetIndexByName(ToNode(GetXFAObject())));
}
void CJX_Tree::classIndex(CFXJSE_Value* pValue,
@@ -185,7 +191,14 @@ void CJX_Tree::classIndex(CFXJSE_Value* pValue,
ThrowInvalidPropertyException();
return;
}
- pValue->SetInteger(ToNode(GetXFAObject())->GetNodeSameClassIndex());
+
+ CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
+ if (!pScriptContext) {
+ pValue->SetInteger(-1);
+ return;
+ }
+ pValue->SetInteger(
+ pScriptContext->GetIndexByClassName(ToNode(GetXFAObject())));
}
void CJX_Tree::somExpression(CFXJSE_Value* pValue,