diff options
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_object.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_object.h | 11 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 7 |
4 files changed, 15 insertions, 9 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index ec70271ea0..1d2af4c858 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -586,7 +586,8 @@ CXFA_WidgetAcc* CXFA_Node::GetContainerWidgetAcc() { for (const auto& pFormNode : *(pDataNode->GetBindItems())) { if (!pFormNode || pFormNode->HasRemovedChildren()) continue; - pFieldWidgetAcc = pFormNode->GetWidgetAcc(); + pFieldWidgetAcc = + pFormNode->IsWidgetReady() ? pFormNode->GetWidgetAcc() : nullptr; if (pFieldWidgetAcc) { wsPicture = pFieldWidgetAcc->GetPictureContent(XFA_VALUEPICTURE_DataBind); diff --git a/xfa/fxfa/parser/cxfa_object.cpp b/xfa/fxfa/parser/cxfa_object.cpp index 7c73db0ff5..0c866d350a 100644 --- a/xfa/fxfa/parser/cxfa_object.cpp +++ b/xfa/fxfa/parser/cxfa_object.cpp @@ -56,8 +56,9 @@ const CXFA_TreeList* CXFA_Object::AsTreeList() const { return IsTreeList() ? static_cast<const CXFA_TreeList*>(this) : nullptr; } -void CXFA_Object::CreateWidgetAcc() { +void CXFA_Object::SetWidgetReady() { acc_ = pdfium::MakeUnique<CXFA_WidgetAcc>(AsNode()); + is_widget_ready_ = true; } CXFA_Node* ToNode(CXFA_Object* pObj) { diff --git a/xfa/fxfa/parser/cxfa_object.h b/xfa/fxfa/parser/cxfa_object.h index 5d5f31c647..3843aafb33 100644 --- a/xfa/fxfa/parser/cxfa_object.h +++ b/xfa/fxfa/parser/cxfa_object.h @@ -78,8 +78,13 @@ class CXFA_Object : public CFXJSE_HostObject { m_elementType == XFA_Element::Subform || m_elementType == XFA_Element::ExclGroup; } - void CreateWidgetAcc(); - CXFA_WidgetAcc* GetWidgetAcc() { return acc_.get(); } + void SetWidgetReady(); + bool IsWidgetReady() const { return is_widget_ready_; } + CXFA_WidgetAcc* GetWidgetAcc() { + ASSERT(IsWidgetReady()); + ASSERT(acc_.get() != nullptr); + return acc_.get(); + } XFA_Element GetElementType() const { return m_elementType; } WideStringView GetClassName() const { return m_elementName; } @@ -97,7 +102,7 @@ class CXFA_Object : public CFXJSE_HostObject { UnownedPtr<CXFA_Document> const m_pDocument; const XFA_ObjectType m_objectType; const XFA_Element m_elementType; - + bool is_widget_ready_ = false; const uint32_t m_elementNameHash; const WideStringView m_elementName; diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index f6f165fe59..422ba4e58a 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -70,9 +70,8 @@ CXFA_Node* FormValueNode_CreateChild(CXFA_Node* pValueNode, XFA_Element iType) { } void FormValueNode_MatchNoneCreateChild(CXFA_Node* pFormNode) { - CXFA_WidgetAcc* pWidgetAcc = pFormNode->GetWidgetAcc(); - ASSERT(pWidgetAcc); - pWidgetAcc->GetUIType(); + ASSERT(pFormNode->IsWidgetReady()); + pFormNode->GetWidgetAcc()->GetUIType(); } bool FormValueNode_SetChildContent(CXFA_Node* pValueNode, @@ -132,8 +131,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (eType != XFA_Element::Field && eType != XFA_Element::ExclGroup) return; + ASSERT(pFormNode->IsWidgetReady()); CXFA_WidgetAcc* pWidgetAcc = pFormNode->GetWidgetAcc(); - ASSERT(pWidgetAcc); XFA_Element eUIType = pWidgetAcc->GetUIType(); auto* defValue = pFormNode->JSObject()->GetOrCreateProperty<CXFA_Value>( 0, XFA_Element::Value); |