chromium/third_party/pdfium/xfa/fxfa/parser/cxfa_node.cpp

// Copyright 2016 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#include "xfa/fxfa/parser/cxfa_node.h"

#include <math.h>
#include <stdint.h>

#include <algorithm>
#include <array>
#include <map>
#include <memory>
#include <set>
#include <utility>
#include <vector>

#include "core/fxcrt/autorestorer.h"
#include "core/fxcrt/cfx_read_only_string_stream.h"
#include "core/fxcrt/cfx_read_only_vector_stream.h"
#include "core/fxcrt/check.h"
#include "core/fxcrt/check_op.h"
#include "core/fxcrt/containers/contains.h"
#include "core/fxcrt/data_vector.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_extension.h"
#include "core/fxcrt/notreached.h"
#include "core/fxcrt/span.h"
#include "core/fxcrt/stl_util.h"
#include "core/fxcrt/xml/cfx_xmldocument.h"
#include "core/fxcrt/xml/cfx_xmlelement.h"
#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "core/fxcrt/xml/cfx_xmltext.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/fx_font.h"
#include "fxjs/gc/container_trace.h"
#include "fxjs/xfa/cfxjse_engine.h"
#include "fxjs/xfa/cfxjse_value.h"
#include "fxjs/xfa/cjx_node.h"
#include "xfa/fde/cfde_textout.h"
#include "xfa/fgas/crt/cfgas_decimal.h"
#include "xfa/fgas/crt/locale_iface.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fgas/font/cfgas_gefont.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffapp.h"
#include "xfa/fxfa/cxfa_ffdocview.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
#include "xfa/fxfa/cxfa_fontmgr.h"
#include "xfa/fxfa/cxfa_textprovider.h"
#include "xfa/fxfa/parser/cxfa_accessiblecontent.h"
#include "xfa/fxfa/parser/cxfa_acrobat.h"
#include "xfa/fxfa/parser/cxfa_acrobat7.h"
#include "xfa/fxfa/parser/cxfa_adbe_jsconsole.h"
#include "xfa/fxfa/parser/cxfa_adbe_jsdebugger.h"
#include "xfa/fxfa/parser/cxfa_addsilentprint.h"
#include "xfa/fxfa/parser/cxfa_addviewerpreferences.h"
#include "xfa/fxfa/parser/cxfa_adjustdata.h"
#include "xfa/fxfa/parser/cxfa_adobeextensionlevel.h"
#include "xfa/fxfa/parser/cxfa_agent.h"
#include "xfa/fxfa/parser/cxfa_alwaysembed.h"
#include "xfa/fxfa/parser/cxfa_amd.h"
#include "xfa/fxfa/parser/cxfa_appearancefilter.h"
#include "xfa/fxfa/parser/cxfa_arc.h"
#include "xfa/fxfa/parser/cxfa_area.h"
#include "xfa/fxfa/parser/cxfa_arraynodelist.h"
#include "xfa/fxfa/parser/cxfa_assist.h"
#include "xfa/fxfa/parser/cxfa_attachnodelist.h"
#include "xfa/fxfa/parser/cxfa_attributes.h"
#include "xfa/fxfa/parser/cxfa_autosave.h"
#include "xfa/fxfa/parser/cxfa_barcode.h"
#include "xfa/fxfa/parser/cxfa_base.h"
#include "xfa/fxfa/parser/cxfa_batchoutput.h"
#include "xfa/fxfa/parser/cxfa_behavioroverride.h"
#include "xfa/fxfa/parser/cxfa_bind.h"
#include "xfa/fxfa/parser/cxfa_binditems.h"
#include "xfa/fxfa/parser/cxfa_bookend.h"
#include "xfa/fxfa/parser/cxfa_boolean.h"
#include "xfa/fxfa/parser/cxfa_border.h"
#include "xfa/fxfa/parser/cxfa_break.h"
#include "xfa/fxfa/parser/cxfa_breakafter.h"
#include "xfa/fxfa/parser/cxfa_breakbefore.h"
#include "xfa/fxfa/parser/cxfa_button.h"
#include "xfa/fxfa/parser/cxfa_cache.h"
#include "xfa/fxfa/parser/cxfa_calculate.h"
#include "xfa/fxfa/parser/cxfa_calendarsymbols.h"
#include "xfa/fxfa/parser/cxfa_caption.h"
#include "xfa/fxfa/parser/cxfa_certificate.h"
#include "xfa/fxfa/parser/cxfa_certificates.h"
#include "xfa/fxfa/parser/cxfa_change.h"
#include "xfa/fxfa/parser/cxfa_checkbutton.h"
#include "xfa/fxfa/parser/cxfa_choicelist.h"
#include "xfa/fxfa/parser/cxfa_color.h"
#include "xfa/fxfa/parser/cxfa_comb.h"
#include "xfa/fxfa/parser/cxfa_command.h"
#include "xfa/fxfa/parser/cxfa_common.h"
#include "xfa/fxfa/parser/cxfa_compress.h"
#include "xfa/fxfa/parser/cxfa_compression.h"
#include "xfa/fxfa/parser/cxfa_compresslogicalstructure.h"
#include "xfa/fxfa/parser/cxfa_compressobjectstream.h"
#include "xfa/fxfa/parser/cxfa_config.h"
#include "xfa/fxfa/parser/cxfa_conformance.h"
#include "xfa/fxfa/parser/cxfa_connect.h"
#include "xfa/fxfa/parser/cxfa_connectionset.h"
#include "xfa/fxfa/parser/cxfa_connectstring.h"
#include "xfa/fxfa/parser/cxfa_contentarea.h"
#include "xfa/fxfa/parser/cxfa_contentcopy.h"
#include "xfa/fxfa/parser/cxfa_copies.h"
#include "xfa/fxfa/parser/cxfa_corner.h"
#include "xfa/fxfa/parser/cxfa_creator.h"
#include "xfa/fxfa/parser/cxfa_currencysymbol.h"
#include "xfa/fxfa/parser/cxfa_currencysymbols.h"
#include "xfa/fxfa/parser/cxfa_currentpage.h"
#include "xfa/fxfa/parser/cxfa_data.h"
#include "xfa/fxfa/parser/cxfa_datagroup.h"
#include "xfa/fxfa/parser/cxfa_datamodel.h"
#include "xfa/fxfa/parser/cxfa_datavalue.h"
#include "xfa/fxfa/parser/cxfa_date.h"
#include "xfa/fxfa/parser/cxfa_datepattern.h"
#include "xfa/fxfa/parser/cxfa_datepatterns.h"
#include "xfa/fxfa/parser/cxfa_datetime.h"
#include "xfa/fxfa/parser/cxfa_datetimeedit.h"
#include "xfa/fxfa/parser/cxfa_datetimesymbols.h"
#include "xfa/fxfa/parser/cxfa_day.h"
#include "xfa/fxfa/parser/cxfa_daynames.h"
#include "xfa/fxfa/parser/cxfa_debug.h"
#include "xfa/fxfa/parser/cxfa_decimal.h"
#include "xfa/fxfa/parser/cxfa_defaulttypeface.h"
#include "xfa/fxfa/parser/cxfa_defaultui.h"
#include "xfa/fxfa/parser/cxfa_delete.h"
#include "xfa/fxfa/parser/cxfa_delta.h"
#include "xfa/fxfa/parser/cxfa_desc.h"
#include "xfa/fxfa/parser/cxfa_destination.h"
#include "xfa/fxfa/parser/cxfa_digestmethod.h"
#include "xfa/fxfa/parser/cxfa_digestmethods.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_document_builder.h"
#include "xfa/fxfa/parser/cxfa_documentassembly.h"
#include "xfa/fxfa/parser/cxfa_draw.h"
#include "xfa/fxfa/parser/cxfa_driver.h"
#include "xfa/fxfa/parser/cxfa_dsigdata.h"
#include "xfa/fxfa/parser/cxfa_duplexoption.h"
#include "xfa/fxfa/parser/cxfa_dynamicrender.h"
#include "xfa/fxfa/parser/cxfa_edge.h"
#include "xfa/fxfa/parser/cxfa_effectiveinputpolicy.h"
#include "xfa/fxfa/parser/cxfa_effectiveoutputpolicy.h"
#include "xfa/fxfa/parser/cxfa_embed.h"
#include "xfa/fxfa/parser/cxfa_encoding.h"
#include "xfa/fxfa/parser/cxfa_encodings.h"
#include "xfa/fxfa/parser/cxfa_encrypt.h"
#include "xfa/fxfa/parser/cxfa_encryption.h"
#include "xfa/fxfa/parser/cxfa_encryptionlevel.h"
#include "xfa/fxfa/parser/cxfa_encryptionmethod.h"
#include "xfa/fxfa/parser/cxfa_encryptionmethods.h"
#include "xfa/fxfa/parser/cxfa_enforce.h"
#include "xfa/fxfa/parser/cxfa_equate.h"
#include "xfa/fxfa/parser/cxfa_equaterange.h"
#include "xfa/fxfa/parser/cxfa_era.h"
#include "xfa/fxfa/parser/cxfa_eranames.h"
#include "xfa/fxfa/parser/cxfa_event.h"
#include "xfa/fxfa/parser/cxfa_exclgroup.h"
#include "xfa/fxfa/parser/cxfa_exclude.h"
#include "xfa/fxfa/parser/cxfa_excludens.h"
#include "xfa/fxfa/parser/cxfa_exdata.h"
#include "xfa/fxfa/parser/cxfa_execute.h"
#include "xfa/fxfa/parser/cxfa_exobject.h"
#include "xfa/fxfa/parser/cxfa_extras.h"
#include "xfa/fxfa/parser/cxfa_field.h"
#include "xfa/fxfa/parser/cxfa_fill.h"
#include "xfa/fxfa/parser/cxfa_filter.h"
#include "xfa/fxfa/parser/cxfa_fliplabel.h"
#include "xfa/fxfa/parser/cxfa_float.h"
#include "xfa/fxfa/parser/cxfa_font.h"
#include "xfa/fxfa/parser/cxfa_fontinfo.h"
#include "xfa/fxfa/parser/cxfa_form.h"
#include "xfa/fxfa/parser/cxfa_format.h"
#include "xfa/fxfa/parser/cxfa_formfieldfilling.h"
#include "xfa/fxfa/parser/cxfa_groupparent.h"
#include "xfa/fxfa/parser/cxfa_handler.h"
#include "xfa/fxfa/parser/cxfa_hyphenation.h"
#include "xfa/fxfa/parser/cxfa_ifempty.h"
#include "xfa/fxfa/parser/cxfa_image.h"
#include "xfa/fxfa/parser/cxfa_imageedit.h"
#include "xfa/fxfa/parser/cxfa_includexdpcontent.h"
#include "xfa/fxfa/parser/cxfa_incrementalload.h"
#include "xfa/fxfa/parser/cxfa_incrementalmerge.h"
#include "xfa/fxfa/parser/cxfa_insert.h"
#include "xfa/fxfa/parser/cxfa_instancemanager.h"
#include "xfa/fxfa/parser/cxfa_integer.h"
#include "xfa/fxfa/parser/cxfa_interactive.h"
#include "xfa/fxfa/parser/cxfa_issuers.h"
#include "xfa/fxfa/parser/cxfa_items.h"
#include "xfa/fxfa/parser/cxfa_jog.h"
#include "xfa/fxfa/parser/cxfa_keep.h"
#include "xfa/fxfa/parser/cxfa_keyusage.h"
#include "xfa/fxfa/parser/cxfa_labelprinter.h"
#include "xfa/fxfa/parser/cxfa_layout.h"
#include "xfa/fxfa/parser/cxfa_level.h"
#include "xfa/fxfa/parser/cxfa_line.h"
#include "xfa/fxfa/parser/cxfa_linear.h"
#include "xfa/fxfa/parser/cxfa_linearized.h"
#include "xfa/fxfa/parser/cxfa_locale.h"
#include "xfa/fxfa/parser/cxfa_localeset.h"
#include "xfa/fxfa/parser/cxfa_localevalue.h"
#include "xfa/fxfa/parser/cxfa_lockdocument.h"
#include "xfa/fxfa/parser/cxfa_log.h"
#include "xfa/fxfa/parser/cxfa_manifest.h"
#include "xfa/fxfa/parser/cxfa_map.h"
#include "xfa/fxfa/parser/cxfa_margin.h"
#include "xfa/fxfa/parser/cxfa_mdp.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
#include "xfa/fxfa/parser/cxfa_medium.h"
#include "xfa/fxfa/parser/cxfa_mediuminfo.h"
#include "xfa/fxfa/parser/cxfa_meridiem.h"
#include "xfa/fxfa/parser/cxfa_meridiemnames.h"
#include "xfa/fxfa/parser/cxfa_message.h"
#include "xfa/fxfa/parser/cxfa_messaging.h"
#include "xfa/fxfa/parser/cxfa_mode.h"
#include "xfa/fxfa/parser/cxfa_modifyannots.h"
#include "xfa/fxfa/parser/cxfa_month.h"
#include "xfa/fxfa/parser/cxfa_monthnames.h"
#include "xfa/fxfa/parser/cxfa_msgid.h"
#include "xfa/fxfa/parser/cxfa_nameattr.h"
#include "xfa/fxfa/parser/cxfa_neverembed.h"
#include "xfa/fxfa/parser/cxfa_nodeiteratortemplate.h"
#include "xfa/fxfa/parser/cxfa_numberofcopies.h"
#include "xfa/fxfa/parser/cxfa_numberpattern.h"
#include "xfa/fxfa/parser/cxfa_numberpatterns.h"
#include "xfa/fxfa/parser/cxfa_numbersymbol.h"
#include "xfa/fxfa/parser/cxfa_numbersymbols.h"
#include "xfa/fxfa/parser/cxfa_numericedit.h"
#include "xfa/fxfa/parser/cxfa_occur.h"
#include "xfa/fxfa/parser/cxfa_oid.h"
#include "xfa/fxfa/parser/cxfa_oids.h"
#include "xfa/fxfa/parser/cxfa_openaction.h"
#include "xfa/fxfa/parser/cxfa_operation.h"
#include "xfa/fxfa/parser/cxfa_output.h"
#include "xfa/fxfa/parser/cxfa_outputbin.h"
#include "xfa/fxfa/parser/cxfa_outputxsl.h"
#include "xfa/fxfa/parser/cxfa_overflow.h"
#include "xfa/fxfa/parser/cxfa_overprint.h"
#include "xfa/fxfa/parser/cxfa_packet.h"
#include "xfa/fxfa/parser/cxfa_packets.h"
#include "xfa/fxfa/parser/cxfa_pagearea.h"
#include "xfa/fxfa/parser/cxfa_pageoffset.h"
#include "xfa/fxfa/parser/cxfa_pagerange.h"
#include "xfa/fxfa/parser/cxfa_pageset.h"
#include "xfa/fxfa/parser/cxfa_pagination.h"
#include "xfa/fxfa/parser/cxfa_paginationoverride.h"
#include "xfa/fxfa/parser/cxfa_para.h"
#include "xfa/fxfa/parser/cxfa_part.h"
#include "xfa/fxfa/parser/cxfa_password.h"
#include "xfa/fxfa/parser/cxfa_passwordedit.h"
#include "xfa/fxfa/parser/cxfa_pattern.h"
#include "xfa/fxfa/parser/cxfa_pcl.h"
#include "xfa/fxfa/parser/cxfa_pdf.h"
#include "xfa/fxfa/parser/cxfa_pdfa.h"
#include "xfa/fxfa/parser/cxfa_permissions.h"
#include "xfa/fxfa/parser/cxfa_picktraybypdfsize.h"
#include "xfa/fxfa/parser/cxfa_picture.h"
#include "xfa/fxfa/parser/cxfa_plaintextmetadata.h"
#include "xfa/fxfa/parser/cxfa_presence.h"
#include "xfa/fxfa/parser/cxfa_present.h"
#include "xfa/fxfa/parser/cxfa_print.h"
#include "xfa/fxfa/parser/cxfa_printername.h"
#include "xfa/fxfa/parser/cxfa_printhighquality.h"
#include "xfa/fxfa/parser/cxfa_printscaling.h"
#include "xfa/fxfa/parser/cxfa_producer.h"
#include "xfa/fxfa/parser/cxfa_proto.h"
#include "xfa/fxfa/parser/cxfa_ps.h"
#include "xfa/fxfa/parser/cxfa_psmap.h"
#include "xfa/fxfa/parser/cxfa_query.h"
#include "xfa/fxfa/parser/cxfa_radial.h"
#include "xfa/fxfa/parser/cxfa_range.h"
#include "xfa/fxfa/parser/cxfa_reason.h"
#include "xfa/fxfa/parser/cxfa_reasons.h"
#include "xfa/fxfa/parser/cxfa_record.h"
#include "xfa/fxfa/parser/cxfa_recordset.h"
#include "xfa/fxfa/parser/cxfa_rectangle.h"
#include "xfa/fxfa/parser/cxfa_ref.h"
#include "xfa/fxfa/parser/cxfa_relevant.h"
#include "xfa/fxfa/parser/cxfa_rename.h"
#include "xfa/fxfa/parser/cxfa_renderpolicy.h"
#include "xfa/fxfa/parser/cxfa_rootelement.h"
#include "xfa/fxfa/parser/cxfa_runscripts.h"
#include "xfa/fxfa/parser/cxfa_script.h"
#include "xfa/fxfa/parser/cxfa_scriptmodel.h"
#include "xfa/fxfa/parser/cxfa_select.h"
#include "xfa/fxfa/parser/cxfa_setproperty.h"
#include "xfa/fxfa/parser/cxfa_severity.h"
#include "xfa/fxfa/parser/cxfa_sharptext.h"
#include "xfa/fxfa/parser/cxfa_sharpxhtml.h"
#include "xfa/fxfa/parser/cxfa_sharpxml.h"
#include "xfa/fxfa/parser/cxfa_signature.h"
#include "xfa/fxfa/parser/cxfa_signatureproperties.h"
#include "xfa/fxfa/parser/cxfa_signdata.h"
#include "xfa/fxfa/parser/cxfa_signing.h"
#include "xfa/fxfa/parser/cxfa_silentprint.h"
#include "xfa/fxfa/parser/cxfa_soapaction.h"
#include "xfa/fxfa/parser/cxfa_soapaddress.h"
#include "xfa/fxfa/parser/cxfa_solid.h"
#include "xfa/fxfa/parser/cxfa_source.h"
#include "xfa/fxfa/parser/cxfa_sourceset.h"
#include "xfa/fxfa/parser/cxfa_speak.h"
#include "xfa/fxfa/parser/cxfa_staple.h"
#include "xfa/fxfa/parser/cxfa_startnode.h"
#include "xfa/fxfa/parser/cxfa_startpage.h"
#include "xfa/fxfa/parser/cxfa_stipple.h"
#include "xfa/fxfa/parser/cxfa_stroke.h"
#include "xfa/fxfa/parser/cxfa_subform.h"
#include "xfa/fxfa/parser/cxfa_subformset.h"
#include "xfa/fxfa/parser/cxfa_subjectdn.h"
#include "xfa/fxfa/parser/cxfa_subjectdns.h"
#include "xfa/fxfa/parser/cxfa_submit.h"
#include "xfa/fxfa/parser/cxfa_submitformat.h"
#include "xfa/fxfa/parser/cxfa_submiturl.h"
#include "xfa/fxfa/parser/cxfa_subsetbelow.h"
#include "xfa/fxfa/parser/cxfa_suppressbanner.h"
#include "xfa/fxfa/parser/cxfa_tagged.h"
#include "xfa/fxfa/parser/cxfa_template.h"
#include "xfa/fxfa/parser/cxfa_templatecache.h"
#include "xfa/fxfa/parser/cxfa_text.h"
#include "xfa/fxfa/parser/cxfa_textedit.h"
#include "xfa/fxfa/parser/cxfa_threshold.h"
#include "xfa/fxfa/parser/cxfa_time.h"
#include "xfa/fxfa/parser/cxfa_timepattern.h"
#include "xfa/fxfa/parser/cxfa_timepatterns.h"
#include "xfa/fxfa/parser/cxfa_timestamp.h"
#include "xfa/fxfa/parser/cxfa_to.h"
#include "xfa/fxfa/parser/cxfa_tooltip.h"
#include "xfa/fxfa/parser/cxfa_trace.h"
#include "xfa/fxfa/parser/cxfa_transform.h"
#include "xfa/fxfa/parser/cxfa_traversal.h"
#include "xfa/fxfa/parser/cxfa_traverse.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h"
#include "xfa/fxfa/parser/cxfa_type.h"
#include "xfa/fxfa/parser/cxfa_typeface.h"
#include "xfa/fxfa/parser/cxfa_typefaces.h"
#include "xfa/fxfa/parser/cxfa_ui.h"
#include "xfa/fxfa/parser/cxfa_update.h"
#include "xfa/fxfa/parser/cxfa_uri.h"
#include "xfa/fxfa/parser/cxfa_user.h"
#include "xfa/fxfa/parser/cxfa_validate.h"
#include "xfa/fxfa/parser/cxfa_validateapprovalsignatures.h"
#include "xfa/fxfa/parser/cxfa_validationmessaging.h"
#include "xfa/fxfa/parser/cxfa_value.h"
#include "xfa/fxfa/parser/cxfa_variables.h"
#include "xfa/fxfa/parser/cxfa_version.h"
#include "xfa/fxfa/parser/cxfa_versioncontrol.h"
#include "xfa/fxfa/parser/cxfa_viewerpreferences.h"
#include "xfa/fxfa/parser/cxfa_webclient.h"
#include "xfa/fxfa/parser/cxfa_whitespace.h"
#include "xfa/fxfa/parser/cxfa_window.h"
#include "xfa/fxfa/parser/cxfa_wsdladdress.h"
#include "xfa/fxfa/parser/cxfa_wsdlconnection.h"
#include "xfa/fxfa/parser/cxfa_xdc.h"
#include "xfa/fxfa/parser/cxfa_xdp.h"
#include "xfa/fxfa/parser/cxfa_xfa.h"
#include "xfa/fxfa/parser/cxfa_xmlconnection.h"
#include "xfa/fxfa/parser/cxfa_xsdconnection.h"
#include "xfa/fxfa/parser/cxfa_xsl.h"
#include "xfa/fxfa/parser/cxfa_zpl.h"
#include "xfa/fxfa/parser/xfa_basic_data.h"
#include "xfa/fxfa/parser/xfa_utils.h"

