From a95fd60b7902b9f893d05189aa6c877eb2e73e90 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 2 Nov 2017 18:32:08 +0000 Subject: Remove default value from CJX_Node::GetProperty This CL removes the GetProperty default value and inlines into the callers. Change-Id: I0e18f27b51046fdf37ddc57f34a31154729c8db0 Reviewed-on: https://pdfium-review.googlesource.com/17510 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- fxjs/cfxjse_engine.cpp | 2 +- fxjs/cjx_node.cpp | 16 +++++++--------- fxjs/cjx_node.h | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) (limited to 'fxjs') diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp index 125ddc7cea..5fa0a11e21 100644 --- a/fxjs/cfxjse_engine.cpp +++ b/fxjs/cfxjse_engine.cpp @@ -349,7 +349,7 @@ void CFXJSE_Engine::NormalPropertySetter(CFXJSE_Value* pOriginalValue, CXFA_Node* pPropOrChild = nullptr; XFA_Element eType = XFA_GetElementTypeForName(wsPropName.AsStringView()); if (eType != XFA_Element::Unknown) - pPropOrChild = pNode->JSNode()->GetProperty(0, eType); + pPropOrChild = pNode->JSNode()->GetProperty(0, eType, true); else pPropOrChild = pNode->GetFirstChildByName(wsPropName.AsStringView()); diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp index 59ddab5db0..0c78f99551 100644 --- a/fxjs/cjx_node.cpp +++ b/fxjs/cjx_node.cpp @@ -684,7 +684,7 @@ void CJX_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { if (iLength >= 2) iValue = pArguments->GetInt32(1); CXFA_Node* pNode = GetProperty( - iValue, XFA_GetElementTypeForName(wsExpression.AsStringView())); + iValue, XFA_GetElementTypeForName(wsExpression.AsStringView()), true); pArguments->GetReturnValue()->Assign( GetDocument()->GetScriptContext()->GetJSValueFromMap(pNode)); } @@ -710,14 +710,12 @@ void CJX_Node::Script_NodeClass_IsPropertySpecified( bool bParent = iLength < 2 || pArguments->GetInt32(1); int32_t iIndex = iLength == 3 ? pArguments->GetInt32(2) : 0; XFA_Element eType = XFA_GetElementTypeForName(wsExpression.AsStringView()); - bHas = !!GetProperty(iIndex, eType); + bHas = !!GetProperty(iIndex, eType, true); if (!bHas && bParent && GetXFANode()->GetParent()) { // Also check on the parent. - bHas = GetXFANode()->GetParent()->JSNode()->HasAttribute( - pAttributeInfo->eName); - if (!bHas) - bHas = - !!GetXFANode()->GetParent()->JSNode()->GetProperty(iIndex, eType); + auto* jsnode = GetXFANode()->GetParent()->JSNode(); + bHas = jsnode->HasAttribute(pAttributeInfo->eName) || + !!jsnode->GetProperty(iIndex, eType, true); } } pValue->SetBoolean(bHas); @@ -3331,7 +3329,7 @@ bool CJX_Node::SetScriptContent(const WideString& wsContent, switch (GetXFANode()->GetObjectType()) { case XFA_ObjectType::ContainerNode: { if (XFA_FieldIsMultiListBox(GetXFANode())) { - CXFA_Node* pValue = GetProperty(0, XFA_Element::Value); + CXFA_Node* pValue = GetProperty(0, XFA_Element::Value, true); if (!pValue) break; @@ -3412,7 +3410,7 @@ bool CJX_Node::SetScriptContent(const WideString& wsContent, if (GetXFANode()->GetElementType() == XFA_Element::ExclGroup) { pNode = GetXFANode(); } else { - CXFA_Node* pValue = GetProperty(0, XFA_Element::Value); + CXFA_Node* pValue = GetProperty(0, XFA_Element::Value, true); if (!pValue) break; diff --git a/fxjs/cjx_node.h b/fxjs/cjx_node.h index 1b8ad5c079..b9a41deaf4 100644 --- a/fxjs/cjx_node.h +++ b/fxjs/cjx_node.h @@ -71,7 +71,7 @@ class CJX_Node : public CJX_Object { CXFA_Node* GetProperty(int32_t index, XFA_Element eType, - bool bCreateProperty = true); + bool bCreateProperty); bool SetContent(const WideString& wsContent, const WideString& wsXMLValue, -- cgit v1.2.3