From 69cb91483879db27fd95e85d3d4ee7dc7093e126 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 2 Nov 2017 18:15:50 +0000 Subject: Remove default value from CJX_Node::GetAttribute This CL moves the default value to CJX_Node::GetAttribute to the call sites and removes the default. Change-Id: I2b875e3c612b91ca67af106e271b040cc51c56ef Reviewed-on: https://pdfium-review.googlesource.com/17470 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- fxjs/cjx_node.cpp | 8 ++++---- fxjs/cjx_node.h | 6 ++---- xfa/fxfa/cxfa_ffpageview.cpp | 2 +- xfa/fxfa/parser/cxfa_image.cpp | 2 +- xfa/fxfa/parser/cxfa_nodelocale.cpp | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp index 3fd08772e2..e9c3fbf371 100644 --- a/fxjs/cjx_node.cpp +++ b/fxjs/cjx_node.cpp @@ -526,7 +526,7 @@ void CJX_Node::Script_TreeClass_All(CFXJSE_Value* pValue, uint32_t dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL; WideString wsName; - GetAttribute(XFA_ATTRIBUTE_Name, wsName); + GetAttribute(XFA_ATTRIBUTE_Name, wsName, true); WideString wsExpression = wsName + L"[*]"; Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag); } @@ -665,7 +665,7 @@ void CJX_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) { WideString wsExpression = WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringView()); WideString wsValue; - GetAttribute(wsExpression.AsStringView(), wsValue); + GetAttribute(wsExpression.AsStringView(), wsValue, true); CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) pValue->SetString(wsValue.UTF8Encode().AsStringView()); @@ -1279,7 +1279,7 @@ void CJX_Node::Script_Attribute_String(CFXJSE_Value* pValue, } } else { WideString wsValue; - GetAttribute(eAttribute, wsValue); + GetAttribute(eAttribute, wsValue, true); pValue->SetString(wsValue.UTF8Encode().AsStringView()); } } @@ -1293,7 +1293,7 @@ void CJX_Node::Script_Attribute_StringRead(CFXJSE_Value* pValue, } WideString wsValue; - GetAttribute(eAttribute, wsValue); + GetAttribute(eAttribute, wsValue, true); pValue->SetString(wsValue.UTF8Encode().AsStringView()); } diff --git a/fxjs/cjx_node.h b/fxjs/cjx_node.h index 47fb0d62f0..ca94a8fff0 100644 --- a/fxjs/cjx_node.h +++ b/fxjs/cjx_node.h @@ -61,10 +61,8 @@ class CJX_Node : public CJX_Object { bool bNotify); bool GetAttribute(const WideStringView& wsAttr, WideString& wsValue, - bool bUseDefault = true); - bool GetAttribute(XFA_ATTRIBUTE eAttr, - WideString& wsValue, - bool bUseDefault = true); + bool bUseDefault); + bool GetAttribute(XFA_ATTRIBUTE eAttr, WideString& wsValue, bool bUseDefault); bool SetAttributeValue(const WideString& wsValue, const WideString& wsXMLValue, bool bNotify = false, diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp index 39115c7f5b..bd95ba916f 100644 --- a/xfa/fxfa/cxfa_ffpageview.cpp +++ b/xfa/fxfa/cxfa_ffpageview.cpp @@ -314,7 +314,7 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget( if (pTraverse) { WideString wsTraverseWidgetName; if (pTraverse->JSNode()->GetAttribute(XFA_ATTRIBUTE_Ref, - wsTraverseWidgetName)) { + wsTraverseWidgetName, true)) { return FindWidgetByName(wsTraverseWidgetName, pWidget); } } diff --git a/xfa/fxfa/parser/cxfa_image.cpp b/xfa/fxfa/parser/cxfa_image.cpp index 34072392f7..8a346e0f42 100644 --- a/xfa/fxfa/parser/cxfa_image.cpp +++ b/xfa/fxfa/parser/cxfa_image.cpp @@ -22,7 +22,7 @@ bool CXFA_Image::GetContentType(WideString& wsContentType) { bool CXFA_Image::GetHref(WideString& wsHref) { if (m_bDefValue) return m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Href, wsHref); - return m_pNode->JSNode()->GetAttribute(L"href", wsHref); + return m_pNode->JSNode()->GetAttribute(L"href", wsHref, true); } int32_t CXFA_Image::GetTransferEncoding() { diff --git a/xfa/fxfa/parser/cxfa_nodelocale.cpp b/xfa/fxfa/parser/cxfa_nodelocale.cpp index 7aaec5aa19..5a3eb20887 100644 --- a/xfa/fxfa/parser/cxfa_nodelocale.cpp +++ b/xfa/fxfa/parser/cxfa_nodelocale.cpp @@ -136,7 +136,7 @@ CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent, pParent ? pParent->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr; while (pChild) { WideString wsChild; - if (pChild->JSNode()->GetAttribute(XFA_ATTRIBUTE_Name, wsChild)) { + if (pChild->JSNode()->GetAttribute(XFA_ATTRIBUTE_Name, wsChild, true)) { if (wsChild == wsName) return pChild; } -- cgit v1.2.3