7#include "fxjs/xfa/cjx_packet.h"
11#include "core/fxcrt/span.h"
12#include "core/fxcrt/xml/cfx_xmldocument.h"
13#include "core/fxcrt/xml/cfx_xmlelement.h"
14#include "core/fxcrt/xml/cfx_xmltext.h"
15#include "fxjs/cfx_v8.h"
17#include "fxjs/js_resources.h"
18#include "v8/include/v8-primitive.h"
19#include "xfa/fxfa/cxfa_ffdoc.h"
20#include "xfa/fxfa/cxfa_ffnotify.h"
21#include "xfa/fxfa/parser/cxfa_packet.h"
24 {
"getAttribute", getAttribute_static},
25 {
"removeAttribute", removeAttribute_static},
26 {
"setAttribute", setAttribute_static}};
28CJX_Packet::CJX_Packet(CXFA_Packet* packet) :
CJX_Node(packet) {
29 DefineMethods(MethodSpecs);
39 pdfium::span<v8::Local<v8::Value>> params) {
40 if (params.size() != 1)
44 CFX_XMLElement* element = ToXMLElement(
GetXFANode()->GetXMLMappingNode());
46 attributeValue = element->GetAttribute(runtime->ToWideString(params[0]));
49 runtime->NewString(attributeValue
.ToUTF8().AsStringView())
);
53 pdfium::span<v8::Local<v8::Value>> params) {
54 if (params.size() != 2)
57 CFX_XMLElement* element = ToXMLElement(
GetXFANode()->GetXMLMappingNode());
59 element->SetAttribute(runtime->ToWideString(params[1]),
60 runtime->ToWideString(params[0]));
67 pdfium::span<v8::Local<v8::Value>> params) {
68 if (params.size() != 1)
71 CFX_XMLElement* pElement = ToXMLElement(
GetXFANode()->GetXMLMappingNode());
73 pElement->RemoveAttribute(runtime->ToWideString(params[0]));
78void CJX_Packet::content(
v8::Isolate* pIsolate,
79 v8::Local<v8::Value>* pValue,
82 CFX_XMLElement* element = ToXMLElement(
GetXFANode()->GetXMLMappingNode());
85 element->AppendLastChild(
92 fxv8::ReentrantToWideStringHelper(pIsolate, *pValue)));
101 *pValue = fxv8::NewStringHelper(pIsolate, wsTextData
.ToUTF8().AsStringView());
friend class EventParamScope
WideString GetTextData() const
static CJS_Result Success()
static CJS_Result Failure(JSMessage id)
bool DynamicTypeIs(TypeTag eType) const override
CXFA_Node * GetXFANode() const
bool DynamicTypeIs(TypeTag eType) const override
ByteString ToUTF8() const
WideString & operator=(WideString &&that) noexcept
fxcrt::WideString WideString