class CXFA_FieldLayoutData;
class CXFA_ImageEditData;
class CXFA_ImageLayoutData;
class CXFA_TextEditData;
class CXFA_TextLayoutData;

namespace {

constexpr uint8_t kMaxExecuteRecursion =;

constexpr std::array<const uint8_t, 128> kInvBase64 =;

inline uint8_t GetInvBase64(uint8_t x) {}

DataVector<uint8_t> XFA_RemoveBase64Whitespace(
    pdfium::span<const uint8_t> spStr) {}

DataVector<uint8_t> XFA_Base64Decode(const ByteString& bsStr) {}

FXCODEC_IMAGE_TYPE XFA_GetImageType(const WideString& wsType) {}

RetainPtr<CFX_DIBitmap> XFA_LoadImageData(CXFA_FFDoc* pDoc,
                                          CXFA_Image* pImage,
                                          bool& bNameImage,
                                          int32_t& iImageXDpi,
                                          int32_t& iImageYDpi) {}

bool SplitDateTime(const WideString& wsDateTime,
                   WideString& wsDate,
                   WideString& wsTime) {}

// Stack allocated. Using containers of members would be correct here
// if advanced GC worked with STL.
NodeSet;
NodeSetPair;
NodeSetPairMap;
NodeSetPairMapMap;
NodeVector;

NodeVector NodesSortedByDocumentIdx(const NodeSet& rgNodeSet) {}

NodeSetPair* NodeSetPairForNode(CXFA_Node* pNode, NodeSetPairMapMap* pMap) {}

void ReorderDataNodes(const NodeSet& sSet1,
                      const NodeSet& sSet2,
                      bool bInsertBefore) {}

float GetEdgeThickness(const std::vector<CXFA_Stroke*>& strokes,
                       bool b3DStyle,
                       int32_t nIndex) {}

WideString FormatNumStr(const WideString& wsValue, LocaleIface* pLocale) {}

CXFA_Node* FindFirstSiblingNamedInList(CXFA_Node* parent,
                                       uint32_t dwNameHash,
                                       Mask<XFA_NodeFilter> dwFilter);
CXFA_Node* FindFirstSiblingOfClassInList(CXFA_Node* parent,
                                         XFA_Element element,
                                         Mask<XFA_NodeFilter> dwFilter);

CXFA_Node* FindFirstSiblingNamed(CXFA_Node* parent, uint32_t dwNameHash) {}

CXFA_Node* FindFirstSiblingNamedInList(CXFA_Node* parent,
                                       uint32_t dwNameHash,
                                       Mask<XFA_NodeFilter> dwFilter) {}

CXFA_Node* FindFirstSiblingOfClass(CXFA_Node* parent, XFA_Element element) {}

CXFA_Node* FindFirstSiblingOfClassInList(CXFA_Node* parent,
                                         XFA_Element element,
                                         Mask<XFA_NodeFilter> dwFilter) {}

WideString GetNameExpressionSinglePath(CXFA_Node* pNode) {}

void TraverseSiblings(CXFA_Node* parent,
                      uint32_t dwNameHash,
                      std::vector<CXFA_Node*>* pSiblings,
                      bool bIsClassName) {}

void TraversePropertiesOrSiblings(CXFA_Node* parent,
                                  uint32_t dwNameHash,
                                  std::vector<CXFA_Node*>* pSiblings,
                                  bool bIsClassName) {}

}  // namespace

