From c5d5729700a4d145cd298ec52f6f57b2d11aaafe Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Sat, 4 Nov 2017 01:49:37 +0000 Subject: Remove default values from CXFA_Node::{CountChildren|GetChild} This CL removes the default values and inlines into the call sites as needed. Change-Id: I554e9d5ac781003695f90522f9c6c3160653eb59 Reviewed-on: https://pdfium-review.googlesource.com/17572 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fxfa/cxfa_ffdocview.cpp | 21 +++++----- xfa/fxfa/cxfa_ffpageview.cpp | 6 ++- xfa/fxfa/cxfa_textprovider.cpp | 20 ++++++---- xfa/fxfa/cxfa_widgetacc.cpp | 6 +-- xfa/fxfa/parser/cxfa_assist.cpp | 2 +- xfa/fxfa/parser/cxfa_bind.cpp | 2 +- xfa/fxfa/parser/cxfa_box.cpp | 4 +- xfa/fxfa/parser/cxfa_calculate.cpp | 6 +-- xfa/fxfa/parser/cxfa_caption.cpp | 7 ++-- xfa/fxfa/parser/cxfa_dataexporter.cpp | 4 +- xfa/fxfa/parser/cxfa_document.cpp | 2 +- xfa/fxfa/parser/cxfa_event.cpp | 4 +- xfa/fxfa/parser/cxfa_fill.cpp | 10 ++--- xfa/fxfa/parser/cxfa_font.cpp | 2 +- xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 7 ++-- xfa/fxfa/parser/cxfa_line.cpp | 2 +- xfa/fxfa/parser/cxfa_node.h | 7 ++-- xfa/fxfa/parser/cxfa_nodelocale.cpp | 9 +++-- xfa/fxfa/parser/cxfa_stroke.cpp | 2 +- xfa/fxfa/parser/cxfa_validate.cpp | 4 +- xfa/fxfa/parser/cxfa_widgetdata.cpp | 53 ++++++++++++++----------- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 6 +-- xfa/fxfa/parser/xfa_utils.cpp | 4 +- 23 files changed, 102 insertions(+), 88 deletions(-) (limited to 'xfa') diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index a2c4893446..cb2155d374 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -113,7 +113,7 @@ void CXFA_FFDocView::StopLayout() { if (!pRootItem) return; - CXFA_Node* pSubformNode = pRootItem->GetChild(0, XFA_Element::Subform); + CXFA_Node* pSubformNode = pRootItem->GetChild(0, XFA_Element::Subform, false); if (!pSubformNode) return; @@ -269,16 +269,17 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Config)); if (pConfigItem) { CXFA_Node* pValidateNode = nullptr; - CXFA_Node* pAcrobatNode = pConfigItem->GetChild(0, XFA_Element::Acrobat); - pValidateNode = pAcrobatNode - ? pAcrobatNode->GetChild(0, XFA_Element::Validate) - : nullptr; + CXFA_Node* pAcrobatNode = + pConfigItem->GetChild(0, XFA_Element::Acrobat, false); + pValidateNode = + pAcrobatNode ? pAcrobatNode->GetChild(0, XFA_Element::Validate, false) + : nullptr; if (!pValidateNode) { CXFA_Node* pPresentNode = - pConfigItem->GetChild(0, XFA_Element::Present); - pValidateNode = pPresentNode - ? pPresentNode->GetChild(0, XFA_Element::Validate) - : nullptr; + pConfigItem->GetChild(0, XFA_Element::Present, false); + pValidateNode = pPresentNode ? pPresentNode->GetChild( + 0, XFA_Element::Validate, false) + : nullptr; } if (pValidateNode) wsValidateStr = pValidateNode->JSNode()->GetContent(false); @@ -295,7 +296,7 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam, if (!pRootItem) return XFA_EVENTERROR_Error; - pNode = pRootItem->GetChild(0, XFA_Element::Subform); + pNode = pRootItem->GetChild(0, XFA_Element::Subform, false); } ExecEventActivityByDeepFirst(pNode, pParam->m_eType, pParam->m_bIsFormReady, diff --git a/xfa/fxfa/cxfa_ffpageview.cpp b/xfa/fxfa/cxfa_ffpageview.cpp index bd95ba916f..e40b65912e 100644 --- a/xfa/fxfa/cxfa_ffpageview.cpp +++ b/xfa/fxfa/cxfa_ffpageview.cpp @@ -308,9 +308,11 @@ bool CXFA_FFTabOrderPageWidgetIterator::SetCurrentWidget( CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget( CXFA_FFWidget* pWidget) { CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); - CXFA_Node* pTraversal = pAcc->GetNode()->GetChild(0, XFA_Element::Traversal); + CXFA_Node* pTraversal = + pAcc->GetNode()->GetChild(0, XFA_Element::Traversal, false); if (pTraversal) { - CXFA_Node* pTraverse = pTraversal->GetChild(0, XFA_Element::Traverse); + CXFA_Node* pTraverse = + pTraversal->GetChild(0, XFA_Element::Traverse, false); if (pTraverse) { WideString wsTraverseWidgetName; if (pTraverse->JSNode()->GetAttribute(XFA_ATTRIBUTE_Ref, diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp index db220b3f0f..3ac35bb843 100644 --- a/xfa/fxfa/cxfa_textprovider.cpp +++ b/xfa/fxfa/cxfa_textprovider.cpp @@ -37,7 +37,8 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) { if (m_eType == XFA_TEXTPROVIDERTYPE_Text) { CXFA_Node* pElementNode = m_pWidgetAcc->GetNode(); - CXFA_Node* pValueNode = pElementNode->GetChild(0, XFA_Element::Value); + CXFA_Node* pValueNode = + pElementNode->GetChild(0, XFA_Element::Value, false); if (!pValueNode) return nullptr; @@ -71,11 +72,12 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) { if (m_eType == XFA_TEXTPROVIDERTYPE_Caption) { CXFA_Node* pCaptionNode = - m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption); + m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption, false); if (!pCaptionNode) return nullptr; - CXFA_Node* pValueNode = pCaptionNode->GetChild(0, XFA_Element::Value); + CXFA_Node* pValueNode = + pCaptionNode->GetChild(0, XFA_Element::Value, false); if (!pValueNode) return nullptr; @@ -91,7 +93,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) { } CXFA_Node* pItemNode = - m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Items); + m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Items, false); if (!pItemNode) return nullptr; @@ -113,16 +115,18 @@ CXFA_Para CXFA_TextProvider::GetParaNode() { if (m_eType == XFA_TEXTPROVIDERTYPE_Text) return m_pWidgetAcc->GetPara(); - CXFA_Node* pNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption); - return CXFA_Para(pNode->GetChild(0, XFA_Element::Para)); + CXFA_Node* pNode = + m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption, false); + return CXFA_Para(pNode->GetChild(0, XFA_Element::Para, false)); } CXFA_Font CXFA_TextProvider::GetFontNode() { if (m_eType == XFA_TEXTPROVIDERTYPE_Text) return m_pWidgetAcc->GetFont(false); - CXFA_Node* pNode = m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption); - pNode = pNode->GetChild(0, XFA_Element::Font); + CXFA_Node* pNode = + m_pWidgetAcc->GetNode()->GetChild(0, XFA_Element::Caption, false); + pNode = pNode->GetChild(0, XFA_Element::Font, false); return pNode ? CXFA_Font(pNode) : m_pWidgetAcc->GetFont(false); } diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 9dc9603377..e76d1af988 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -218,13 +218,13 @@ void CXFA_WidgetAcc::ResetData() { SetValue(wsValue, XFA_VALUEPICTURE_Raw); pAcc->SetValue(wsValue, XFA_VALUEPICTURE_Raw); } else { - CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items); + CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items, false); if (!pItems) continue; WideString itemText; - if (pItems->CountChildren(XFA_Element::Unknown) > 1) { - itemText = pItems->GetChild(1, XFA_Element::Unknown) + if (pItems->CountChildren(XFA_Element::Unknown, false) > 1) { + itemText = pItems->GetChild(1, XFA_Element::Unknown, false) ->JSNode() ->GetContent(false); } diff --git a/xfa/fxfa/parser/cxfa_assist.cpp b/xfa/fxfa/parser/cxfa_assist.cpp index 809081d960..7d353a56ec 100644 --- a/xfa/fxfa/parser/cxfa_assist.cpp +++ b/xfa/fxfa/parser/cxfa_assist.cpp @@ -11,5 +11,5 @@ CXFA_Assist::CXFA_Assist(CXFA_Node* pNode) : CXFA_Data(pNode) {} CXFA_ToolTip CXFA_Assist::GetToolTip() { - return CXFA_ToolTip(m_pNode->GetChild(0, XFA_Element::ToolTip)); + return CXFA_ToolTip(m_pNode->GetChild(0, XFA_Element::ToolTip, false)); } diff --git a/xfa/fxfa/parser/cxfa_bind.cpp b/xfa/fxfa/parser/cxfa_bind.cpp index a3764d0eaf..1cdeba9a6d 100644 --- a/xfa/fxfa/parser/cxfa_bind.cpp +++ b/xfa/fxfa/parser/cxfa_bind.cpp @@ -11,6 +11,6 @@ CXFA_Bind::CXFA_Bind(CXFA_Node* pNode) : CXFA_Data(pNode) {} void CXFA_Bind::GetPicture(WideString& wsPicture) { - if (CXFA_Node* pPicture = m_pNode->GetChild(0, XFA_Element::Picture)) + if (CXFA_Node* pPicture = m_pNode->GetChild(0, XFA_Element::Picture, false)) pPicture->JSNode()->TryContent(wsPicture, false, true); } diff --git a/xfa/fxfa/parser/cxfa_box.cpp b/xfa/fxfa/parser/cxfa_box.cpp index 3753108243..c0ca723746 100644 --- a/xfa/fxfa/parser/cxfa_box.cpp +++ b/xfa/fxfa/parser/cxfa_box.cpp @@ -90,7 +90,7 @@ int32_t CXFA_Box::GetPresence() const { int32_t CXFA_Box::CountEdges() const { if (!m_pNode) return 0; - return m_pNode->CountChildren(XFA_Element::Edge); + return m_pNode->CountChildren(XFA_Element::Edge, false); } CXFA_Edge CXFA_Box::GetEdge(int32_t nIndex) const { @@ -147,7 +147,7 @@ CXFA_Fill CXFA_Box::GetFill(bool bModified) const { } CXFA_Margin CXFA_Box::GetMargin() const { - return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_Element::Margin) + return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_Element::Margin, false) : nullptr); } diff --git a/xfa/fxfa/parser/cxfa_calculate.cpp b/xfa/fxfa/parser/cxfa_calculate.cpp index 4a51b2d4ef..6f5c8a664a 100644 --- a/xfa/fxfa/parser/cxfa_calculate.cpp +++ b/xfa/fxfa/parser/cxfa_calculate.cpp @@ -18,15 +18,15 @@ int32_t CXFA_Calculate::GetOverride() { } CXFA_Script CXFA_Calculate::GetScript() { - return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script)); + return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script, false)); } void CXFA_Calculate::GetMessageText(WideString& wsMessage) { - CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Message); + CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Message, false); if (!pNode) return; - CXFA_Text text(pNode->GetChild(0, XFA_Element::Text)); + CXFA_Text text(pNode->GetChild(0, XFA_Element::Text, false)); if (text) text.GetContent(wsMessage); } diff --git a/xfa/fxfa/parser/cxfa_caption.cpp b/xfa/fxfa/parser/cxfa_caption.cpp index ccfe606b33..3f820e437e 100644 --- a/xfa/fxfa/parser/cxfa_caption.cpp +++ b/xfa/fxfa/parser/cxfa_caption.cpp @@ -30,15 +30,16 @@ float CXFA_Caption::GetReserve() { } CXFA_Margin CXFA_Caption::GetMargin() { - return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_Element::Margin) + return CXFA_Margin(m_pNode ? m_pNode->GetChild(0, XFA_Element::Margin, false) : nullptr); } CXFA_Font CXFA_Caption::GetFont() { - return CXFA_Font(m_pNode ? m_pNode->GetChild(0, XFA_Element::Font) : nullptr); + return CXFA_Font(m_pNode ? m_pNode->GetChild(0, XFA_Element::Font, false) + : nullptr); } CXFA_Value CXFA_Caption::GetValue() { - return CXFA_Value(m_pNode ? m_pNode->GetChild(0, XFA_Element::Value) + return CXFA_Value(m_pNode ? m_pNode->GetChild(0, XFA_Element::Value, false) : nullptr); } diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp index 70f9513e37..8d48f98b7c 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp @@ -280,8 +280,8 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, if (pNode->GetElementType() == XFA_Element::Items) { CXFA_Node* pTemplateNode = pNode->GetTemplateNode(); if (!pTemplateNode || - pTemplateNode->CountChildren(XFA_Element::Unknown) != - pNode->CountChildren(XFA_Element::Unknown)) { + pTemplateNode->CountChildren(XFA_Element::Unknown, false) != + pNode->CountChildren(XFA_Element::Unknown, false)) { bSaveXML = true; } } diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp index 3d263132d4..0488617b03 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -264,7 +264,7 @@ bool CXFA_Document::IsInteractive() { if (!pPDF) return false; - CXFA_Node* pFormFiller = pPDF->GetChild(0, XFA_Element::Interactive); + CXFA_Node* pFormFiller = pPDF->GetChild(0, XFA_Element::Interactive, false); if (pFormFiller) { m_dwDocFlags |= XFA_DOCFLAG_HasInteractive; if (pFormFiller->JSNode()->TryContent(wsInteractive, false, true) && diff --git a/xfa/fxfa/parser/cxfa_event.cpp b/xfa/fxfa/parser/cxfa_event.cpp index e9f1961f07..8ba68fb294 100644 --- a/xfa/fxfa/parser/cxfa_event.cpp +++ b/xfa/fxfa/parser/cxfa_event.cpp @@ -31,11 +31,11 @@ void CXFA_Event::GetRef(WideStringView& wsRef) { } CXFA_Script CXFA_Event::GetScript() const { - return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script)); + return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script, false)); } CXFA_Submit CXFA_Event::GetSubmit() const { - return CXFA_Submit(m_pNode->GetChild(0, XFA_Element::Submit)); + return CXFA_Submit(m_pNode->GetChild(0, XFA_Element::Submit, false)); } void CXFA_Event::GetSignDataTarget(WideString& wsTarget) { diff --git a/xfa/fxfa/parser/cxfa_fill.cpp b/xfa/fxfa/parser/cxfa_fill.cpp index 49e710bcaa..8430b254a8 100644 --- a/xfa/fxfa/parser/cxfa_fill.cpp +++ b/xfa/fxfa/parser/cxfa_fill.cpp @@ -30,7 +30,7 @@ void CXFA_Fill::SetColor(FX_ARGB color) { } FX_ARGB CXFA_Fill::GetColor(bool bText) { - if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Color)) { + if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Color, false)) { WideStringView wsColor; if (pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsColor, false)) return CXFA_Data::ToColor(wsColor); @@ -55,7 +55,7 @@ XFA_Element CXFA_Fill::GetFillType() { int32_t CXFA_Fill::GetPattern(FX_ARGB& foreColor) { CXFA_Node* pNode = m_pNode->JSNode()->GetProperty(0, XFA_Element::Pattern, true); - if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { + if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color, false)) { WideStringView wsColor; pColor->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); foreColor = CXFA_Data::ToColor(wsColor); @@ -70,7 +70,7 @@ int32_t CXFA_Fill::GetStipple(FX_ARGB& stippleColor) { m_pNode->JSNode()->GetProperty(0, XFA_Element::Stipple, true); int32_t eAttr = 50; pNode->JSNode()->TryInteger(XFA_ATTRIBUTE_Rate, eAttr, true); - if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { + if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color, false)) { WideStringView wsColor; pColor->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); stippleColor = CXFA_Data::ToColor(wsColor); @@ -85,7 +85,7 @@ int32_t CXFA_Fill::GetLinear(FX_ARGB& endColor) { m_pNode->JSNode()->GetProperty(0, XFA_Element::Linear, true); XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToRight; pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_Type, eAttr, true); - if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { + if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color, false)) { WideStringView wsColor; pColor->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); endColor = CXFA_Data::ToColor(wsColor); @@ -100,7 +100,7 @@ int32_t CXFA_Fill::GetRadial(FX_ARGB& endColor) { m_pNode->JSNode()->GetProperty(0, XFA_Element::Radial, true); XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToEdge; pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_Type, eAttr, true); - if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color)) { + if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color, false)) { WideStringView wsColor; pColor->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsColor, false); endColor = CXFA_Data::ToColor(wsColor); diff --git a/xfa/fxfa/parser/cxfa_font.cpp b/xfa/fxfa/parser/cxfa_font.cpp index 2674ac5682..ab0825fbe6 100644 --- a/xfa/fxfa/parser/cxfa_font.cpp +++ b/xfa/fxfa/parser/cxfa_font.cpp @@ -90,6 +90,6 @@ void CXFA_Font::SetColor(FX_ARGB color) { } FX_ARGB CXFA_Font::GetColor() { - CXFA_Fill fill(m_pNode->GetChild(0, XFA_Element::Fill)); + CXFA_Fill fill(m_pNode->GetChild(0, XFA_Element::Fill, false)); return fill ? fill.GetColor(true) : 0xFF000000; } diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index ce9dbf7de0..1b72331608 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -308,7 +308,7 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { return false; CXFA_Document* pDocument = pTemplateNode->GetDocument(); - pPageArea = m_pTemplatePageSetRoot->GetChild(0, XFA_Element::PageArea); + pPageArea = m_pTemplatePageSetRoot->GetChild(0, XFA_Element::PageArea, false); if (!pPageArea) { pPageArea = pDocument->CreateNode(m_pTemplatePageSetRoot->GetPacketID(), XFA_Element::PageArea); @@ -318,7 +318,8 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { m_pTemplatePageSetRoot->InsertChild(pPageArea, nullptr); pPageArea->SetFlag(XFA_NodeFlag_Initialized, true); } - CXFA_Node* pContentArea = pPageArea->GetChild(0, XFA_Element::ContentArea); + CXFA_Node* pContentArea = + pPageArea->GetChild(0, XFA_Element::ContentArea, false); if (!pContentArea) { pContentArea = pDocument->CreateNode(pPageArea->GetPacketID(), XFA_Element::ContentArea); @@ -336,7 +337,7 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { pContentArea->JSNode()->SetMeasure( XFA_ATTRIBUTE_H, CXFA_Measurement(10.5f, XFA_UNIT_In), false); } - CXFA_Node* pMedium = pPageArea->GetChild(0, XFA_Element::Medium); + CXFA_Node* pMedium = pPageArea->GetChild(0, XFA_Element::Medium, false); if (!pMedium) { pMedium = pDocument->CreateNode(pPageArea->GetPacketID(), XFA_Element::Medium); diff --git a/xfa/fxfa/parser/cxfa_line.cpp b/xfa/fxfa/parser/cxfa_line.cpp index 0de7bcd8a2..85f38a2822 100644 --- a/xfa/fxfa/parser/cxfa_line.cpp +++ b/xfa/fxfa/parser/cxfa_line.cpp @@ -18,5 +18,5 @@ bool CXFA_Line::GetSlope() { } CXFA_Edge CXFA_Line::GetEdge() { - return CXFA_Edge(m_pNode->GetChild(0, XFA_Element::Edge)); + return CXFA_Edge(m_pNode->GetChild(0, XFA_Element::Edge, false)); } diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h index d8472eb3e9..fa9bab46ed 100644 --- a/xfa/fxfa/parser/cxfa_node.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -97,13 +97,12 @@ class CXFA_Node : public CXFA_Object { CXFA_Node* GetModelNode(); void UpdateNameHash(); - int32_t CountChildren(XFA_Element eType, bool bOnlyChild = false); - CXFA_Node* GetChild(int32_t index, - XFA_Element eType, - bool bOnlyChild = false); + int32_t CountChildren(XFA_Element eType, bool bOnlyChild); + CXFA_Node* GetChild(int32_t index, XFA_Element eType, bool bOnlyChild); int32_t InsertChild(int32_t index, CXFA_Node* pNode); bool InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode = nullptr); bool RemoveChild(CXFA_Node* pNode, bool bNotify = true); + CXFA_Node* Clone(bool bRecursive); CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const; CXFA_Node* GetNodeItem(XFA_NODEITEM eItem, XFA_ObjectType eType) const; diff --git a/xfa/fxfa/parser/cxfa_nodelocale.cpp b/xfa/fxfa/parser/cxfa_nodelocale.cpp index 7a941dff66..7bbbba22b9 100644 --- a/xfa/fxfa/parser/cxfa_nodelocale.cpp +++ b/xfa/fxfa/parser/cxfa_nodelocale.cpp @@ -69,7 +69,7 @@ WideString CXFA_NodeLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const { WideString CXFA_NodeLocale::GetDateTimeSymbols() const { CXFA_Node* pSymbols = - m_pLocale ? m_pLocale->GetChild(0, XFA_Element::DateTimeSymbols) + m_pLocale ? m_pLocale->GetChild(0, XFA_Element::DateTimeSymbols, false) : nullptr; return pSymbols ? pSymbols->JSNode()->GetContent(false) : WideString(); } @@ -147,7 +147,8 @@ CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent, WideString CXFA_NodeLocale::GetSymbol(XFA_Element eElement, const WideStringView& symbol_type) const { - CXFA_Node* pSymbols = m_pLocale ? m_pLocale->GetChild(0, eElement) : nullptr; + CXFA_Node* pSymbols = + m_pLocale ? m_pLocale->GetChild(0, eElement, false) : nullptr; CXFA_Node* pSymbol = GetNodeByName(pSymbols, symbol_type); return pSymbol ? pSymbol->JSNode()->GetContent(false) : WideString(); } @@ -156,7 +157,7 @@ WideString CXFA_NodeLocale::GetCalendarSymbol(XFA_Element eElement, int index, bool bAbbr) const { CXFA_Node* pCalendar = - m_pLocale ? m_pLocale->GetChild(0, XFA_Element::CalendarSymbols) + m_pLocale ? m_pLocale->GetChild(0, XFA_Element::CalendarSymbols, false) : nullptr; if (!pCalendar) return WideString(); @@ -164,7 +165,7 @@ WideString CXFA_NodeLocale::GetCalendarSymbol(XFA_Element eElement, CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement); for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) { if (pNode->JSNode()->GetBoolean(XFA_ATTRIBUTE_Abbr) == bAbbr) { - CXFA_Node* pSymbol = pNode->GetChild(index, XFA_Element::Unknown); + CXFA_Node* pSymbol = pNode->GetChild(index, XFA_Element::Unknown, false); return pSymbol ? pSymbol->JSNode()->GetContent(false) : WideString(); } } diff --git a/xfa/fxfa/parser/cxfa_stroke.cpp b/xfa/fxfa/parser/cxfa_stroke.cpp index 753527c263..17b269fda3 100644 --- a/xfa/fxfa/parser/cxfa_stroke.cpp +++ b/xfa/fxfa/parser/cxfa_stroke.cpp @@ -48,7 +48,7 @@ FX_ARGB CXFA_Stroke::GetColor() const { if (!m_pNode) return 0xFF000000; - CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Color); + CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Color, false); if (!pNode) return 0xFF000000; diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp index 513d6b45c1..5af92b8415 100644 --- a/xfa/fxfa/parser/cxfa_validate.cpp +++ b/xfa/fxfa/parser/cxfa_validate.cpp @@ -114,10 +114,10 @@ void CXFA_Validate::SetScriptMessageText(WideString wsMessage) { } void CXFA_Validate::GetPicture(WideString& wsPicture) { - if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Picture)) + if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Picture, false)) pNode->JSNode()->TryContent(wsPicture, false, true); } CXFA_Script CXFA_Validate::GetScript() { - return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script)); + return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script, false)); } diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index d65eff473c..1828961027 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -162,8 +162,8 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { switch (pUIChild->GetElementType()) { case XFA_Element::CheckButton: { eValueType = XFA_Element::Text; - if (CXFA_Node* pItems = pNode->GetChild(0, XFA_Element::Items)) { - if (CXFA_Node* pItem = pItems->GetChild(0, XFA_Element::Unknown)) + if (CXFA_Node* pItems = pNode->GetChild(0, XFA_Element::Items, false)) { + if (CXFA_Node* pItem = pItems->GetChild(0, XFA_Element::Unknown, false)) eValueType = pItem->GetElementType(); } break; @@ -441,7 +441,7 @@ int32_t CXFA_WidgetData::GetButtonHighlight() { bool CXFA_WidgetData::GetButtonRollover(WideString& wsRollover, bool& bRichText) { - if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items)) { + if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items, false)) { CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); while (pText) { WideStringView wsName; @@ -458,7 +458,7 @@ bool CXFA_WidgetData::GetButtonRollover(WideString& wsRollover, } bool CXFA_WidgetData::GetButtonDown(WideString& wsDown, bool& bRichText) { - if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items)) { + if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items, false)) { CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); while (pText) { WideStringView wsName; @@ -520,7 +520,7 @@ XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() { if (wsValue.IsEmpty()) return XFA_CHECKSTATE_Off; - if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items)) { + if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items, false)) { CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); int32_t i = 0; while (pText) { @@ -542,7 +542,7 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { if (exclGroup) { WideString wsValue; if (eCheckState != XFA_CHECKSTATE_Off) { - if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items)) { + if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items, false)) { CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); if (pText) pText->JSNode()->TryContent(wsValue, false, true); @@ -554,7 +554,7 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { if (pChild->GetElementType() != XFA_Element::Field) continue; - CXFA_Node* pItem = pChild->GetChild(0, XFA_Element::Items); + CXFA_Node* pItem = pChild->GetChild(0, XFA_Element::Items, false); if (!pItem) continue; @@ -576,7 +576,7 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { } exclGroup.SyncValue(wsValue, bNotify); } else { - CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items); + CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items, false); if (!pItems) return; @@ -643,7 +643,7 @@ void CXFA_WidgetData::SetSelectedMemberByValue(const WideStringView& wsValue, if (pNode->GetElementType() != XFA_Element::Field) continue; - CXFA_Node* pItem = pNode->GetChild(0, XFA_Element::Items); + CXFA_Node* pItem = pNode->GetChild(0, XFA_Element::Items, false); if (!pItem) continue; @@ -750,7 +750,7 @@ int32_t CXFA_WidgetData::CountChoiceListItems(bool bSaveValue) { if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave) pItem = pItems[1]; } - return pItem->CountChildren(XFA_Element::Unknown); + return pItem->CountChildren(XFA_Element::Unknown, false); } bool CXFA_WidgetData::GetChoiceListItem(WideString& wsText, @@ -782,7 +782,7 @@ bool CXFA_WidgetData::GetChoiceListItem(WideString& wsText, pItems = pItemsArray[1]; } if (pItems) { - CXFA_Node* pItem = pItems->GetChild(nIndex, XFA_Element::Unknown); + CXFA_Node* pItem = pItems->GetChild(nIndex, XFA_Element::Unknown, false); if (pItem) { pItem->JSNode()->TryContent(wsText, false, true); return true; @@ -1071,7 +1071,7 @@ void CXFA_WidgetData::GetItemLabel(const WideStringView& wsValue, if (iSearch < 0) return; if (CXFA_Node* pText = - pLabelItems->GetChild(iSearch, XFA_Element::Unknown)) { + pLabelItems->GetChild(iSearch, XFA_Element::Unknown, false)) { pText->JSNode()->TryContent(wsLabel, false, true); } } @@ -1115,8 +1115,10 @@ void CXFA_WidgetData::GetItemValue(const WideStringView& wsLabel, } if (iSearch < 0) return; - if (CXFA_Node* pText = pSaveItems->GetChild(iSearch, XFA_Element::Unknown)) + if (CXFA_Node* pText = + pSaveItems->GetChild(iSearch, XFA_Element::Unknown, false)) { pText->JSNode()->TryContent(wsValue, false, true); + } } } @@ -1166,7 +1168,7 @@ int32_t CXFA_WidgetData::GetNumberOfCells() { CXFA_Node* pUIChild = GetUIChild(); if (!pUIChild) return -1; - if (CXFA_Node* pNode = pUIChild->GetChild(0, XFA_Element::Comb)) + if (CXFA_Node* pNode = pUIChild->GetChild(0, XFA_Element::Comb, false)) return pNode->JSNode()->GetInteger(XFA_ATTRIBUTE_NumberOfCells); return -1; } @@ -1390,7 +1392,7 @@ int32_t CXFA_WidgetData::GetVerticalScrollPolicy() { } int32_t CXFA_WidgetData::GetMaxChars(XFA_Element& eType) { - if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Value)) { + if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Value, false)) { if (CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) { switch (pChild->GetElementType()) { case XFA_Element::Text: @@ -1412,11 +1414,11 @@ int32_t CXFA_WidgetData::GetMaxChars(XFA_Element& eType) { bool CXFA_WidgetData::GetFracDigits(int32_t& iFracDigits) { iFracDigits = -1; - CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Value); + CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Value, false); if (!pNode) return false; - CXFA_Node* pChild = pNode->GetChild(0, XFA_Element::Decimal); + CXFA_Node* pChild = pNode->GetChild(0, XFA_Element::Decimal, false); if (!pChild) return false; @@ -1427,11 +1429,11 @@ bool CXFA_WidgetData::GetFracDigits(int32_t& iFracDigits) { bool CXFA_WidgetData::GetLeadDigits(int32_t& iLeadDigits) { iLeadDigits = -1; - CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Value); + CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Value, false); if (!pNode) return false; - CXFA_Node* pChild = pNode->GetChild(0, XFA_Element::Decimal); + CXFA_Node* pChild = pNode->GetChild(0, XFA_Element::Decimal, false); if (!pChild) return false; @@ -1502,8 +1504,10 @@ bool CXFA_WidgetData::GetPictureContent(WideString& wsPicture, CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(this); switch (ePicture) { case XFA_VALUEPICTURE_Display: { - if (CXFA_Node* pFormat = m_pNode->GetChild(0, XFA_Element::Format)) { - if (CXFA_Node* pPicture = pFormat->GetChild(0, XFA_Element::Picture)) { + if (CXFA_Node* pFormat = + m_pNode->GetChild(0, XFA_Element::Format, false)) { + if (CXFA_Node* pPicture = + pFormat->GetChild(0, XFA_Element::Picture, false)) { if (pPicture->JSNode()->TryContent(wsPicture, false, true)) return true; } @@ -1538,9 +1542,10 @@ bool CXFA_WidgetData::GetPictureContent(WideString& wsPicture, return true; } case XFA_VALUEPICTURE_Edit: { - CXFA_Node* pUI = m_pNode->GetChild(0, XFA_Element::Ui); + CXFA_Node* pUI = m_pNode->GetChild(0, XFA_Element::Ui, false); if (pUI) { - if (CXFA_Node* pPicture = pUI->GetChild(0, XFA_Element::Picture)) { + if (CXFA_Node* pPicture = + pUI->GetChild(0, XFA_Element::Picture, false)) { if (pPicture->JSNode()->TryContent(wsPicture, false, true)) return true; } @@ -1703,7 +1708,7 @@ bool CXFA_WidgetData::GetFormatDataValue(const WideString& wsValue, if (IFX_Locale* pLocale = GetLocal()) { ASSERT(GetNode()); - CXFA_Node* pNodeValue = GetNode()->GetChild(0, XFA_Element::Value); + CXFA_Node* pNodeValue = GetNode()->GetChild(0, XFA_Element::Value, false); if (!pNodeValue) return false; diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 2ed6c7288a..78d2397c5b 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -203,7 +203,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (pChild->GetElementType() != XFA_Element::Field) continue; - CXFA_Node* pValue = pChild->GetChild(0, XFA_Element::Value); + CXFA_Node* pValue = pChild->GetChild(0, XFA_Element::Value, false); if (!pValue) continue; @@ -212,7 +212,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (wsValue.IsEmpty()) continue; - CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items); + CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items, false); if (!pItems) continue; @@ -244,7 +244,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, CXFA_Node* pValue = pChild->JSNode()->GetProperty(0, XFA_Element::Value, true); - CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items); + CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items, false); CXFA_Node* pText = pItems ? pItems->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr; if (pText) diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp index 45cbbd5b18..2ee675013c 100644 --- a/xfa/fxfa/parser/xfa_utils.cpp +++ b/xfa/fxfa/parser/xfa_utils.cpp @@ -130,7 +130,7 @@ int XFA_GetMaxFractionalScale() { CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData) { CXFA_Node* pNodeValue = - pWidgetData->GetNode()->GetChild(0, XFA_Element::Value); + pWidgetData->GetNode()->GetChild(0, XFA_Element::Value, false); if (!pNodeValue) { return CXFA_LocaleValue(); } @@ -216,7 +216,7 @@ bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode) { if (!pFieldNode) return bRet; - CXFA_Node* pUIChild = pFieldNode->GetChild(0, XFA_Element::Ui); + CXFA_Node* pUIChild = pFieldNode->GetChild(0, XFA_Element::Ui, false); if (pUIChild) { CXFA_Node* pFirstChild = pUIChild->GetNodeItem(XFA_NODEITEM_FirstChild); if (pFirstChild && -- cgit v1.2.3