diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-02 18:32:08 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-02 18:32:08 +0000 |
commit | a95fd60b7902b9f893d05189aa6c877eb2e73e90 (patch) | |
tree | 59c7e977600be1fe1f40a792fbe369708d7797b8 | |
parent | 92492c1455e59c18f274c1f2b3ecfe9d042509fa (diff) | |
download | pdfium-a95fd60b7902b9f893d05189aa6c877eb2e73e90.tar.xz |
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 <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
-rw-r--r-- | fxjs/cfxjse_engine.cpp | 2 | ||||
-rw-r--r-- | fxjs/cjx_node.cpp | 16 | ||||
-rw-r--r-- | fxjs/cjx_node.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_event.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_fill.cpp | 15 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_font.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_stroke.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 9 |
9 files changed, 30 insertions, 24 deletions
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, diff --git a/xfa/fxfa/parser/cxfa_event.cpp b/xfa/fxfa/parser/cxfa_event.cpp index 4d7c27d80f..822baf8ce7 100644 --- a/xfa/fxfa/parser/cxfa_event.cpp +++ b/xfa/fxfa/parser/cxfa_event.cpp @@ -39,7 +39,8 @@ CXFA_Submit CXFA_Event::GetSubmit() const { } void CXFA_Event::GetSignDataTarget(WideString& wsTarget) { - CXFA_Node* pNode = m_pNode->JSNode()->GetProperty(0, XFA_Element::SignData); + CXFA_Node* pNode = + m_pNode->JSNode()->GetProperty(0, XFA_Element::SignData, true); if (!pNode) return; diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp index f3d045ad30..4cce86fd43 100644 --- a/xfa/fxfa/parser/cxfa_fill.cpp +++ b/xfa/fxfa/parser/cxfa_fill.cpp @@ -17,7 +17,8 @@ int32_t CXFA_Fill::GetPresence() { } void CXFA_Fill::SetColor(FX_ARGB color) { - CXFA_Node* pNode = m_pNode->JSNode()->GetProperty(0, XFA_Element::Color); + CXFA_Node* pNode = + m_pNode->JSNode()->GetProperty(0, XFA_Element::Color, true); WideString wsColor; int a; int r; @@ -52,7 +53,8 @@ XFA_Element CXFA_Fill::GetFillType() { } int32_t CXFA_Fill::GetPattern(FX_ARGB& foreColor) { - CXFA_Node* pNode = m_pNode->JSNode()->GetProperty(0, XFA_Element::Pattern); + CXFA_Node* pNode = + m_pNode->JSNode()->GetProperty(0, XFA_Element::Pattern, true); if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { WideStringView wsColor; pColor->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); @@ -64,7 +66,8 @@ int32_t CXFA_Fill::GetPattern(FX_ARGB& foreColor) { } int32_t CXFA_Fill::GetStipple(FX_ARGB& stippleColor) { - CXFA_Node* pNode = m_pNode->JSNode()->GetProperty(0, XFA_Element::Stipple); + CXFA_Node* pNode = + m_pNode->JSNode()->GetProperty(0, XFA_Element::Stipple, true); int32_t eAttr = 50; pNode->JSNode()->TryInteger(XFA_ATTRIBUTE_Rate, eAttr); if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { @@ -78,7 +81,8 @@ int32_t CXFA_Fill::GetStipple(FX_ARGB& stippleColor) { } int32_t CXFA_Fill::GetLinear(FX_ARGB& endColor) { - CXFA_Node* pNode = m_pNode->JSNode()->GetProperty(0, XFA_Element::Linear); + CXFA_Node* pNode = + m_pNode->JSNode()->GetProperty(0, XFA_Element::Linear, true); XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToRight; pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_Type, eAttr); if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { @@ -92,7 +96,8 @@ int32_t CXFA_Fill::GetLinear(FX_ARGB& endColor) { } int32_t CXFA_Fill::GetRadial(FX_ARGB& endColor) { - CXFA_Node* pNode = m_pNode->JSNode()->GetProperty(0, XFA_Element::Radial); + CXFA_Node* pNode = + m_pNode->JSNode()->GetProperty(0, XFA_Element::Radial, true); XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToEdge; pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_Type, eAttr); if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { diff --git a/xfa/fxfa/parser/cxfa_font.cpp b/xfa/fxfa/parser/cxfa_font.cpp index 023a34b387..0e24064ae8 100644 --- a/xfa/fxfa/parser/cxfa_font.cpp +++ b/xfa/fxfa/parser/cxfa_font.cpp @@ -85,7 +85,7 @@ bool CXFA_Font::IsItalic() { } void CXFA_Font::SetColor(FX_ARGB color) { - CXFA_Fill fill(m_pNode->JSNode()->GetProperty(0, XFA_Element::Fill)); + CXFA_Fill fill(m_pNode->JSNode()->GetProperty(0, XFA_Element::Fill, true)); fill.SetColor(color); } diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index f7b2910db2..d3a33e7de9 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -273,7 +273,7 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { return false; m_pTemplatePageSetRoot = - pTemplateNode->JSNode()->GetProperty(0, XFA_Element::PageSet); + pTemplateNode->JSNode()->GetProperty(0, XFA_Element::PageSet, true); ASSERT(m_pTemplatePageSetRoot); if (m_pPageSetLayoutItemRoot) { m_pPageSetLayoutItemRoot->m_pParent = nullptr; diff --git a/xfa/fxfa/parser/cxfa_stroke.cpp b/xfa/fxfa/parser/cxfa_stroke.cpp index 7cf0b2c5fd..15ff71313e 100644 --- a/xfa/fxfa/parser/cxfa_stroke.cpp +++ b/xfa/fxfa/parser/cxfa_stroke.cpp @@ -61,7 +61,8 @@ void CXFA_Stroke::SetColor(FX_ARGB argb) { if (!m_pNode) return; - CXFA_Node* pNode = m_pNode->JSNode()->GetProperty(0, XFA_Element::Color); + CXFA_Node* pNode = + m_pNode->JSNode()->GetProperty(0, XFA_Element::Color, true); WideString wsColor; int a; int r; diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index be052ebce5..a259432dfb 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -61,7 +61,7 @@ CXFA_Node* FormValueNode_CreateChild(CXFA_Node* pValueNode, XFA_Element iType) { if (!pChildNode) { if (iType == XFA_Element::Unknown) return nullptr; - pChildNode = pValueNode->JSNode()->GetProperty(0, iType); + pChildNode = pValueNode->JSNode()->GetProperty(0, iType, true); } return pChildNode; } @@ -129,7 +129,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, CXFA_WidgetData* pWidgetData = pFormNode->GetWidgetData(); ASSERT(pWidgetData); XFA_Element eUIType = pWidgetData->GetUIType(); - CXFA_Value defValue(pFormNode->JSNode()->GetProperty(0, XFA_Element::Value)); + CXFA_Value defValue( + pFormNode->JSNode()->GetProperty(0, XFA_Element::Value, true)); if (!bDataToForm) { WideString wsValue; WideString wsFormattedValue; @@ -236,7 +237,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, continue; CXFA_Node* pValue = - pChild->JSNode()->GetProperty(0, XFA_Element::Value); + pChild->JSNode()->GetProperty(0, XFA_Element::Value, true); CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items); CXFA_Node* pText = pItems ? pItems->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr; @@ -263,7 +264,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, pDataNode->JSNode()->SetAttributeValue(wsValue, wsFormattedValue, false, false); CXFA_Node* pValue = - pFormNode->JSNode()->GetProperty(0, XFA_Element::Value); + pFormNode->JSNode()->GetProperty(0, XFA_Element::Value, true); FormValueNode_SetChildContent(pValue, wsValue, XFA_Element::Float); break; } |