#include "xfa/fxfa/parser/cxfa_document.h"
#include <set>
#include <utility>
#include "core/fxcrt/check.h"
#include "core/fxcrt/check_op.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/notreached.h"
#include "core/fxcrt/stl_util.h"
#include "core/fxcrt/xml/cfx_xmldocument.h"
#include "core/fxcrt/xml/cfx_xmlelement.h"
#include "fxjs/gc/container_trace.h"
#include "fxjs/xfa/cfxjse_engine.h"
#include "fxjs/xfa/cfxjse_resolveprocessor.h"
#include "fxjs/xfa/cjx_object.h"
#include "xfa/fxfa/cxfa_ffdoc.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
#include "xfa/fxfa/parser/cscript_datawindow.h"
#include "xfa/fxfa/parser/cscript_eventpseudomodel.h"
#include "xfa/fxfa/parser/cscript_hostpseudomodel.h"
#include "xfa/fxfa/parser/cscript_layoutpseudomodel.h"
#include "xfa/fxfa/parser/cscript_logpseudomodel.h"
#include "xfa/fxfa/parser/cscript_signaturepseudomodel.h"
#include "xfa/fxfa/parser/cxfa_bind.h"
#include "xfa/fxfa/parser/cxfa_datagroup.h"
#include "xfa/fxfa/parser/cxfa_exdata.h"
#include "xfa/fxfa/parser/cxfa_form.h"
#include "xfa/fxfa/parser/cxfa_image.h"
#include "xfa/fxfa/parser/cxfa_interactive.h"
#include "xfa/fxfa/parser/cxfa_items.h"
#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_occur.h"
#include "xfa/fxfa/parser/cxfa_pageset.h"
#include "xfa/fxfa/parser/cxfa_pdf.h"
#include "xfa/fxfa/parser/cxfa_present.h"
#include "xfa/fxfa/parser/cxfa_subform.h"
#include "xfa/fxfa/parser/cxfa_template.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h"
#include "xfa/fxfa/parser/cxfa_value.h"
#include "xfa/fxfa/parser/xfa_document_datamerger_imp.h"
#include "xfa/fxfa/parser/xfa_utils.h"
namespace {
const wchar_t kTemplateNS[] = …;
struct RecurseRecord { … };
class CXFA_TraverseStrategy_DDGroup { … };
void FormValueNode_MatchNoneCreateChild(CXFA_Node* pFormNode) { … }
CXFA_Node* FormValueNode_CreateChild(CXFA_Node* pValueNode, XFA_Element iType) { … }
void FormValueNode_SetChildContent(CXFA_Node* pValueNode,
const WideString& wsContent,
XFA_Element iType) { … }
void MergeNodeRecurse(CXFA_Node* pDestNodeParent, CXFA_Node* pProtoNode) { … }
void MergeNode(CXFA_Node* pDestNode, CXFA_Node* pProtoNode) { … }
CXFA_Node* CloneOrMergeInstanceManager(CXFA_Document* pDocument,
CXFA_Node* pFormParent,
CXFA_Node* pTemplateNode,
std::vector<CXFA_Node*>* subforms) { … }
void SortRecurseRecord(std::vector<RecurseRecord>* rgRecords,
CXFA_Node* pDataScope,
bool bChoiceMode) { … }
CXFA_Node* ScopeMatchGlobalBinding(CXFA_Node* pDataScope,
uint32_t dwNameHash,
XFA_Element eMatchDataNodeType,
bool bUpLevel) { … }
CXFA_Node* FindGlobalDataNode(CXFA_Document* pDocument,
const WideString& wsName,
CXFA_Node* pDataScope,
XFA_Element eMatchNodeType) { … }
CXFA_Node* FindOnceDataNode(const WideString& wsName,
CXFA_Node* pDataScope,
XFA_Element eMatchNodeType) { … }
CXFA_Node* FindDataRefDataNode(CXFA_Document* pDocument,
const WideString& wsRef,
CXFA_Node* pDataScope,
XFA_Element eMatchNodeType,
CXFA_Node* pTemplateNode,
bool bForceBind,
bool bUpLevel) { … }
CXFA_Node* FindMatchingDataNode(
CXFA_Document* pDocument,
CXFA_Node* pTemplateNode,
CXFA_Node* pDataScope,
bool& bAccessedDataDOM,
bool bForceBind,
CXFA_NodeIteratorTemplate<CXFA_Node,
CXFA_TraverseStrategy_XFAContainerNode>*
pIterator,
bool& bSelfMatch,
XFA_AttributeValue& eBindMatch,
bool bUpLevel) { … }
void CreateDataBinding(CXFA_Node* pFormNode,
CXFA_Node* pDataNode,
bool bDataToForm) { … }
CXFA_Node* MaybeCreateDataNode(CXFA_Document* pDocument,
CXFA_Node* pDataParent,
XFA_Element eNodeType,
const WideString& wsName) { … }
CXFA_Node* CopyContainer_Field(CXFA_Document* pDocument,
CXFA_Node* pTemplateNode,
CXFA_Node* pFormNode,
CXFA_Node* pDataScope,
bool bDataMerge,
bool bUpLevel) { … }
CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument,
CXFA_Node* pTemplateNode,
CXFA_Node* pFormParentNode,
CXFA_Node* pDataScope,
bool bOneInstance,
bool bDataMerge) { … }
void UpdateBindingRelations(CXFA_Document* pDocument,
CXFA_Node* pFormNode,
CXFA_Node* pDataScope,
bool bDataRef,
bool bParentDataRef) { … }
void UpdateDataRelation(CXFA_Node* pDataNode, CXFA_Node* pDataDescriptionNode) { … }
}
CXFA_Document::CXFA_Document(CXFA_FFNotify* notify,
cppgc::Heap* heap,
LayoutProcessorIface* pLayout)
: … { … }
CXFA_Document::~CXFA_Document() = default;
void CXFA_Document::Trace(cppgc::Visitor* visitor) const { … }
void CXFA_Document::ClearLayoutData() { … }
CXFA_Object* CXFA_Document::GetXFAObject(XFA_HashCode dwNodeNameHash) { … }
CXFA_Node* CXFA_Document::CreateNode(XFA_PacketType packet,
XFA_Element eElement) { … }
bool CXFA_Document::IsInteractive() { … }
CXFA_LocaleMgr* CXFA_Document::GetLocaleMgr() { … }
cppgc::Heap* CXFA_Document::GetHeap() const { … }
CFXJSE_Engine* CXFA_Document::InitScriptContext(CJS_Runtime* fxjs_runtime) { … }
CFXJSE_Engine* CXFA_Document::GetScriptContext() const { … }
XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber(
const WideString& wsTemplateNS) { … }
XFA_VERSION CXFA_Document::ParseXFAVersion(const WideString& wsTemplateNS) { … }
FormType CXFA_Document::GetFormType() const { … }
CXFA_Node* CXFA_Document::GetNodeByID(CXFA_Node* pRoot,
WideStringView wsID) const { … }
void CXFA_Document::DoProtoMerge() { … }
void CXFA_Document::ParseUseHref(const WideString& wsUseVal,
WideStringView& wsURI,
WideStringView& wsID,
WideStringView& wsSOM) { … }
void CXFA_Document::ParseUse(const WideString& wsUseVal,
WideStringView& wsID,
WideStringView& wsSOM) { … }
CXFA_Node* CXFA_Document::DataMerge_CopyContainer(CXFA_Node* pTemplateNode,
CXFA_Node* pFormNode,
CXFA_Node* pDataScope,
bool bOneInstance,
bool bDataMerge,
bool bUpLevel) { … }
void CXFA_Document::DataMerge_UpdateBindingRelations(
CXFA_Node* pFormUpdateRoot) { … }
CXFA_Node* CXFA_Document::GetNotBindNode(
pdfium::span<cppgc::Member<CXFA_Object>> arrayObjects) const { … }
void CXFA_Document::DoDataMerge() { … }
void CXFA_Document::DoDataRemerge() { … }
CXFA_Node* CXFA_Document::GetGlobalBinding(uint32_t dwNameHash) { … }
void CXFA_Document::RegisterGlobalBinding(uint32_t dwNameHash,
CXFA_Node* pDataNode) { … }
size_t CXFA_Document::GetPendingNodesCount() const { … }
CXFA_Node* CXFA_Document::GetPendingNodeAtIndex(size_t index) const { … }
void CXFA_Document::AppendPendingNode(CXFA_Node* node) { … }
void CXFA_Document::ClearPendingNodes() { … }
void CXFA_Document::SetPendingNodesUnusedAndUnbound() { … }
CXFA_Document::LayoutProcessorIface::LayoutProcessorIface() = default;
CXFA_Document::LayoutProcessorIface::~LayoutProcessorIface() = default;
void CXFA_Document::LayoutProcessorIface::Trace(cppgc::Visitor* visitor) const { … }