class CXFA_WidgetLayoutData
    : public cppgc::GarbageCollected<CXFA_WidgetLayoutData> {};

class CXFA_TextLayoutData final : public CXFA_WidgetLayoutData {};

class CXFA_ImageLayoutData final : public CXFA_WidgetLayoutData {};

class CXFA_FieldLayoutData : public CXFA_WidgetLayoutData {};

class CXFA_TextEditData final : public CXFA_FieldLayoutData {};

class CXFA_ImageEditData final : public CXFA_FieldLayoutData {};

CXFA_Node::CXFA_Node(CXFA_Document* pDoc,
                     XFA_PacketType ePacket,
                     Mask<XFA_XDPPACKET> validPackets,
                     XFA_ObjectType oType,
                     XFA_Element eType,
                     pdfium::span<const PropertyData> properties,
                     pdfium::span<const AttributeData> attributes,
                     CJX_Object* js_object)
    :{}

CXFA_Node::~CXFA_Node() = default;

void CXFA_Node::Trace(cppgc::Visitor* visitor) const {}

CXFA_Node* CXFA_Node::Clone(bool bRecursive) {}

CXFA_Node* CXFA_Node::GetNextContainerSibling() const {}

CXFA_Node* CXFA_Node::GetPrevContainerSibling() const {}

