summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_engine.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-10 16:28:57 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-10 16:28:57 +0000
commit640d8ffad8536c789103892c7a4e69e5d30172c8 (patch)
treeebd3f4013383a2319c95d29a10097f4bdb28ea30 /fxjs/cfxjse_engine.cpp
parent594b3eeeaa61a2c0a6d84df3e17ea587f3b15c23 (diff)
downloadpdfium-640d8ffad8536c789103892c7a4e69e5d30172c8.tar.xz
Make methods which create nodes more obvious
This CL converts the various methods Get methods which take a boolean value to explicit Get* and GetOrCreate* methods to make the usage clearer. Change-Id: I2af68448b1b69b95713e739bf7fe14a4336d2b65 Reviewed-on: https://pdfium-review.googlesource.com/22590 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/cfxjse_engine.cpp')
-rw-r--r--fxjs/cfxjse_engine.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp
index 179866b555..535ec41160 100644
--- a/fxjs/cfxjse_engine.cpp
+++ b/fxjs/cfxjse_engine.cpp
@@ -351,10 +351,12 @@ void CFXJSE_Engine::NormalPropertySetter(CFXJSE_Value* pOriginalValue,
CXFA_Node* pNode = ToNode(pObject);
CXFA_Node* pPropOrChild = nullptr;
XFA_Element eType = CXFA_Node::NameToElement(wsPropName);
- if (eType != XFA_Element::Unknown)
- pPropOrChild = pNode->JSObject()->GetProperty<CXFA_Node>(0, eType, true);
- else
+ if (eType != XFA_Element::Unknown) {
+ pPropOrChild =
+ pNode->JSObject()->GetOrCreateProperty<CXFA_Node>(0, eType);
+ } else {
pPropOrChild = pNode->GetFirstChildByName(wsPropName.AsStringView());
+ }
if (pPropOrChild) {
const XFA_SCRIPTATTRIBUTEINFO* lpAttrInfo = XFA_GetScriptAttributeByName(