diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-10 16:28:57 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-10 16:28:57 +0000 |
commit | 640d8ffad8536c789103892c7a4e69e5d30172c8 (patch) | |
tree | ebd3f4013383a2319c95d29a10097f4bdb28ea30 /fxjs/xfa/cjx_node.cpp | |
parent | 594b3eeeaa61a2c0a6d84df3e17ea587f3b15c23 (diff) | |
download | pdfium-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/xfa/cjx_node.cpp')
-rw-r--r-- | fxjs/xfa/cjx_node.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp index c0634767cf..581d3281ef 100644 --- a/fxjs/xfa/cjx_node.cpp +++ b/fxjs/xfa/cjx_node.cpp @@ -163,8 +163,8 @@ CJS_Return CJX_Node::getElement( WideString expression = runtime->ToWideString(params[0]); int32_t iValue = params.size() >= 2 ? runtime->ToInt32(params[1]) : 0; - CXFA_Node* pNode = GetProperty<CXFA_Node>( - iValue, CXFA_Node::NameToElement(expression), true); + CXFA_Node* pNode = GetOrCreateProperty<CXFA_Node>( + iValue, CXFA_Node::NameToElement(expression)); CFXJSE_Value* value = GetDocument()->GetScriptContext()->GetJSValueFromMap(pNode); if (!value) @@ -186,12 +186,12 @@ CJS_Return CJX_Node::isPropertySpecified( bool bParent = params.size() < 2 || runtime->ToBoolean(params[1]); int32_t iIndex = params.size() == 3 ? runtime->ToInt32(params[2]) : 0; XFA_Element eType = CXFA_Node::NameToElement(expression); - bool bHas = !!GetProperty<CXFA_Node>(iIndex, eType, true); + bool bHas = !!GetOrCreateProperty<CXFA_Node>(iIndex, eType); if (!bHas && bParent && GetXFANode()->GetParent()) { // Also check on the parent. auto* jsnode = GetXFANode()->GetParent()->JSObject(); bHas = jsnode->HasAttribute(attr) || - !!jsnode->GetProperty<CXFA_Node>(iIndex, eType, true); + !!jsnode->GetOrCreateProperty<CXFA_Node>(iIndex, eType); } return CJS_Return(runtime->NewBoolean(bHas)); } |