CXFA_Node* CXFA_Node::GetFirstContainerChild() const {}

CXFA_Node* CXFA_Node::GetContainerParent() const {}

bool CXFA_Node::IsValidInPacket(XFA_PacketType packet) const {}

const CXFA_Node::PropertyData* CXFA_Node::GetPropertyData(
    XFA_Element property) const {}

bool CXFA_Node::HasProperty(XFA_Element property) const {}

bool CXFA_Node::HasPropertyFlag(XFA_Element property,
                                XFA_PropertyFlag flag) const {}

uint8_t CXFA_Node::PropertyOccurrenceCount(XFA_Element property) const {}

std::pair<CXFA_Node*, int32_t> CXFA_Node::GetProperty(
    int32_t index,
    XFA_Element eProperty) const {}

CXFA_Node* CXFA_Node::GetOrCreateProperty(int32_t index,
                                          XFA_Element eProperty) {}

std::optional<XFA_Element> CXFA_Node::GetFirstPropertyWithFlag(
    XFA_PropertyFlag flag) const {}

const CXFA_Node::AttributeData* CXFA_Node::GetAttributeData(
    XFA_Attribute attr) const {}

bool CXFA_Node::HasAttribute(XFA_Attribute attr) const {}

XFA_Attribute CXFA_Node::GetAttribute(size_t i) const {}

