7#include "fxjs/xfa/cjx_object.h"
13#include "core/fxcrt/fx_extension.h"
14#include "core/fxcrt/fx_memory.h"
15#include "core/fxcrt/xml/cfx_xmlelement.h"
16#include "core/fxcrt/xml/cfx_xmltext.h"
17#include "fxjs/cjs_result.h"
19#include "fxjs/gc/container_trace.h"
20#include "fxjs/xfa/cfxjse_engine.h"
21#include "fxjs/xfa/cfxjse_mapmodule.h"
22#include "fxjs/xfa/cjx_boolean.h"
23#include "fxjs/xfa/cjx_draw.h"
24#include "fxjs/xfa/cjx_field.h"
25#include "fxjs/xfa/cjx_instancemanager.h"
26#include "third_party/base/check.h"
27#include "third_party/base/check_op.h"
28#include "third_party/base/containers/contains.h"
29#include "third_party/base/containers/span.h"
30#include "v8/include/v8-forward.h"
31#include "v8/include/v8-object.h"
32#include "v8/include/v8-primitive.h"
33#include "xfa/fgas/crt/cfgas_decimal.h"
34#include "xfa/fxfa/cxfa_ffnotify.h"
35#include "xfa/fxfa/cxfa_ffwidget.h"
36#include "xfa/fxfa/parser/cxfa_border.h"
37#include "xfa/fxfa/parser/cxfa_datavalue.h"
38#include "xfa/fxfa/parser/cxfa_document.h"
39#include "xfa/fxfa/parser/cxfa_edge.h"
40#include "xfa/fxfa/parser/cxfa_fill.h"
41#include "xfa/fxfa/parser/cxfa_font.h"
42#include "xfa/fxfa/parser/cxfa_measurement.h"
43#include "xfa/fxfa/parser/cxfa_node.h"
44#include "xfa/fxfa/parser/cxfa_object.h"
45#include "xfa/fxfa/parser/cxfa_occur.h"
46#include "xfa/fxfa/parser/cxfa_proto.h"
47#include "xfa/fxfa/parser/cxfa_subform.h"
48#include "xfa/fxfa/parser/cxfa_validate.h"
49#include "xfa/fxfa/parser/cxfa_value.h"
50#include "xfa/fxfa/parser/xfa_basic_data.h"
51#include "xfa/fxfa/parser/xfa_utils.h"
60uint32_t GetMapKey_Custom(WideStringView wsKey) {
61 uint32_t dwKey = FX_HashCode_GetW(wsKey);
62 return ((dwKey << 1) | XFA_KEYTYPE_Custom);
66 return ((
static_cast<uint32_t>(eType) << 16) |
67 (
static_cast<uint32_t>(eAttribute) << 8) | XFA_KEYTYPE_Element);
70std::tuple<int32_t, int32_t, int32_t> StrToRGB(
const WideString& strRGB) {
76 for (size_t i = 0; i < strRGB.GetLength(); ++i) {
77 wchar_t ch = strRGB[i];
83 int32_t iValue = ch - L'0';
84 if (iValue >= 0 && iValue <= 9) {
112 visitor->Trace(object_);
113 visitor->Trace(layout_item_);
114 visitor->Trace(calc_data_);
118 return eType == static_type__;
122 for (
const auto& item : methods)
123 method_specs_[item.pName] = item.pMethodCall;
127 return object_->GetDocument();
135 v8::Local<v8::Value>* pValue,
142 *pValue = fxv8::NewStringHelper(pIsolate,
GetXFAObject()->GetClassName());
145int32_t
CJX_Object::Subform_and_SubformSet_InstanceIndex() {
148 pNode = pNode->GetPrevSibling()) {
159 return pdfium::Contains(method_specs_, func.ToUTF8());
163 const WideString& func,
165 auto it = method_specs_.find(func.ToUTF8());
166 if (it == method_specs_.end())
169 return it->second(
this, pScriptContext, params);
173 const WideString& obj)
const {
175 pIsolate
, WideString
::FromASCII(
"The element [") + obj +
177 "] has violated its allowable number of occurrences.")
);
182 WideString
::FromASCII(
"Invalid property set operation.")
);
187 WideString
::FromASCII(
"Index value is out of bounds.")
);
191 v8::Isolate* pIsolate,
192 const WideString& method)
const {
195 WideString
::FromASCII(
"Incorrect number of parameters calling method '") +
202 "Argument mismatch in property or function argument.")
);
206 const WideString& str)
const {
207 DCHECK(!str.IsEmpty());
208 FXJSE_ThrowMessage(pIsolate, str
.ToUTF8().AsStringView());
213 return HasMapModuleKey(key);
217 const WideString& wsValue,
221 absl::optional<XFA_AttributeValue> item =
222 XFA_GetAttributeValueByName(wsValue.AsStringView());
224 item.has_value() ? item.value()
225 : GetXFANode()->GetDefaultEnum(eAttr).value(),
235 case XFA_AttributeType::Integer:
237 FXSYS_roundf(FXSYS_wcstof(wsValue.c_str(), wsValue.GetLength(),
248 const WideString& wsValue) {
249 absl::optional<XFA_ATTRIBUTEINFO> attr = XFA_GetAttributeByName(wsAttr);
250 if (attr.has_value()) {
251 SetAttributeByEnum(attr.value().attribute, wsValue,
true);
254 uint32_t key = GetMapKey_Custom(wsAttr);
255 SetMapModuleString(key, wsValue);
259 absl::optional<WideString> result;
260 absl::optional<XFA_ATTRIBUTEINFO> enum_attr = XFA_GetAttributeByName(attr);
261 if (enum_attr.has_value())
262 result = TryAttribute(enum_attr.value().attribute,
true);
264 result = GetMapModuleStringFollowingChain(GetMapKey_Custom(attr));
265 return result.value_or(WideString());
269 return TryAttribute(attr,
true).value_or(WideString());
273 bool bUseDefault)
const {
276 absl::optional<XFA_AttributeValue> value = TryEnum(eAttr, bUseDefault);
277 if (!value.has_value())
278 return absl::nullopt;
279 return WideString::FromASCII(XFA_AttributeValueToName(value.value()));
281 case XFA_AttributeType::CData:
282 return TryCData(eAttr, bUseDefault);
285 absl::optional<
bool> value = TryBoolean(eAttr, bUseDefault);
286 if (!value.has_value())
287 return absl::nullopt;
288 return WideString(value.value() ? L"1" : L"0");
291 absl::optional<int32_t> iValue = TryInteger(eAttr, bUseDefault);
292 if (!iValue.has_value())
293 return absl::nullopt;
294 return WideString::FormatInteger(iValue.value());
297 absl::optional<CXFA_Measurement> value = TryMeasure(eAttr, bUseDefault);
298 if (!value.has_value())
299 return absl::nullopt;
300 return value->ToString();
303 return absl::nullopt;
307 RemoveMapModuleKey(GetMapKey_Custom(wsAttr));
311 bool bUseDefault)
const {
313 absl::optional<int32_t> value = GetMapModuleValueFollowingChain(key);
314 if (value.has_value())
315 return !!value.value();
317 return absl::nullopt;
322 CFX_XMLElement* elem = SetValue(eAttr,
static_cast<int32_t>(bValue), bNotify);
325 bValue ? L"1" : L"0"
);
330 return TryBoolean(eAttr,
true).value_or(
false);
334 CFX_XMLElement* elem = SetValue(eAttr, iValue, bNotify);
342 return TryInteger(eAttr,
true).value_or(0);
346 bool bUseDefault)
const {
348 absl::optional<int32_t> value = GetMapModuleValueFollowingChain(key);
349 if (value.has_value())
350 return value.value();
352 return absl::nullopt;
357 bool bUseDefault)
const {
359 absl::optional<int32_t> value = GetMapModuleValueFollowingChain(key);
360 if (value.has_value())
361 return static_cast<XFA_AttributeValue>(value.value());
363 return absl::nullopt;
370 CFX_XMLElement* elem = SetValue(eAttr,
static_cast<int32_t>(eValue), bNotify);
378 return TryEnum(eAttr,
true).value_or(XFA_AttributeValue::Unknown);
389 SetMapModuleMeasurement(key, mValue);
391 OnChanged(eAttr,
false);
396 bool bUseDefault)
const {
398 absl::optional<CXFA_Measurement> result =
399 GetMapModuleMeasurementFollowingChain(key);
400 if (result.has_value())
401 return result.value();
403 return absl::nullopt;
408 absl::optional<CXFA_Measurement> measure = TryMeasure(attr,
false);
409 if (!measure.has_value())
410 return absl::nullopt;
411 return measure->ToUnit(XFA_Unit::Pt);
415 return TryMeasure(eAttr,
true).value_or(CXFA_Measurement());
423 return TryCData(eAttr,
true).value_or(WideString());
431 const WideString& wsValue,
433 bool bScriptModify) {
436 absl::optional<WideString> old_value = GetMapModuleString(key);
437 if (!old_value.has_value() || old_value.value() != wsValue) {
440 SetMapModuleString(key, wsValue);
444 OnChanged(eAttr, bScriptModify);
468 WideString wsAttrName = WideString
::FromASCII(XFA_AttributeToName(eAttr)
);
470 wsAttrName
= L"xfa:"
+ wsAttrName;
475 const WideString& wsXMLValue) {
480 const WideString& wsXMLValue,
482 bool bScriptModify) {
486 absl::optional<WideString> old_value = GetMapModuleString(key);
487 if (!old_value.has_value() || old_value.value() != wsValue) {
490 SetMapModuleString(key, wsValue);
499 bool bUseDefault)
const {
501 absl::optional<WideString> value = GetMapModuleStringFollowingChain(key);
502 if (value.has_value())
506 return absl::nullopt;
515 absl::optional<int32_t> old_value = GetMapModuleValue(key);
516 if (!old_value.has_value() || old_value.value() != value) {
519 SetMapModuleValue(key, value);
521 OnChanged(eAttr,
false);
529 const WideString& wsXMLValue,
539 GetOrCreateProperty<CXFA_Value>(0,
XFA_Element::Value);
543 CXFA_Node* pChildValue = pValue->GetFirstChild();
544 pChildValue->JSObject()->SetCData(
XFA_Attribute::ContentType,
546 pChildValue->JSObject()->SetContent(wsContent, wsContent, bNotify,
547 bScriptModify,
false);
550 if (bSyncData && pBind) {
551 std::vector<WideString> wsSaveTextArray =
552 fxcrt::Split(wsContent, L'\n');
553 std::vector<CXFA_Node*> valueNodes =
554 pBind->GetNodeListForType(XFA_Element::DataValue);
559 while (valueNodes.size() != wsSaveTextArray.size()) {
562 if (valueNodes.size() < wsSaveTextArray.size()) {
563 size_t iAddNodes = wsSaveTextArray.size() - valueNodes.size();
564 while (iAddNodes-- > 0) {
573 size_t iDelNodes = valueNodes.size() - wsSaveTextArray.size();
574 for (size_t i = 0; i < iDelNodes; ++i)
577 valueNodes = pBind->GetNodeListForType(
XFA_Element::DataValue);
579 DCHECK_EQ(valueNodes.size(), wsSaveTextArray.size());
581 for (CXFA_Node* pValueNode : valueNodes) {
582 pValueNode->JSObject()->SetAttributeValue(wsSaveTextArray[i],
586 for (
auto* pArrayNode : pBind->GetBindItemsCopy()) {
587 if (pArrayNode != GetXFANode()) {
588 pArrayNode->JSObject()->SetContent(wsContent, wsContent, bNotify,
589 bScriptModify,
false);
599 GetOrCreateProperty<CXFA_Value>(0,
XFA_Element::Value);
603 CXFA_Node* pChildValue = pValue->GetFirstChild();
605 pChildValue->JSObject()->SetContent(wsContent, wsContent, bNotify,
606 bScriptModify,
false);
610 if (pBindNode && bSyncData) {
611 pBindNode->JSObject()->SetContent(wsContent, wsXMLValue, bNotify,
612 bScriptModify,
false);
613 for (
auto* pArrayNode : pBindNode->GetBindItemsCopy()) {
614 if (pArrayNode != GetXFANode()) {
615 pArrayNode->JSObject()->SetContent(wsContent, wsContent, bNotify,
624 WideString wsContentType;
626 absl::optional<WideString> ret =
627 TryAttribute(XFA_Attribute::ContentType,
false);
629 wsContentType = ret.value();
637 if (!pContentRawDataNode) {
643 pContentRawDataNode->JSObject()->SetContent(
644 wsContent, wsXMLValue, bNotify, bScriptModify, bSyncData);
656 pParent = pParent->GetParent();
659 pParent = pParent->GetParent();
663 pBindNode->JSObject()->SetContent(wsContent, wsXMLValue, bNotify,
664 bScriptModify,
false);
681 if (pBindNode && bSyncData) {
682 for (
auto* pArrayNode : pBindNode->GetBindItemsCopy()) {
683 pArrayNode->JSObject()->SetContent(wsContent, wsContent, bNotify,
684 bScriptModify,
false);
690 return TryContent(bScriptModify,
true).value_or(WideString());
704 return absl::nullopt;
706 CXFA_Node* pChildValue = pValue->GetFirstChild();
708 pChildValue->JSObject()->SetAttributeByEnum(
712 return absl::nullopt;
713 return pChildValue->JSObject()->TryContent(bScriptModify, bProto);
718 if (!pContentRawDataNode) {
721 absl::optional<WideString> contentType =
722 TryAttribute(XFA_Attribute::ContentType,
false);
723 if (contentType.has_value()) {
724 if (contentType.value().EqualsASCII(
"text/html"))
726 else if (contentType.value().EqualsASCII(
"text/xml"))
733 return pContentRawDataNode->JSObject()->TryContent(bScriptModify,
true);
750 return TryCData(XFA_Attribute::Value,
false);
752 return absl::nullopt;
761 return absl::nullopt;
772 return absl::nullopt;
776 WideString wsNamespace;
779 return absl::nullopt;
798 map_module_ = std::make_unique<CFXJSE_MapModule>();
799 return map_module_.get();
803 return map_module_.get();
806void CJX_Object::SetMapModuleValue(uint32_t key, int32_t value) {
810void CJX_Object::SetMapModuleString(uint32_t key,
const WideString& wsValue) {
814void CJX_Object::SetMapModuleMeasurement(uint32_t key,
819absl::optional<int32_t>
CJX_Object::GetMapModuleValue(uint32_t key)
const {
822 return absl::nullopt;
823 return pModule->GetValue(key);
826absl::optional<WideString>
CJX_Object::GetMapModuleString(uint32_t key)
const {
829 return absl::nullopt;
830 return pModule->GetString(key);
833absl::optional<CXFA_Measurement>
CJX_Object::GetMapModuleMeasurement(
834 uint32_t key)
const {
837 return absl::nullopt;
838 return pModule->GetMeasurement(key);
841absl::optional<int32_t>
CJX_Object::GetMapModuleValueFollowingChain(
842 uint32_t key)
const {
843 std::set<
const CXFA_Node*> visited;
846 if (!visited.insert(pNode).second)
849 absl::optional<int32_t> result = pNode->JSObject()->GetMapModuleValue(key);
850 if (result.has_value())
856 return absl::nullopt;
859absl::optional<WideString>
CJX_Object::GetMapModuleStringFollowingChain(
860 uint32_t key)
const {
861 std::set<
const CXFA_Node*> visited;
864 if (!visited.insert(pNode).second)
867 absl::optional<WideString> result =
868 pNode->JSObject()->GetMapModuleString(key);
869 if (result.has_value())
875 return absl::nullopt;
878absl::optional<CXFA_Measurement>
879CJX_Object::GetMapModuleMeasurementFollowingChain(uint32_t key)
const {
880 std::set<
const CXFA_Node*> visited;
883 if (!visited.insert(pNode).second)
886 absl::optional<CXFA_Measurement> result =
887 pNode->JSObject()->GetMapModuleMeasurement(key);
888 if (result.has_value())
894 return absl::nullopt;
897bool CJX_Object::HasMapModuleKey(uint32_t key)
const {
902void CJX_Object::RemoveMapModuleKey(uint32_t key) {
922 ToNode(pDstObj
)->JSObject()->TakeCalcDataFrom(
this);
927 WideString wsValue =
ToNode(pDstObj
)->JSObject()->GetContent(
false);
928 WideString wsFormatValue
(wsValue
);
933 ToNode(pDstObj
)->JSObject()->SetContent(wsValue, wsFormatValue,
true,
true,
938 if (!pSrcObj || !pDstObj)
943 while (pSrcChild && pDstChild) {
944 MoveBufferMapData(pSrcChild, pDstChild);
945 pSrcChild = pSrcChild->GetNextSibling();
946 pDstChild = pDstChild->GetNextSibling();
948 ToNode(pSrcObj
)->JSObject()->MoveBufferMapData(pDstObj);
972 cppgc::MakeGarbageCollected<CalcData>(heap->GetAllocationHandle());
978 calc_data_ = that->calc_data_;
979 that->calc_data_ =
nullptr;
982void CJX_Object::ScriptAttributeString(
v8::Isolate* pIsolate,
983 v8::Local<v8::Value>* pValue,
987 *pValue = fxv8::NewStringHelper(
992 WideString wsValue = fxv8::ReentrantToWideStringHelper(pIsolate, *pValue);
1001 CXFA_Subform* pSubForm =
1002 pTemplateNode->GetFirstChildByClass<CXFA_Subform>(
XFA_Element::Subform);
1003 CXFA_Proto* pProtoRoot =
1004 pSubForm ? pSubForm->GetFirstChildByClass<CXFA_Proto>(
XFA_Element::Proto)
1010 if (wsValue
[0
] ==
'#')
1011 wsID = wsValue.Substr(1);
1013 wsSOM =
std::move(wsValue);
1018 absl::optional<CFXJSE_Engine::ResolveResult> maybeResult =
1019 GetDocument()->GetScriptContext()->ResolveObjects(
1020 pProtoRoot, wsSOM.AsStringView(),
1021 Mask<XFA_ResolveFlag>{
1022 XFA_ResolveFlag::kChildren, XFA_ResolveFlag::kAttributes,
1023 XFA_ResolveFlag::kProperties, XFA_ResolveFlag::kParent,
1024 XFA_ResolveFlag::kSiblings});
1025 if (maybeResult.has_value() &&
1026 maybeResult.value().objects.front()->IsNode()) {
1027 pProtoNode = maybeResult.value().objects.front()->AsNode();
1036 while (pHeadChild) {
1037 CXFA_Node* pSibling = pHeadChild->GetNextSibling();
1039 pHeadChild = pSibling;
1043 pHeadChild = pProtoForm->GetFirstChild();
1044 while (pHeadChild) {
1045 CXFA_Node* pSibling = pHeadChild->GetNextSibling();
1048 pHeadChild = pSibling;
1052void CJX_Object::ScriptAttributeBool(
v8::Isolate* pIsolate,
1053 v8::Local<v8::Value>* pValue,
1061 *pValue = fxv8::NewStringHelper(pIsolate,
GetBoolean(eAttribute
) ?
"1" :
"0");
1064void CJX_Object::ScriptAttributeInteger(
v8::Isolate* pIsolate,
1065 v8::Local<v8::Value>* pValue,
1073 *pValue = fxv8::NewNumberHelper(pIsolate,
GetInteger(eAttribute
));
1076void CJX_Object::ScriptSomFontColor(
v8::Isolate* pIsolate,
1077 v8::Local<v8::Value>* pValue,
1080 CXFA_Font* font = ToNode(object_.Get())->GetOrCreateFontIfPossible();
1089 StrToRGB(fxv8::ReentrantToWideStringHelper(pIsolate, *pValue));
1100 *pValue = fxv8::NewStringHelper(
1101 pIsolate, ByteString
::Format("%d,%d,%d", r
, g
, b
).AsStringView());
1104void CJX_Object::ScriptSomFillColor(
v8::Isolate* pIsolate,
1105 v8::Local<v8::Value>* pValue,
1108 CXFA_Border* border = ToNode(object_.Get())->GetOrCreateBorderIfPossible();
1118 StrToRGB(fxv8::ReentrantToWideStringHelper(pIsolate, *pValue));
1129 std::tie(a, r, g, b) = ArgbDecode(color);
1130 *pValue = fxv8::NewStringHelper(
1131 pIsolate, ByteString
::Format("%d,%d,%d", r
, g
, b
).AsStringView());
1134void CJX_Object::ScriptSomBorderColor(
v8::Isolate* pIsolate,
1135 v8::Local<v8::Value>* pValue,
1138 CXFA_Border* border = ToNode(object_.Get())->GetOrCreateBorderIfPossible();
1139 int32_t iSize = border->CountEdges();
1145 StrToRGB(fxv8::ReentrantToWideStringHelper(pIsolate, *pValue));
1147 for (int32_t i = 0; i < iSize; ++i) {
1148 CXFA_Edge* edge = border->GetEdgeIfExists(i);
1156 CXFA_Edge* edge = border->GetEdgeIfExists(0);
1162 std::tie(a, r, g, b) = ArgbDecode(color);
1163 *pValue = fxv8::NewStringHelper(
1164 pIsolate, ByteString
::Format("%d,%d,%d", r
, g
, b
).AsStringView());
1167void CJX_Object::ScriptSomBorderWidth(
v8::Isolate* pIsolate,
1168 v8::Local<v8::Value>* pValue,
1171 CXFA_Border* border = ToNode(object_.Get())->GetOrCreateBorderIfPossible();
1173 CXFA_Edge* edge = border->GetEdgeIfExists(0);
1176 *pValue = fxv8::NewStringHelper(
1181 if (pValue->IsEmpty())
1184 WideString wsThickness = fxv8::ReentrantToWideStringHelper(pIsolate, *pValue);
1185 for (size_t i = 0; i < border->CountEdges(); ++i) {
1186 CXFA_Edge* edge = border->GetEdgeIfExists(i);
1193 v8::Local<v8::Value>* pValue,
1197 CXFA_Validate* validate = ToNode(object_.Get())->GetValidateIfExists();
1199 validate = ToNode(object_.Get())->GetOrCreateValidateIfPossible();
1205 switch (iMessageType) {
1208 fxv8::ReentrantToWideStringHelper(pIsolate, *pValue)
);
1212 fxv8::ReentrantToWideStringHelper(pIsolate, *pValue)
);
1216 fxv8::ReentrantToWideStringHelper(pIsolate, *pValue)
);
1237 WideString wsMessage;
1238 switch (iMessageType) {
1249 *pValue = fxv8::NewStringHelper(pIsolate, wsMessage
.ToUTF8().AsStringView());
1252void CJX_Object::ScriptSomValidationMessage(
v8::Isolate* pIsolate,
1253 v8::Local<v8::Value>* pValue,
1256 ScriptSomMessage(pIsolate, pValue, bSetting,
1257 SOMMessageType::kValidationMessage);
1260void CJX_Object::ScriptSomMandatoryMessage(
v8::Isolate* pIsolate,
1261 v8::Local<v8::Value>* pValue,
1264 ScriptSomMessage(pIsolate, pValue, bSetting,
1265 SOMMessageType::kMandatoryMessage);
1268void CJX_Object::ScriptSomDefaultValue(
v8::Isolate* pIsolate,
1269 v8::Local<v8::Value>* pValue,
1278 static_cast<CJX_Field*>(
this)->defaultValue(pIsolate, pValue, bSetting,
1283 static_cast<CJX_Draw*>(
this)->defaultValue(pIsolate, pValue, bSetting,
1288 static_cast<CJX_Boolean*>(
this)->defaultValue(pIsolate, pValue, bSetting,
1294 WideString wsNewValue;
1297 wsNewValue = fxv8::ReentrantToWideStringHelper(pIsolate, *pValue);
1300 WideString wsFormatValue = wsNewValue;
1303 WideString wsPicture;
1304 for (
auto* pFormNode : GetXFANode()->GetBindItemsCopy()) {
1305 if (!pFormNode || pFormNode->HasRemovedChildren())
1308 pContainerNode = pFormNode->GetContainerNode();
1309 if (pContainerNode) {
1311 pContainerNode->GetPictureContent(XFA_ValuePicture::kDataBind);
1313 if (!wsPicture.IsEmpty())
1316 pContainerNode =
nullptr;
1332 *pValue = fxv8::NewNullHelper(pIsolate);
1337 *pValue = fxv8::NewNumberHelper(pIsolate, decimal
.ToFloat());
1339 *pValue = fxv8::NewStringHelper(pIsolate, content
.ToUTF8().AsStringView());
1343void CJX_Object::ScriptSomDefaultValue_Read(
v8::Isolate* pIsolate,
1344 v8::Local<v8::Value>* pValue,
1354 *pValue = fxv8::NewNullHelper(pIsolate);
1357 *pValue = fxv8::NewStringHelper(pIsolate, content
.ToUTF8().AsStringView());
1360void CJX_Object::ScriptSomDataNode(
v8::Isolate* pIsolate,
1361 v8::Local<v8::Value>* pValue,
1371 *pValue = fxv8::NewNullHelper(pIsolate);
1379void CJX_Object::ScriptSomMandatory(
v8::Isolate* pIsolate,
1380 v8::Local<v8::Value>* pValue,
1383 CXFA_Validate* validate =
1384 ToNode(object_.Get())->GetOrCreateValidateIfPossible();
1393 *pValue = fxv8::NewStringHelper(
1397void CJX_Object::ScriptSomInstanceIndex(
v8::Isolate* pIsolate,
1398 v8::Local<v8::Value>* pValue,
1403 fxv8::NewNumberHelper(pIsolate, Subform_and_SubformSet_InstanceIndex());
1407 int32_t iTo = fxv8::ReentrantToInt32Helper(pIsolate, *pValue);
1408 int32_t iFrom = Subform_and_SubformSet_InstanceIndex();
1411 pNode = pNode->GetPrevSibling()) {
1413 pManagerNode = pNode;
1420 auto* mgr =
static_cast<CJX_InstanceManager*>(pManagerNode->JSObject());
1421 mgr->MoveInstance(pIsolate, iTo, iFrom);
1431 auto* pFromInstance =
1437void CJX_Object::ScriptSubmitFormatMode(
v8::Isolate* pIsolate,
1438 v8::Local<v8::Value>* pValue,
1447 ContainerTrace(visitor, m_Globals);
CFX_XMLElement * ToXMLElement(CFX_XMLNode *pNode)
void AddNodesOfRunScript(CXFA_Node *pNode)
friend class EventParamScope
void MergeDataFrom(const CFXJSE_MapModule *pSrc)
void SetValue(uint32_t key, int32_t value)
void SetMeasurement(uint32_t key, const CXFA_Measurement &measurement)
void SetString(uint32_t key, const WideString &wsString)
void RemoveKey(uint32_t key)
bool HasKey(uint32_t key) const
WideString GetNamespaceURI() const
void SetAttribute(const WideString &name, const WideString &value)
static CJS_Result Failure(JSMessage id)
WideString GetAttributeByString(WideStringView attr) const
void RemoveAttribute(WideStringView wsAttr)
void ScriptSomMessage(v8::Isolate *pIsolate, v8::Local< v8::Value > *pValue, bool bSetting, SOMMessageType iMessageType)
float GetMeasureInUnit(XFA_Attribute eAttr, XFA_Unit unit) const
void DefineMethods(pdfium::span< const CJX_MethodSpec > methods)
void SetCDataImpl(XFA_Attribute eAttr, const WideString &wsValue, bool bNotify, bool bScriptModify)
WideString GetContent(bool bScriptModify) const
bool HasMethod(const WideString &func) const
CJX_Object * AsCJXObject() override
CXFA_Object * GetXFAObject() const
absl::optional< CXFA_Measurement > TryMeasure(XFA_Attribute eAttr, bool bUseDefault) const
CJS_Result RunMethod(CFXJSE_Engine *pScriptContext, const WideString &func, pdfium::span< v8::Local< v8::Value > > params)
void ThrowArgumentMismatchException(v8::Isolate *pIsolate) const
void ThrowIndexOutOfBoundsException(v8::Isolate *pIsolate) const
void SetAttributeByEnum(XFA_Attribute eAttr, const WideString &wsValue, bool bNotify)
void ThrowInvalidPropertyException(v8::Isolate *pIsolate) const
CXFA_Document * GetDocument() const
void ThrowParamCountMismatchException(v8::Isolate *pIsolate, const WideString &method) const
void SetCData(XFA_Attribute eAttr, const WideString &wsValue)
void SetBoolean(XFA_Attribute eAttr, bool bValue, bool bNotify)
absl::optional< WideString > TryCData(XFA_Attribute eAttr, bool bUseDefault) const
absl::optional< bool > TryBoolean(XFA_Attribute eAttr, bool bUseDefault) const
void SetInteger(XFA_Attribute eAttr, int32_t iValue, bool bNotify)
XFA_AttributeValue GetEnum(XFA_Attribute eAttr) const
void SetAttributeByString(WideStringView wsAttr, const WideString &wsValue)
bool GetBoolean(XFA_Attribute eAttr) const
virtual bool DynamicTypeIs(TypeTag eType) const
void MoveBufferMapData(CXFA_Object *pSrcObj, CXFA_Object *pDstObj)
bool HasAttribute(XFA_Attribute eAttr) const
int32_t GetInteger(XFA_Attribute eAttr) const
WideString GetCData(XFA_Attribute eAttr) const
void TakeCalcDataFrom(CJX_Object *that)
void ThrowException(v8::Isolate *pIsolate, const WideString &str) const
absl::optional< XFA_AttributeValue > TryEnum(XFA_Attribute eAttr, bool bUseDefault) const
absl::optional< WideString > TryAttribute(XFA_Attribute eAttr, bool bUseDefault) const
CXFA_Node * GetXFANode() const
void SetEnum(XFA_Attribute eAttr, XFA_AttributeValue eValue, bool bNotify)
void SetContent(const WideString &wsContent, const WideString &wsXMLValue, bool bNotify, bool bScriptModify, bool bSyncData)
absl::optional< int32_t > TryInteger(XFA_Attribute eAttr, bool bUseDefault) const
CXFA_Measurement GetMeasure(XFA_Attribute eAttr) const
void SetAttributeValue(const WideString &wsValue, const WideString &wsXMLValue)
void SetMeasure(XFA_Attribute eAttr, const CXFA_Measurement &mValue, bool bNotify)
absl::optional< WideString > TryContent(bool bScriptModify, bool bProto) const
absl::optional< float > TryMeasureAsFloat(XFA_Attribute attr) const
void MergeAllData(CXFA_Object *pDstObj)
absl::optional< WideString > TryNamespace() const
WideString GetAttributeByEnum(XFA_Attribute attr) const
CalcData * GetOrCreateCalcData(cppgc::Heap *heap)
void SetAttributeValueImpl(const WideString &wsValue, const WideString &wsXMLValue, bool bNotify, bool bScriptModify)
CJX_Object(CXFA_Object *obj)
void ThrowTooManyOccurrencesException(v8::Isolate *pIsolate, const WideString &obj) const
CXFA_Fill * GetOrCreateFillIfPossible()
CXFA_Node * GetNodeByID(CXFA_Node *pRoot, WideStringView wsID) const
CXFA_FFNotify * GetNotify() const
CFXJSE_Engine * GetScriptContext() const
CXFA_Object * GetXFAObject(XFA_HashCode wsNodeNameHash)
static constexpr FX_ARGB kDefaultColor
void OnValueChanging(CXFA_Node *pSender, XFA_Attribute eAttr)
void AddCalcValidate(CXFA_Node *pNode)
void RunSubformIndexChange(CXFA_Subform *pSubformNode)
void SetColor(FX_ARGB color)
FX_ARGB GetFillColor() const
void SetColor(FX_ARGB color)
CXFA_Measurement(float fValue, XFA_Unit eUnit)
float ToUnit(XFA_Unit eUnit) const
WideString ToString() const
CFX_XMLNode * GetXMLMappingNode() const
void RemoveChildAndNotify(CXFA_Node *pNode, bool bNotify)
void InsertChildAndNotify(CXFA_Node *pNode, CXFA_Node *pBeforeNode)
CXFA_Node * GetOrCreateProperty(int32_t index, XFA_Element eProperty)
void SendAttributeChangeMessage(XFA_Attribute eAttribute, bool bScriptModify)
WideString GetFormatDataValue(const WideString &wsValue)
CXFA_Node * CreateSamePacketNode(XFA_Element eType)
CXFA_Node * GetTemplateNodeIfExists() const
CXFA_Node * GetBindData()
CFX_XMLNode * CreateXMLMappingNode()
void SetToXML(const WideString &value)
std::pair< CXFA_Node *, int32_t > GetProperty(int32_t index, XFA_Element eProperty) const
CXFA_Node * CloneTemplateToForm(bool bRecursive)
CXFA_Node * GetContainerNode()
XFA_AttributeType GetAttributeType(XFA_Attribute type) const
XFA_PacketType GetPacketType() const
CXFA_Node * GetItemIfExists(int32_t iIndex)
bool IsNeedSavingXMLNode() const
bool IsInitialized() const
CXFA_Node * GetModelNode()
XFA_Element GetElementType() const
XFA_ObjectType GetObjectType() const
bool IsContainerNode() const
void SetMSThickness(CXFA_Measurement msThinkness)
CXFA_Measurement GetMSThickness() const
void SetColor(FX_ARGB argb)
XFA_AttributeValue GetNullTest()
void SetScriptMessageText(const WideString &wsMessage)
WideString GetNullMessageText()
WideString GetScriptMessageText()
void SetNullTest(const WideString &wsValue)
void SetNullMessageText(const WideString &wsMessage)
WideString GetFormatMessageText()
void SetFormatMessageText(const WideString &wsMessage)
static ByteString Format(const char *pFormat,...)
ByteString ToUTF8() const
WideString & operator=(WideString &&that) noexcept
CharType operator[](const size_t index) const
const wchar_t * c_str() const
WideString(const WideString &other)
static WideString FromASCII(ByteStringView str)
static WideString FormatInteger(int i)
bool EqualsASCII(ByteStringView that) const
CXFA_Node * ToNode(CXFA_Object *pObj)
constexpr FX_ARGB ArgbEncode(uint32_t a, uint32_t r, uint32_t g, uint32_t b)
int32_t FXSYS_wtoi(const wchar_t *str)
WideString operator+(const wchar_t *str1, const WideString &str2)
bool IsUndefined(v8::Local< v8::Value > value)
bool IsNull(v8::Local< v8::Value > value)
bool XFA_FDEExtension_ResolveNamespaceQualifier(CFX_XMLElement *pNode, const WideString &wsQualifier, WideString *wsNamespaceURI)
bool XFA_FieldIsMultiListBox(const CXFA_Node *pFieldNode)