XFA_AttributeType CXFA_Node::GetAttributeType(XFA_Attribute type) const {}

std::vector<CXFA_Node*> CXFA_Node::GetNodeListForType(XFA_Element eTypeFilter) {}

std::vector<CXFA_Node*> CXFA_Node::GetNodeListWithFilter(
    Mask<XFA_NodeFilter> dwFilter) {}

CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_Element eType) {}

CXFA_Node* CXFA_Node::CloneTemplateToForm(bool bRecursive) {}

CXFA_Node* CXFA_Node::GetTemplateNodeIfExists() const {}

void CXFA_Node::SetTemplateNode(CXFA_Node* pTemplateNode) {}

CXFA_Node* CXFA_Node::GetBindData() {}

std::vector<CXFA_Node*> CXFA_Node::GetBindItemsCopy() const {}

void CXFA_Node::AddBindItem(CXFA_Node* pFormNode) {}

bool CXFA_Node::RemoveBindItem(CXFA_Node* pFormNode) {}

bool CXFA_Node::HasBindItem() const {}

CXFA_Node* CXFA_Node::GetContainerNode() {}

GCedLocaleIface* CXFA_Node::GetLocale() {}

std::optional<WideString> CXFA_Node::GetLocaleName() {}

XFA_AttributeValue CXFA_Node::GetIntact() {}

WideString CXFA_Node::GetNameExpression() {}

CXFA_Node* CXFA_Node::GetDataDescriptionNode() {}

void CXFA_Node::SetDataDescriptionNode(CXFA_Node* pDataDescriptionNode) {}

CXFA_Node* CXFA_Node::GetModelNode() {}

size_t CXFA_Node::CountChildren(XFA_Element eType, bool bOnlyChild) {}

CXFA_Node* CXFA_Node::GetChildInternal(size_t index,
                                       XFA_Element eType,
                                       bool bOnlyChild) const {}

bool CXFA_Node::IsAncestorOf(const CXFA_Node* that) const {}

void CXFA_Node::InsertChildAndNotify(int32_t index, CXFA_Node* pNode) {}

void CXFA_Node::InsertChildAndNotify(CXFA_Node* pNode, CXFA_Node* pBeforeNode) {}

void CXFA_Node::RemoveChildAndNotify(CXFA_Node* pNode, bool bNotify) {}

CXFA_Node* CXFA_Node::GetFirstChildByName(WideStringView wsName) const {}

CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const {}

CXFA_Node* CXFA_Node::GetFirstChildByClassInternal(XFA_Element eType) const {}

CXFA_Node* CXFA_Node::GetNextSameNameSibling(uint32_t dwNameHash) const {}

CXFA_Node* CXFA_Node::GetNextSameNameSiblingInternal(
    WideStringView wsNodeName) const {}

CXFA_Node* CXFA_Node::GetNextSameClassSiblingInternal(XFA_Element eType) const {}

CXFA_Node* CXFA_Node::GetOneChildNamed(WideStringView wsName) {}

CXFA_Node* CXFA_Node::GetOneChildOfClass(WideStringView wsClass) {}

std::vector<CXFA_Node*> CXFA_Node::GetSiblings(bool bIsClassName) {}

size_t CXFA_Node::GetIndex(bool bIsProperty, bool bIsClassIndex) {}

size_t CXFA_Node::GetIndexByName() {}

size_t CXFA_Node::GetIndexByClassName() {}

CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() {}

CXFA_Occur* CXFA_Node::GetOccurIfExists() {}

bool CXFA_Node::HasFlag(XFA_NodeFlag dwFlag) const {}

void CXFA_Node::SetInitializedFlagAndNotify() {}

void CXFA_Node::SetFlag(XFA_NodeFlag dwFlag) {}

void CXFA_Node::ClearFlag(XFA_NodeFlag dwFlag) {}

bool CXFA_Node::IsAttributeInXML() {}

void CXFA_Node::OnRemoved(bool bNotify) const {}

void CXFA_Node::UpdateNameHash() {}

CFX_XMLNode* CXFA_Node::CreateXMLMappingNode() {}

bool CXFA_Node::IsNeedSavingXMLNode() const {}

CXFA_Node* CXFA_Node::GetItemIfExists(int32_t iIndex) {}

int32_t CXFA_Node::GetCount() {}

void CXFA_Node::InsertItem(CXFA_Node* pNewInstance,
                           int32_t iPos,
                           int32_t iCount,
                           bool bMoveDataBindingNodes) {}

void CXFA_Node::RemoveItem(CXFA_Node* pRemoveInstance,
                           bool bRemoveDataBinding) {}

CXFA_Node* CXFA_Node::CreateInstanceIfPossible(bool bDataMerge) {}

std::optional<bool> CXFA_Node::GetDefaultBoolean(XFA_Attribute attr) const {}

std::optional<int32_t> CXFA_Node::GetDefaultInteger(XFA_Attribute attr) const {}

std::optional<CXFA_Measurement> CXFA_Node::GetDefaultMeasurement(
    XFA_Attribute attr) const {}

std::optional<WideString> CXFA_Node::GetDefaultCData(XFA_Attribute attr) const {}

std::optional<XFA_AttributeValue> CXFA_Node::GetDefaultEnum(
    XFA_Attribute attr) const {}

std::optional<void*> CXFA_Node::GetDefaultValue(XFA_Attribute attr,
                                                XFA_AttributeType eType) const {}

void CXFA_Node::SendAttributeChangeMessage(XFA_Attribute eAttribute,
                                           bool bScriptModify) {}

void CXFA_Node::SyncValue(const WideString& wsValue, bool bNotify) {}

WideString CXFA_Node::GetRawValue() const {}

int32_t CXFA_Node::GetRotate() const {}

CXFA_Border* CXFA_Node::GetBorderIfExists() const {}

CXFA_Border* CXFA_Node::GetOrCreateBorderIfPossible() {}

CXFA_Caption* CXFA_Node::GetCaptionIfExists() const {}

CXFA_Font* CXFA_Node::GetOrCreateFontIfPossible() {}

CXFA_Font* CXFA_Node::GetFontIfExists() const {}

float CXFA_Node::GetFontSize() const {}

float CXFA_Node::GetLineHeight() const {}

FX_ARGB CXFA_Node::GetTextColor() const {}

CXFA_Margin* CXFA_Node::GetMarginIfExists() const {}

CXFA_Para* CXFA_Node::GetParaIfExists() const {}

bool CXFA_Node::IsOpenAccess() const {}

CXFA_Value* CXFA_Node::GetDefaultValueIfExists() {}

CXFA_Value* CXFA_Node::GetFormValueIfExists() const {}

CXFA_Calculate* CXFA_Node::GetCalculateIfExists() const {}

CXFA_Validate* CXFA_Node::GetValidateIfExists() const {}

CXFA_Validate* CXFA_Node::GetOrCreateValidateIfPossible() {}

CXFA_Bind* CXFA_Node::GetBindIfExists() const {}

std::optional<XFA_AttributeValue> CXFA_Node::GetIntactFromKeep(
    const CXFA_Keep* pKeep,
    XFA_AttributeValue eLayoutType) const {}

std::optional<float> CXFA_Node::TryWidth() {}

std::optional<float> CXFA_Node::TryHeight() {}

std::optional<float> CXFA_Node::TryMinWidth() {}

std::optional<float> CXFA_Node::TryMinHeight() {}

std::optional<float> CXFA_Node::TryMaxWidth() {}

std::optional<float> CXFA_Node::TryMaxHeight() {}

CXFA_Node* CXFA_Node::GetExclGroupIfExists() {}

XFA_EventError CXFA_Node::ProcessEvent(CXFA_FFDocView* pDocView,
                                       XFA_AttributeValue iActivity,
                                       CXFA_EventParam* pEventParam) {}

XFA_EventError CXFA_Node::ProcessEventInternal(CXFA_FFDocView* pDocView,
                                               XFA_AttributeValue iActivity,
                                               CXFA_Event* event,
                                               CXFA_EventParam* pEventParam) {}

XFA_EventError CXFA_Node::ProcessCalculate(CXFA_FFDocView* pDocView) {}

void CXFA_Node::ProcessScriptTestValidate(CXFA_FFDocView* pDocView,
                                          CXFA_Validate* validate,
                                          bool bVersionFlag) {}

XFA_EventError CXFA_Node::ProcessFormatTestValidate(CXFA_FFDocView* pDocView,
                                                    CXFA_Validate* validate,
                                                    bool bVersionFlag) {}

XFA_EventError CXFA_Node::ProcessNullTestValidate(CXFA_FFDocView* pDocView,
                                                  CXFA_Validate* validate,
                                                  int32_t iFlags,
                                                  bool bVersionFlag) {}

XFA_EventError CXFA_Node::ProcessValidate(CXFA_FFDocView* pDocView,
                                          int32_t iFlags) {}

WideString CXFA_Node::GetValidateCaptionName(bool bVersionFlag) {}

WideString CXFA_Node::GetValidateMessage(bool bError, bool bVersionFlag) {}

XFA_EventError CXFA_Node::ExecuteScript(CXFA_FFDocView* pDocView,
                                        CXFA_Script* script,
                                        CXFA_EventParam* pEventParam) {}

CXFA_Node::BoolScriptResult CXFA_Node::ExecuteBoolScript(
    CXFA_FFDocView* pDocView,
    CXFA_Script* script,
    CXFA_EventParam* pEventParam) {}

std::pair<XFA_FFWidgetType, CXFA_Ui*>
CXFA_Node::CreateChildUIAndValueNodesIfNeeded() {}

XFA_FFWidgetType CXFA_Node::GetDefaultFFWidgetType() const {}

CXFA_Node* CXFA_Node::CreateUINodeIfNeeded(CXFA_Ui* ui, XFA_Element type) {}

void CXFA_Node::CreateValueNodeIfNeeded(CXFA_Value* value,
                                        CXFA_Node* pUIChild) {}

XFA_Element CXFA_Node::GetValueNodeType() const {}

CXFA_Node* CXFA_Node::GetUIChildNode() {}

XFA_FFWidgetType CXFA_Node::GetFFWidgetType() {}

CXFA_Border* CXFA_Node::GetUIBorder() {}

CFX_RectF CXFA_Node::GetUIMargin() {}

std::vector<CXFA_Event*> CXFA_Node::GetEventByActivity(
    XFA_AttributeValue iActivity,
    bool bIsFormReady) {}

void CXFA_Node::ResetData() {}

void CXFA_Node::SetImageEdit(const WideString& wsContentType,
                             const WideString& wsHref,
                             const WideString& wsData) {}

void CXFA_Node::CalcCaptionSize(CXFA_FFDoc* doc, CFX_SizeF* pszCap) {}

bool CXFA_Node::CalculateFieldAutoSize(CXFA_FFDoc* doc, CFX_SizeF* pSize) {}

bool CXFA_Node::CalculateWidgetAutoSize(CFX_SizeF* pSize) {}

void CXFA_Node::CalculateTextContentSize(CXFA_FFDoc* doc, CFX_SizeF* pSize) {}

bool CXFA_Node::CalculateTextEditAutoSize(CXFA_FFDoc* doc, CFX_SizeF* pSize) {}

bool CXFA_Node::CalculateCheckButtonAutoSize(CXFA_FFDoc* doc,
                                             CFX_SizeF* pSize) {}

bool CXFA_Node::CalculatePushButtonAutoSize(CXFA_FFDoc* doc, CFX_SizeF* pSize) {}

CFX_SizeF CXFA_Node::CalculateImageSize(float img_width,
                                        float img_height,
                                        const CFX_Size& dpi) {}

bool CXFA_Node::CalculateImageAutoSize(CXFA_FFDoc* doc, CFX_SizeF* pSize) {}

bool CXFA_Node::CalculateImageEditAutoSize(CXFA_FFDoc* doc, CFX_SizeF* pSize) {}

bool CXFA_Node::LoadLayoutImage(CXFA_FFDoc* doc) {}

bool CXFA_Node::LoadEditImage(CXFA_FFDoc* doc) {}

CFX_Size CXFA_Node::GetLayoutImageDpi() const {}

CFX_Size CXFA_Node::GetEditImageDpi() const {}

float CXFA_Node::CalculateWidgetAutoWidth(float fWidthCalc) {}

float CXFA_Node::GetWidthWithoutMargin(float fWidthCalc) const {}

float CXFA_Node::CalculateWidgetAutoHeight(float fHeightCalc) {}

float CXFA_Node::GetHeightWithoutMargin(float fHeightCalc) const {}

void CXFA_Node::StartWidgetLayout(CXFA_FFDoc* doc,
                                  float* pCalcWidth,
                                  float* pCalcHeight) {}

CFX_SizeF CXFA_Node::CalculateAccWidthAndHeight(CXFA_FFDoc* doc, float fWidth) {}

std::optional<float> CXFA_Node::FindSplitPos(CXFA_FFDocView* pDocView,
                                             size_t szBlockIndex,
                                             float fCalcHeight) {}

void CXFA_Node::InitLayoutData(CXFA_FFDoc* doc) {}

void CXFA_Node::StartTextLayout(CXFA_FFDoc* doc,
                                float* pCalcWidth,
                                float* pCalcHeight) {}

bool CXFA_Node::LoadCaption(CXFA_FFDoc* doc) {}

CXFA_TextLayout* CXFA_Node::GetCaptionTextLayout() {}

CXFA_TextLayout* CXFA_Node::GetTextLayout() {}

RetainPtr<CFX_DIBitmap> CXFA_Node::GetLayoutImage() {}

RetainPtr<CFX_DIBitmap> CXFA_Node::GetEditImage() {}

void CXFA_Node::SetLayoutImage(RetainPtr<CFX_DIBitmap> newImage) {}

void CXFA_Node::SetEditImage(RetainPtr<CFX_DIBitmap> newImage) {}

RetainPtr<CFGAS_GEFont> CXFA_Node::GetFGASFont(CXFA_FFDoc* doc) {}

bool CXFA_Node::HasButtonRollover() const {}

bool CXFA_Node::HasButtonDown() const {}

bool CXFA_Node::IsRadioButton() {}

float CXFA_Node::GetCheckButtonSize() {}

XFA_CheckState CXFA_Node::GetCheckState() {}

void CXFA_Node::SetCheckState(XFA_CheckState eCheckState) {}

CXFA_Node* CXFA_Node::GetSelectedMember() {}

CXFA_Node* CXFA_Node::SetSelectedMember(WideStringView wsName) {}

void CXFA_Node::SetSelectedMemberByValue(WideStringView wsValue,
                                         bool bNotify,
                                         bool bScriptModify,
                                         bool bSyncData) {}

CXFA_Node* CXFA_Node::GetExclGroupFirstMember() {}

CXFA_Node* CXFA_Node::GetExclGroupNextMember(CXFA_Node* pNode) {}

bool CXFA_Node::IsChoiceListCommitOnSelect() {}

bool CXFA_Node::IsChoiceListAllowTextEntry() {}

bool CXFA_Node::IsChoiceListMultiSelect() {}

bool CXFA_Node::IsListBox() {}

size_t CXFA_Node::CountChoiceListItems(bool bSaveValue) {}

std::optional<WideString> CXFA_Node::GetChoiceListItem(int32_t nIndex,
                                                       bool bSaveValue) {}

std::vector<WideString> CXFA_Node::GetChoiceListItems(bool bSaveValue) {}

int32_t CXFA_Node::CountSelectedItems() {}

int32_t CXFA_Node::GetSelectedItem(int32_t nIndex) {}

std::vector<int32_t> CXFA_Node::GetSelectedItems() {}

std::vector<WideString> CXFA_Node::GetSelectedItemsValue() {}

bool CXFA_Node::GetItemState(int32_t nIndex) {}

void CXFA_Node::SetItemState(int32_t nIndex,
                             bool bSelected,
                             bool bNotify,
                             bool bScriptModify) {}

void CXFA_Node::SetSelectedItems(const std::vector<int32_t>& iSelArray,
                                 bool bNotify,
                                 bool bScriptModify,
                                 bool bSyncData) {}

void CXFA_Node::ClearAllSelections() {}

void CXFA_Node::InsertItem(const WideString& wsLabel,
                           const WideString& wsValue,
                           bool bNotify) {}

WideString CXFA_Node::GetItemLabel(WideStringView wsValue) const {}

WideString CXFA_Node::GetItemValue(WideStringView wsLabel) {}

bool CXFA_Node::DeleteItem(int32_t nIndex, bool bNotify, bool bScriptModify) {}

bool CXFA_Node::IsHorizontalScrollPolicyOff() {}

bool CXFA_Node::IsVerticalScrollPolicyOff() {}

std::optional<int32_t> CXFA_Node::GetNumberOfCells() {}

bool CXFA_Node::IsMultiLine() {}

std::pair<XFA_Element, int32_t> CXFA_Node::GetMaxChars() const {}

int32_t CXFA_Node::GetFracDigits() const {}

int32_t CXFA_Node::GetLeadDigits() const {}

bool CXFA_Node::SetValue(XFA_ValuePicture eValueType,
                         const WideString& wsValue) {}

WideString CXFA_Node::GetPictureContent(XFA_ValuePicture ePicture) {}

WideString CXFA_Node::GetValue(XFA_ValuePicture eValueType) {}

WideString CXFA_Node::GetNormalizeDataValue(const WideString& wsValue) {}

WideString CXFA_Node::GetFormatDataValue(const WideString& wsValue) {}

WideString CXFA_Node::NormalizeNumStr(const WideString& wsValue) {}

void CXFA_Node::InsertListTextItem(CXFA_Node* pItems,
                                   const WideString& wsText,
                                   int32_t nIndex) {}

WideString CXFA_Node::NumericLimit(const WideString& wsValue) {}

bool CXFA_Node::IsTransparent() const {}

bool CXFA_Node::IsProperty() const {}

bool CXFA_Node::PresenceRequiresSpace() const {}

void CXFA_Node::SetBindingNode(CXFA_Node* node) {}

void CXFA_Node::SetNodeAndDescendantsUnused() {}

void CXFA_Node::SetToXML(const WideString& value) {}

CXFA_Node* CXFA_Node::GetTransparentParent() {}

CFX_XMLDocument* CXFA_Node::GetXMLDocument() const {}

// static
CXFA_Node* CXFA_Node::Create(CXFA_Document* doc,
                             XFA_Element element,
                             XFA_PacketType packet) {}