summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp13
-rw-r--r--fxjs/cfxjse_engine.cpp4
-rw-r--r--fxjs/cjx_node.cpp131
-rw-r--r--fxjs/cjx_node.h7
-rw-r--r--xfa/fxfa/cxfa_ffdocview.cpp13
-rw-r--r--xfa/fxfa/cxfa_textparser.cpp4
-rw-r--r--xfa/fxfa/cxfa_textprovider.cpp2
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_binditemsdata.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_binditemsdata.h6
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_eventdata.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_eventdata.h2
-rw-r--r--xfa/fxfa/parser/cxfa_filldata.cpp20
-rw-r--r--xfa/fxfa/parser/cxfa_fontdata.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_fontdata.h2
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp35
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp90
-rw-r--r--xfa/fxfa/parser/cxfa_node.h7
-rw-r--r--xfa/fxfa/parser/cxfa_scriptdata.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.cpp33
-rw-r--r--xfa/fxfa/parser/cxfa_strokedata.cpp8
-rw-r--r--xfa/fxfa/parser/cxfa_submitdata.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_submitdata.h4
-rw-r--r--xfa/fxfa/parser/cxfa_validatedata.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp111
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.h12
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp24
-rw-r--r--xfa/fxfa/parser/xfa_utils.cpp11
-rw-r--r--xfa/fxfa/parser/xfa_utils.h10
32 files changed, 278 insertions, 325 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 72b8970022..374fe566fc 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -904,16 +904,15 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
if (!pFormFillEnv)
return false;
- WideStringView csURLC;
- submitData.GetSubmitTarget(csURLC);
- WideString csURL(csURLC);
+ WideString csURL;
+ submitData.GetSubmitTarget(csURL);
if (csURL.IsEmpty()) {
WideString ws;
ws.FromLocal("Submit cancelled.");
ByteString bs = ws.UTF16LE_Encode();
int len = bs.GetLength();
- pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len),
- (FPDF_WIDESTRING)L"", 0, 4);
+ pFormFillEnv->Alert(reinterpret_cast<FPDF_WIDESTRING>(bs.GetBuffer(len)),
+ reinterpret_cast<FPDF_WIDESTRING>(L""), 0, 4);
bs.ReleaseBuffer(len);
return false;
}
@@ -922,10 +921,8 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc,
int fileFlag = -1;
switch (submitData.GetSubmitFormat()) {
case XFA_ATTRIBUTEENUM_Xdp: {
- WideStringView csContentC;
- submitData.GetSubmitXDPContent(csContentC);
WideString csContent;
- csContent = csContentC;
+ submitData.GetSubmitXDPContent(csContent);
csContent.TrimLeft();
csContent.TrimRight();
WideString space;
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp
index 633966173a..eb76ef1c57 100644
--- a/fxjs/cfxjse_engine.cpp
+++ b/fxjs/cfxjse_engine.cpp
@@ -501,11 +501,11 @@ bool CFXJSE_Engine::RunVariablesScript(CXFA_Node* pScriptNode) {
if (!pTextNode)
return false;
- WideStringView wsScript;
+ WideString wsScript;
if (!pTextNode->JSNode()->TryCData(XFA_Attribute::Value, wsScript, true))
return false;
- ByteString btScript = FX_UTF8Encode(wsScript);
+ ByteString btScript = wsScript.UTF8Encode();
auto hRetValue = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate);
CXFA_Node* pThisObject = pParent->GetNodeItem(XFA_NODEITEM_Parent);
CFXJSE_Context* pVariablesContext =
diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp
index bde131aa09..0af65464c8 100644
--- a/fxjs/cjx_node.cpp
+++ b/fxjs/cjx_node.cpp
@@ -278,12 +278,7 @@ bool CJX_Node::GetAttribute(XFA_Attribute eAttr,
return true;
}
case XFA_AttributeType::CData: {
- WideStringView wsValueC;
- if (!TryCData(pAttr->eName, wsValueC, bUseDefault))
- return false;
-
- wsValue = wsValueC;
- return true;
+ return TryCData(pAttr->eName, wsValue, bUseDefault);
}
case XFA_AttributeType::Boolean: {
bool bValue;
@@ -365,7 +360,7 @@ int32_t CJX_Node::InstanceManager_SetInstances(int32_t iDesired) {
return 0;
if (iDesired < iCount) {
- WideStringView wsInstManagerName = GetCData(XFA_Attribute::Name);
+ WideString wsInstManagerName = GetCData(XFA_Attribute::Name);
WideString wsInstanceName = WideString(
wsInstManagerName.IsEmpty()
? wsInstManagerName
@@ -761,7 +756,7 @@ void CJX_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
}
CXFA_Node* pFakeRoot = GetXFANode()->Clone(false);
- WideStringView wsContentType = GetCData(XFA_Attribute::ContentType);
+ WideString wsContentType = GetCData(XFA_Attribute::ContentType);
if (!wsContentType.IsEmpty()) {
pFakeRoot->JSNode()->SetCData(XFA_Attribute::ContentType,
WideString(wsContentType), false, false);
@@ -2265,13 +2260,12 @@ void CJX_Node::Script_Subform_InstanceManager(CFXJSE_Value* pValue,
return;
}
- WideStringView wsName = GetCData(XFA_Attribute::Name);
+ WideString wsName = GetCData(XFA_Attribute::Name);
CXFA_Node* pInstanceMgr = nullptr;
for (CXFA_Node* pNode = GetXFANode()->GetNodeItem(XFA_NODEITEM_PrevSibling);
pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_PrevSibling)) {
if (pNode->GetElementType() == XFA_Element::InstanceManager) {
- WideStringView wsInstMgrName =
- pNode->JSNode()->GetCData(XFA_Attribute::Name);
+ WideString wsInstMgrName = pNode->JSNode()->GetCData(XFA_Attribute::Name);
if (wsInstMgrName.GetLength() >= 1 && wsInstMgrName[0] == '_' &&
wsInstMgrName.Right(wsInstMgrName.GetLength() - 1) == wsName) {
pInstanceMgr = pNode;
@@ -3009,10 +3003,19 @@ void CJX_Node::Script_Encrypt_Format(CFXJSE_Value* pValue,
bool CJX_Node::TryBoolean(XFA_Attribute eAttr, bool& bValue, bool bUseDefault) {
void* pValue = nullptr;
- if (!GetValue(eAttr, XFA_AttributeType::Boolean, bUseDefault, pValue))
+ void* pKey = GetMapKey_Element(GetXFANode()->GetElementType(), eAttr);
+ if (GetMapModuleValue(pKey, pValue)) {
+ bValue = !!pValue;
+ return true;
+ }
+ if (!bUseDefault)
return false;
- bValue = !!pValue;
+ pdfium::Optional<bool> ret = GetXFANode()->GetDefaultBoolean(eAttr);
+ if (!ret)
+ return false;
+
+ bValue = *ret;
return true;
}
@@ -3039,22 +3042,40 @@ int32_t CJX_Node::GetInteger(XFA_Attribute eAttr) {
bool CJX_Node::TryInteger(XFA_Attribute eAttr,
int32_t& iValue,
bool bUseDefault) {
+ void* pKey = GetMapKey_Element(GetXFANode()->GetElementType(), eAttr);
void* pValue = nullptr;
- if (!GetValue(eAttr, XFA_AttributeType::Integer, bUseDefault, pValue))
+ if (GetMapModuleValue(pKey, pValue)) {
+ iValue = (int32_t)(uintptr_t)pValue;
+ return true;
+ }
+ if (!bUseDefault)
+ return false;
+
+ pdfium::Optional<int32_t> ret = GetXFANode()->GetDefaultInteger(eAttr);
+ if (!ret)
return false;
- iValue = (int32_t)(uintptr_t)pValue;
+ iValue = *ret;
return true;
}
bool CJX_Node::TryEnum(XFA_Attribute eAttr,
XFA_ATTRIBUTEENUM& eValue,
bool bUseDefault) {
+ void* pKey = GetMapKey_Element(GetXFANode()->GetElementType(), eAttr);
void* pValue = nullptr;
- if (!GetValue(eAttr, XFA_AttributeType::Enum, bUseDefault, pValue))
+ if (GetMapModuleValue(pKey, pValue)) {
+ eValue = (XFA_ATTRIBUTEENUM)(uintptr_t)pValue;
+ return true;
+ }
+ if (!bUseDefault)
return false;
- eValue = (XFA_ATTRIBUTEENUM)(uintptr_t)pValue;
+ pdfium::Optional<XFA_ATTRIBUTEENUM> ret = GetXFANode()->GetDefaultEnum(eAttr);
+ if (!ret)
+ return false;
+
+ eValue = *ret;
return true;
}
@@ -3091,14 +3112,14 @@ bool CJX_Node::TryMeasure(XFA_Attribute eAttr,
memcpy(&mValue, pValue, sizeof(mValue));
return true;
}
- if (bUseDefault &&
- XFA_GetAttributeDefaultValue(pValue, GetXFANode()->GetElementType(),
- eAttr, XFA_AttributeType::Measure,
- GetXFANode()->GetPacketID())) {
- memcpy(&mValue, pValue, sizeof(mValue));
- return true;
- }
- return false;
+ if (!bUseDefault)
+ return false;
+
+ pdfium::Optional<CXFA_Measurement> measure =
+ GetXFANode()->GetDefaultMeasurement(eAttr);
+ if (measure)
+ mValue = *measure;
+ return !!measure;
}
CXFA_Measurement CJX_Node::GetMeasure(XFA_Attribute eAttr) const {
@@ -3106,9 +3127,9 @@ CXFA_Measurement CJX_Node::GetMeasure(XFA_Attribute eAttr) const {
return TryMeasure(eAttr, mValue, true) ? mValue : CXFA_Measurement();
}
-WideStringView CJX_Node::GetCData(XFA_Attribute eAttr) {
- WideStringView wsValue;
- return TryCData(eAttr, wsValue, true) ? wsValue : WideStringView();
+WideString CJX_Node::GetCData(XFA_Attribute eAttr) {
+ WideString wsValue;
+ return TryCData(eAttr, wsValue, true) ? wsValue : WideString();
}
bool CJX_Node::SetCData(XFA_Attribute eAttr,
@@ -3258,41 +3279,10 @@ bool CJX_Node::TryCData(XFA_Attribute eAttr,
if (!bUseDefault)
return false;
- void* pValue = nullptr;
- if (XFA_GetAttributeDefaultValue(pValue, GetXFANode()->GetElementType(),
- eAttr, XFA_AttributeType::CData,
- GetXFANode()->GetPacketID())) {
- wsValue = (const wchar_t*)pValue;
- return true;
- }
- return false;
-}
-
-bool CJX_Node::TryCData(XFA_Attribute eAttr,
- WideStringView& wsValue,
- bool bUseDefault) {
- void* pKey = GetMapKey_Element(GetXFANode()->GetElementType(), eAttr);
- if (eAttr == XFA_Attribute::Value) {
- WideString* pStr = (WideString*)GetUserData(pKey, true);
- if (pStr) {
- wsValue = pStr->AsStringView();
- return true;
- }
- } else {
- if (GetMapModuleString(pKey, wsValue))
- return true;
- }
- if (!bUseDefault)
- return false;
-
- void* pValue = nullptr;
- if (XFA_GetAttributeDefaultValue(pValue, GetXFANode()->GetElementType(),
- eAttr, XFA_AttributeType::CData,
- GetXFANode()->GetPacketID())) {
- wsValue = (WideStringView)(const wchar_t*)pValue;
- return true;
- }
- return false;
+ pdfium::Optional<WideString> str = GetXFANode()->GetDefaultCData(eAttr);
+ if (str)
+ wsValue = *str;
+ return !!str;
}
bool CJX_Node::SetObject(XFA_Attribute eAttr,
@@ -3352,21 +3342,6 @@ bool CJX_Node::SetValue(XFA_Attribute eAttr,
return true;
}
-bool CJX_Node::GetValue(XFA_Attribute eAttr,
- XFA_AttributeType eType,
- bool bUseDefault,
- void*& pValue) {
- void* pKey = GetMapKey_Element(GetXFANode()->GetElementType(), eAttr);
- if (GetMapModuleValue(pKey, pValue))
- return true;
- if (!bUseDefault)
- return false;
-
- return XFA_GetAttributeDefaultValue(pValue, GetXFANode()->GetElementType(),
- eAttr, eType,
- GetXFANode()->GetPacketID());
-}
-
void* CJX_Node::GetUserData(void* pKey, bool bProtoAlso) {
void* pData;
return TryUserData(pKey, pData, bProtoAlso) ? pData : nullptr;
diff --git a/fxjs/cjx_node.h b/fxjs/cjx_node.h
index 73023e5c2e..fa2b28e5e2 100644
--- a/fxjs/cjx_node.h
+++ b/fxjs/cjx_node.h
@@ -72,13 +72,12 @@ class CJX_Node : public CJX_Object {
bool SetInteger(XFA_Attribute eAttr, int32_t iValue, bool bNotify);
int32_t GetInteger(XFA_Attribute eAttr);
- bool TryCData(XFA_Attribute eAttr, WideStringView& wsValue, bool bUseDefault);
bool TryCData(XFA_Attribute eAttr, WideString& wsValue, bool bUseDefault);
bool SetCData(XFA_Attribute eAttr,
const WideString& wsValue,
bool bNotify,
bool bScriptModify);
- WideStringView GetCData(XFA_Attribute eAttr);
+ WideString GetCData(XFA_Attribute eAttr);
bool TryContent(WideString& wsContent, bool bScriptModify, bool bProto);
@@ -409,10 +408,6 @@ class CJX_Node : public CJX_Object {
XFA_AttributeType eType,
void* pValue,
bool bNotify);
- bool GetValue(XFA_Attribute eAttr,
- XFA_AttributeType eType,
- bool bUseDefault,
- void*& pValue);
bool TryUserData(void* pKey, void*& pData, bool bProtoAlso);
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index 57cd7d2f95..d076fdeddb 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -720,18 +720,20 @@ void CXFA_FFDocView::RunBindItems() {
CXFA_BindItemsData bindItemsData(item);
CFXJSE_Engine* pScriptContext =
pWidgetNode->GetDocument()->GetScriptContext();
- WideStringView wsRef;
+ WideString wsRef;
bindItemsData.GetRef(wsRef);
uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent |
XFA_RESOLVENODE_ALL;
XFA_RESOLVENODE_RS rs;
- pScriptContext->ResolveObjects(pWidgetNode, wsRef, rs, dwStyle);
+ pScriptContext->ResolveObjects(pWidgetNode, wsRef.AsStringView(), rs,
+ dwStyle);
pAcc->DeleteItem(-1, false, false);
if (rs.dwFlags != XFA_RESOLVENODE_RSTYPE_Nodes || rs.objects.empty())
continue;
- WideStringView wsValueRef, wsLabelRef;
+ WideString wsValueRef;
+ WideString wsLabelRef;
bindItemsData.GetValueRef(wsValueRef);
bindItemsData.GetLabelRef(wsLabelRef);
const bool bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef;
@@ -739,7 +741,7 @@ void CXFA_FFDocView::RunBindItems() {
const bool bValueUseContent = wsValueRef.IsEmpty() || wsValueRef == L"$";
WideString wsValue;
WideString wsLabel;
- uint32_t uValueHash = FX_HashCode_GetW(wsValueRef, false);
+ uint32_t uValueHash = FX_HashCode_GetW(wsValueRef.AsStringView(), false);
for (CXFA_Object* refObject : rs.objects) {
CXFA_Node* refNode = refObject->AsNode();
if (!refNode)
@@ -757,7 +759,8 @@ void CXFA_FFDocView::RunBindItems() {
if (bLabelUseContent) {
wsLabel = refNode->JSNode()->GetContent(false);
} else {
- CXFA_Node* nodeLabel = refNode->GetFirstChildByName(wsLabelRef);
+ CXFA_Node* nodeLabel =
+ refNode->GetFirstChildByName(wsLabelRef.AsStringView());
if (nodeLabel)
wsLabel = nodeLabel->JSNode()->GetContent(false);
}
diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp
index db03ec4367..0877d21ab1 100644
--- a/xfa/fxfa/cxfa_textparser.cpp
+++ b/xfa/fxfa/cxfa_textparser.cpp
@@ -321,7 +321,7 @@ bool CXFA_TextParser::IsSpaceRun(CFX_CSSComputedStyle* pStyle) const {
RetainPtr<CFGAS_GEFont> CXFA_TextParser::GetFont(
CXFA_TextProvider* pTextProvider,
CFX_CSSComputedStyle* pStyle) const {
- WideStringView wsFamily = L"Courier";
+ WideString wsFamily = L"Courier";
uint32_t dwStyle = 0;
CXFA_FontData fontData = pTextProvider->GetFontData();
if (fontData) {
@@ -346,7 +346,7 @@ RetainPtr<CFGAS_GEFont> CXFA_TextParser::GetFont(
CXFA_FFDoc* pDoc = pTextProvider->GetDocNode();
CXFA_FontMgr* pFontMgr = pDoc->GetApp()->GetXFAFontMgr();
- return pFontMgr->GetFont(pDoc, wsFamily, dwStyle);
+ return pFontMgr->GetFont(pDoc, wsFamily.AsStringView(), dwStyle);
}
float CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider,
diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp
index 279a78e91b..165bc09f7e 100644
--- a/xfa/fxfa/cxfa_textprovider.cpp
+++ b/xfa/fxfa/cxfa_textprovider.cpp
@@ -99,7 +99,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
CXFA_Node* pNode = pItemNode->GetNodeItem(XFA_NODEITEM_FirstChild);
while (pNode) {
- WideStringView wsName;
+ WideString wsName;
pNode->JSNode()->TryCData(XFA_Attribute::Name, wsName, true);
if (m_eType == XFA_TEXTPROVIDERTYPE_Rollover && wsName == L"rollover")
return pNode;
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index 7dab15926a..0aa91fbefb 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -1489,7 +1489,7 @@ void CXFA_WidgetAcc::SetImageEditImage(
}
RetainPtr<CFGAS_GEFont> CXFA_WidgetAcc::GetFDEFont() {
- WideStringView wsFontName = L"Courier";
+ WideString wsFontName = L"Courier";
uint32_t dwFontStyle = 0;
if (CXFA_FontData fontData = GetFontData(false)) {
if (fontData.IsBold())
@@ -1500,8 +1500,8 @@ RetainPtr<CFGAS_GEFont> CXFA_WidgetAcc::GetFDEFont() {
}
auto* pDoc = GetDoc();
- return pDoc->GetApp()->GetXFAFontMgr()->GetFont(pDoc, wsFontName,
- dwFontStyle);
+ return pDoc->GetApp()->GetXFAFontMgr()->GetFont(
+ pDoc, wsFontName.AsStringView(), dwFontStyle);
}
float CXFA_WidgetAcc::GetFontSize() {
diff --git a/xfa/fxfa/parser/cxfa_binditemsdata.cpp b/xfa/fxfa/parser/cxfa_binditemsdata.cpp
index 644b532839..ac6b765faa 100644
--- a/xfa/fxfa/parser/cxfa_binditemsdata.cpp
+++ b/xfa/fxfa/parser/cxfa_binditemsdata.cpp
@@ -11,15 +11,15 @@
CXFA_BindItemsData::CXFA_BindItemsData(CXFA_Node* pNode)
: CXFA_DataData(pNode) {}
-void CXFA_BindItemsData::GetLabelRef(WideStringView& wsLabelRef) {
+void CXFA_BindItemsData::GetLabelRef(WideString& wsLabelRef) {
m_pNode->JSNode()->TryCData(XFA_Attribute::LabelRef, wsLabelRef, true);
}
-void CXFA_BindItemsData::GetValueRef(WideStringView& wsValueRef) {
+void CXFA_BindItemsData::GetValueRef(WideString& wsValueRef) {
m_pNode->JSNode()->TryCData(XFA_Attribute::ValueRef, wsValueRef, true);
}
-void CXFA_BindItemsData::GetRef(WideStringView& wsRef) {
+void CXFA_BindItemsData::GetRef(WideString& wsRef) {
m_pNode->JSNode()->TryCData(XFA_Attribute::Ref, wsRef, true);
}
diff --git a/xfa/fxfa/parser/cxfa_binditemsdata.h b/xfa/fxfa/parser/cxfa_binditemsdata.h
index 7c7eefa233..f9b506a993 100644
--- a/xfa/fxfa/parser/cxfa_binditemsdata.h
+++ b/xfa/fxfa/parser/cxfa_binditemsdata.h
@@ -16,9 +16,9 @@ class CXFA_BindItemsData : public CXFA_DataData {
public:
explicit CXFA_BindItemsData(CXFA_Node* pNode);
- void GetLabelRef(WideStringView& wsLabelRef);
- void GetValueRef(WideStringView& wsValueRef);
- void GetRef(WideStringView& wsRef);
+ void GetLabelRef(WideString& wsLabelRef);
+ void GetValueRef(WideString& wsValueRef);
+ void GetRef(WideString& wsRef);
bool SetConnection(const WideString& wsConnection);
};
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index 8b16ae745c..c8b518c114 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -54,7 +54,7 @@ bool IsXMLValidChar(wchar_t ch) {
(ch >= 0x20 && ch <= 0xD7FF) || (ch >= 0xE000 && ch <= 0xFFFD);
}
-WideString ExportEncodeContent(const WideStringView& str) {
+WideString ExportEncodeContent(const WideString& str) {
CFX_WideTextBuf textBuf;
int32_t iLen = str.GetLength();
for (int32_t i = 0; i < iLen; i++) {
@@ -253,7 +253,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
for (int32_t i = 0; i < pdfium::CollectionSize<int32_t>(wsSelTextArray);
i++) {
buf << L"<value\n>";
- buf << ExportEncodeContent(wsSelTextArray[i].AsStringView());
+ buf << ExportEncodeContent(wsSelTextArray[i]);
buf << L"</value\n>";
}
buf << L"</";
@@ -262,7 +262,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
wsChildren += buf.AsStringView();
buf.Clear();
} else {
- WideStringView wsValue =
+ WideString wsValue =
pRawValueNode->JSNode()->GetCData(XFA_Attribute::Value);
wsChildren += ExportEncodeContent(wsValue);
}
@@ -271,7 +271,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
case XFA_ObjectType::TextNode:
case XFA_ObjectType::NodeC:
case XFA_ObjectType::NodeV: {
- WideStringView wsValue = pNode->JSNode()->GetCData(XFA_Attribute::Value);
+ WideString wsValue = pNode->JSNode()->GetCData(XFA_Attribute::Value);
wsChildren += ExportEncodeContent(wsValue);
break;
}
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index c374b762ba..f5a72bde9a 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -333,7 +333,7 @@ CXFA_Node* CXFA_Document::GetNodeByID(CXFA_Node* pRoot,
CXFA_NodeIterator sIterator(pRoot);
for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
pNode = sIterator.MoveToNext()) {
- WideStringView wsIDVal;
+ WideString wsIDVal;
if (pNode->JSNode()->TryCData(XFA_Attribute::Id, wsIDVal, true) &&
!wsIDVal.IsEmpty()) {
if (wsIDVal == wsID)
@@ -353,12 +353,12 @@ void CXFA_Document::DoProtoMerge() {
CXFA_NodeIterator sIterator(pTemplateRoot);
for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
pNode = sIterator.MoveToNext()) {
- WideStringView wsIDVal;
+ WideString wsIDVal;
if (pNode->JSNode()->TryCData(XFA_Attribute::Id, wsIDVal, true) &&
!wsIDVal.IsEmpty()) {
- mIDMap[FX_HashCode_GetW(wsIDVal, false)] = pNode;
+ mIDMap[FX_HashCode_GetW(wsIDVal.AsStringView(), false)] = pNode;
}
- WideStringView wsUseVal;
+ WideString wsUseVal;
if (pNode->JSNode()->TryCData(XFA_Attribute::Use, wsUseVal, true) &&
!wsUseVal.IsEmpty()) {
sUseNodes.insert(pNode);
diff --git a/xfa/fxfa/parser/cxfa_eventdata.cpp b/xfa/fxfa/parser/cxfa_eventdata.cpp
index 0210fdc5f4..387b7328f0 100644
--- a/xfa/fxfa/parser/cxfa_eventdata.cpp
+++ b/xfa/fxfa/parser/cxfa_eventdata.cpp
@@ -26,7 +26,7 @@ XFA_Element CXFA_EventData::GetEventType() const {
return XFA_Element::Unknown;
}
-void CXFA_EventData::GetRef(WideStringView& wsRef) {
+void CXFA_EventData::GetRef(WideString& wsRef) {
m_pNode->JSNode()->TryCData(XFA_Attribute::Ref, wsRef, true);
}
@@ -44,7 +44,5 @@ void CXFA_EventData::GetSignDataTarget(WideString& wsTarget) {
if (!pNode)
return;
- WideStringView wsCData;
- pNode->JSNode()->TryCData(XFA_Attribute::Target, wsCData, true);
- wsTarget = wsCData;
+ pNode->JSNode()->TryCData(XFA_Attribute::Target, wsTarget, true);
}
diff --git a/xfa/fxfa/parser/cxfa_eventdata.h b/xfa/fxfa/parser/cxfa_eventdata.h
index 90b1b87ff5..98b85e662e 100644
--- a/xfa/fxfa/parser/cxfa_eventdata.h
+++ b/xfa/fxfa/parser/cxfa_eventdata.h
@@ -24,7 +24,7 @@ class CXFA_EventData : public CXFA_DataData {
XFA_Element GetEventType() const;
CXFA_ScriptData GetScriptData() const;
CXFA_SubmitData GetSubmitData() const;
- void GetRef(WideStringView& wsRef);
+ void GetRef(WideString& wsRef);
void GetSignDataTarget(WideString& wsTarget);
};
diff --git a/xfa/fxfa/parser/cxfa_filldata.cpp b/xfa/fxfa/parser/cxfa_filldata.cpp
index 65ad3961c2..fbc79ad4d0 100644
--- a/xfa/fxfa/parser/cxfa_filldata.cpp
+++ b/xfa/fxfa/parser/cxfa_filldata.cpp
@@ -31,9 +31,9 @@ void CXFA_FillData::SetColor(FX_ARGB color) {
FX_ARGB CXFA_FillData::GetColor(bool bText) {
if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Color, false)) {
- WideStringView wsColor;
+ WideString wsColor;
if (pNode->JSNode()->TryCData(XFA_Attribute::Value, wsColor, false))
- return CXFA_DataData::ToColor(wsColor);
+ return CXFA_DataData::ToColor(wsColor.AsStringView());
}
if (bText)
return 0xFF000000;
@@ -56,9 +56,9 @@ int32_t CXFA_FillData::GetPattern(FX_ARGB& foreColor) {
CXFA_Node* pNode =
m_pNode->JSNode()->GetProperty(0, XFA_Element::Pattern, true);
if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color, false)) {
- WideStringView wsColor;
+ WideString wsColor;
pColor->JSNode()->TryCData(XFA_Attribute::Value, wsColor, false);
- foreColor = CXFA_DataData::ToColor(wsColor);
+ foreColor = CXFA_DataData::ToColor(wsColor.AsStringView());
} else {
foreColor = 0xFF000000;
}
@@ -71,9 +71,9 @@ int32_t CXFA_FillData::GetStipple(FX_ARGB& stippleColor) {
int32_t eAttr = 50;
pNode->JSNode()->TryInteger(XFA_Attribute::Rate, eAttr, true);
if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color, false)) {
- WideStringView wsColor;
+ WideString wsColor;
pColor->JSNode()->TryCData(XFA_Attribute::Value, wsColor, false);
- stippleColor = CXFA_DataData::ToColor(wsColor);
+ stippleColor = CXFA_DataData::ToColor(wsColor.AsStringView());
} else {
stippleColor = 0xFF000000;
}
@@ -86,9 +86,9 @@ int32_t CXFA_FillData::GetLinear(FX_ARGB& endColor) {
XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToRight;
pNode->JSNode()->TryEnum(XFA_Attribute::Type, eAttr, true);
if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color, false)) {
- WideStringView wsColor;
+ WideString wsColor;
pColor->JSNode()->TryCData(XFA_Attribute::Value, wsColor, false);
- endColor = CXFA_DataData::ToColor(wsColor);
+ endColor = CXFA_DataData::ToColor(wsColor.AsStringView());
} else {
endColor = 0xFF000000;
}
@@ -101,9 +101,9 @@ int32_t CXFA_FillData::GetRadial(FX_ARGB& endColor) {
XFA_ATTRIBUTEENUM eAttr = XFA_ATTRIBUTEENUM_ToEdge;
pNode->JSNode()->TryEnum(XFA_Attribute::Type, eAttr, true);
if (CXFA_Node* pColor = pNode->GetChild(0, XFA_Element::Color, false)) {
- WideStringView wsColor;
+ WideString wsColor;
pColor->JSNode()->TryCData(XFA_Attribute::Value, wsColor, false);
- endColor = CXFA_DataData::ToColor(wsColor);
+ endColor = CXFA_DataData::ToColor(wsColor.AsStringView());
} else {
endColor = 0xFF000000;
}
diff --git a/xfa/fxfa/parser/cxfa_fontdata.cpp b/xfa/fxfa/parser/cxfa_fontdata.cpp
index f5fe270f18..87bea1714f 100644
--- a/xfa/fxfa/parser/cxfa_fontdata.cpp
+++ b/xfa/fxfa/parser/cxfa_fontdata.cpp
@@ -35,11 +35,11 @@ float CXFA_FontData::GetVerticalScale() {
}
float CXFA_FontData::GetLetterSpacing() {
- WideStringView wsValue;
+ WideString wsValue;
if (!m_pNode->JSNode()->TryCData(XFA_Attribute::LetterSpacing, wsValue, true))
return 0;
- CXFA_Measurement ms(wsValue);
+ CXFA_Measurement ms(wsValue.AsStringView());
if (ms.GetUnit() == XFA_Unit::Em)
return ms.GetValue() * GetFontSize();
return ms.ToUnit(XFA_Unit::Pt);
@@ -69,7 +69,7 @@ float CXFA_FontData::GetFontSize() {
return ms.ToUnit(XFA_Unit::Pt);
}
-void CXFA_FontData::GetTypeface(WideStringView& wsTypeFace) {
+void CXFA_FontData::GetTypeface(WideString& wsTypeFace) {
m_pNode->JSNode()->TryCData(XFA_Attribute::Typeface, wsTypeFace, true);
}
diff --git a/xfa/fxfa/parser/cxfa_fontdata.h b/xfa/fxfa/parser/cxfa_fontdata.h
index d926fd3e46..ae5e4ac961 100644
--- a/xfa/fxfa/parser/cxfa_fontdata.h
+++ b/xfa/fxfa/parser/cxfa_fontdata.h
@@ -24,7 +24,7 @@ class CXFA_FontData : public CXFA_DataData {
int32_t GetUnderline();
int32_t GetUnderlinePeriod();
float GetFontSize();
- void GetTypeface(WideStringView& wsTypeFace);
+ void GetTypeface(WideString& wsTypeFace);
bool IsBold();
bool IsItalic();
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index 752d37473b..189a466e4f 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -1779,10 +1779,10 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) {
float fContentWidthLimit =
bContainerWidthAutoSize ? FLT_MAX
: containerSize.width - fLeftInset - fRightInset;
- WideStringView wsColumnWidths;
+ WideString wsColumnWidths;
if (pLayoutNode->JSNode()->TryCData(XFA_Attribute::ColumnWidths,
wsColumnWidths, true)) {
- auto widths = SeparateStringW(wsColumnWidths.unterminated_c_str(),
+ auto widths = SeparateStringW(wsColumnWidths.c_str(),
wsColumnWidths.GetLength(), L' ');
for (auto& width : widths) {
width.TrimLeft(L' ');
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index a24cce4979..57d71ffd89 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -65,7 +65,7 @@ class PageSetContainerLayoutItem {
uint32_t GetRelevant(CXFA_Node* pFormItem, uint32_t dwParentRelvant) {
uint32_t dwRelevant = XFA_WidgetStatus_Viewable | XFA_WidgetStatus_Printable;
- WideStringView wsRelevant;
+ WideString wsRelevant;
if (pFormItem->JSNode()->TryCData(XFA_Attribute::Relevant, wsRelevant,
true)) {
if (wsRelevant == L"+print" || wsRelevant == L"print")
@@ -137,12 +137,11 @@ void RemoveLayoutItem(CXFA_ContainerLayoutItem* pLayoutItem) {
CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot,
bool bNewExprStyle,
- WideStringView& wsTargetExpr) {
+ WideString& wsTargetAll) {
CXFA_Document* pDocument = pPageSetRoot->GetDocument();
- if (wsTargetExpr.IsEmpty())
+ if (wsTargetAll.IsEmpty())
return nullptr;
- WideString wsTargetAll(wsTargetExpr);
wsTargetAll.TrimLeft();
wsTargetAll.TrimRight();
int32_t iSplitIndex = 0;
@@ -811,7 +810,8 @@ bool CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter(
switch (eType) {
case XFA_Element::BreakBefore:
case XFA_Element::BreakAfter: {
- WideStringView wsBreakLeader, wsBreakTrailer;
+ WideString wsBreakLeader;
+ WideString wsBreakTrailer;
CXFA_Node* pFormNode = pCurNode->GetNodeItem(
XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode);
CXFA_Node* pContainer = pFormNode->GetTemplateNode();
@@ -821,8 +821,7 @@ bool CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter(
if (pScript && !XFA_LayoutPageMgr_RunBreakTestScript(pScript))
return false;
- WideStringView wsTarget =
- pCurNode->JSNode()->GetCData(XFA_Attribute::Target);
+ WideString wsTarget = pCurNode->JSNode()->GetCData(XFA_Attribute::Target);
CXFA_Node* pTarget =
ResolveBreakTarget(m_pTemplatePageSetRoot, true, wsTarget);
wsBreakTrailer = pCurNode->JSNode()->GetCData(XFA_Attribute::Trailer);
@@ -859,7 +858,7 @@ bool CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter(
case XFA_Element::Break: {
bool bStartNew =
pCurNode->JSNode()->GetInteger(XFA_Attribute::StartNew) != 0;
- WideStringView wsTarget = pCurNode->JSNode()->GetCData(
+ WideString wsTarget = pCurNode->JSNode()->GetCData(
bBefore ? XFA_Attribute::BeforeTarget : XFA_Attribute::AfterTarget);
CXFA_Node* pTarget =
ResolveBreakTarget(m_pTemplatePageSetRoot, true, wsTarget);
@@ -950,9 +949,9 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode,
->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode)
->GetTemplateNode();
if (pOverflowNode->GetElementType() == XFA_Element::Break) {
- WideStringView wsOverflowLeader;
- WideStringView wsOverflowTarget;
- WideStringView wsOverflowTrailer;
+ WideString wsOverflowLeader;
+ WideString wsOverflowTarget;
+ WideString wsOverflowTrailer;
pOverflowNode->JSNode()->TryCData(XFA_Attribute::OverflowLeader,
wsOverflowLeader, true);
pOverflowNode->JSNode()->TryCData(XFA_Attribute::OverflowTrailer,
@@ -995,9 +994,9 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode,
if (pOverflowNode->GetElementType() != XFA_Element::Overflow)
return nullptr;
- WideStringView wsOverflowLeader;
- WideStringView wsOverflowTrailer;
- WideStringView wsOverflowTarget;
+ WideString wsOverflowLeader;
+ WideString wsOverflowTrailer;
+ WideString wsOverflowTarget;
pOverflowNode->JSNode()->TryCData(XFA_Attribute::Leader, wsOverflowLeader,
true);
pOverflowNode->JSNode()->TryCData(XFA_Attribute::Trailer, wsOverflowTrailer,
@@ -1087,7 +1086,7 @@ bool CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer(
CXFA_Node* pBookendNode,
bool bLeader,
CXFA_Node*& pBookendAppendTemplate) {
- WideStringView wsBookendLeader;
+ WideString wsBookendLeader;
CXFA_Node* pContainer =
pBookendNode
->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode)
@@ -1667,9 +1666,9 @@ CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow(CXFA_Node* pFormNode) {
for (CXFA_Node* pCurNode = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild);
pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) {
if (pCurNode->GetElementType() == XFA_Element::Break) {
- WideStringView wsOverflowLeader;
- WideStringView wsOverflowTarget;
- WideStringView wsOverflowTrailer;
+ WideString wsOverflowLeader;
+ WideString wsOverflowTarget;
+ WideString wsOverflowTrailer;
pCurNode->JSNode()->TryCData(XFA_Attribute::OverflowLeader,
wsOverflowLeader, true);
pCurNode->JSNode()->TryCData(XFA_Attribute::OverflowTrailer,
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 2ab0b18cf5..c906d26bda 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -199,10 +199,10 @@ CXFA_Node* CXFA_Node::Clone(bool bRecursive) {
WideString wsName;
JSNode()->GetAttribute(XFA_Attribute::Name, wsName, false);
auto pCloneXMLElement = pdfium::MakeUnique<CFX_XMLElement>(wsName);
- WideStringView wsValue = JSNode()->GetCData(XFA_Attribute::Value);
- if (!wsValue.IsEmpty()) {
+ WideString wsValue = JSNode()->GetCData(XFA_Attribute::Value);
+ if (!wsValue.IsEmpty())
pCloneXMLElement->SetTextData(WideString(wsValue));
- }
+
pCloneXML.reset(pCloneXMLElement.release());
pClone->JSNode()->SetEnum(XFA_Attribute::Contains,
XFA_ATTRIBUTEENUM_Unknown, false);
@@ -852,18 +852,17 @@ bool CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) {
if (pNode->m_pXMLNode->GetType() == FX_XMLNODE_Element) {
CFX_XMLElement* pXMLElement =
static_cast<CFX_XMLElement*>(pNode->m_pXMLNode);
- WideStringView wsAttributeName =
+ WideString wsAttributeName =
pNode->JSNode()->GetCData(XFA_Attribute::QualifiedName);
- // TODO(tsepez): check usage of c_str() below.
- pXMLElement->RemoveAttribute(wsAttributeName.unterminated_c_str());
+ pXMLElement->RemoveAttribute(wsAttributeName.c_str());
}
WideString wsName;
pNode->JSNode()->GetAttribute(XFA_Attribute::Name, wsName, false);
CFX_XMLElement* pNewXMLElement = new CFX_XMLElement(wsName);
- WideStringView wsValue = JSNode()->GetCData(XFA_Attribute::Value);
- if (!wsValue.IsEmpty()) {
+ WideString wsValue = JSNode()->GetCData(XFA_Attribute::Value);
+ if (!wsValue.IsEmpty())
pNewXMLElement->SetTextData(WideString(wsValue));
- }
+
pNode->m_pXMLNode = pNewXMLElement;
pNode->JSNode()->SetEnum(XFA_Attribute::Contains,
XFA_ATTRIBUTEENUM_Unknown, false);
@@ -963,9 +962,8 @@ CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() {
break;
}
if (eType == XFA_Element::InstanceManager) {
- WideStringView wsName = JSNode()->GetCData(XFA_Attribute::Name);
- WideStringView wsInstName =
- pNode->JSNode()->GetCData(XFA_Attribute::Name);
+ WideString wsName = JSNode()->GetCData(XFA_Attribute::Name);
+ WideString wsInstName = pNode->JSNode()->GetCData(XFA_Attribute::Name);
if (wsInstName.GetLength() > 0 && wsInstName[0] == '_' &&
wsInstName.Right(wsInstName.GetLength() - 1) == wsName) {
pInstanceMgr = pNode;
@@ -1020,14 +1018,14 @@ void CXFA_Node::OnRemoved(bool bNotify) {
void CXFA_Node::UpdateNameHash() {
const XFA_NOTSUREATTRIBUTE* pNotsure =
XFA_GetNotsureAttribute(GetElementType(), XFA_Attribute::Name);
- WideStringView wsName;
+ WideString wsName;
if (!pNotsure || pNotsure->eType == XFA_AttributeType::CData) {
wsName = JSNode()->GetCData(XFA_Attribute::Name);
- m_dwNameHash = FX_HashCode_GetW(wsName, false);
+ m_dwNameHash = FX_HashCode_GetW(wsName.AsStringView(), false);
} else if (pNotsure->eType == XFA_AttributeType::Enum) {
wsName =
GetAttributeEnumByID(JSNode()->GetEnum(XFA_Attribute::Name))->pName;
- m_dwNameHash = FX_HashCode_GetW(wsName, false);
+ m_dwNameHash = FX_HashCode_GetW(wsName.AsStringView(), false);
}
}
@@ -1058,8 +1056,8 @@ CXFA_Node* CXFA_Node::GetItem(int32_t iIndex) {
continue;
}
if (iCount == 0) {
- WideStringView wsName = pNode->JSNode()->GetCData(XFA_Attribute::Name);
- WideStringView wsInstName = JSNode()->GetCData(XFA_Attribute::Name);
+ WideString wsName = pNode->JSNode()->GetCData(XFA_Attribute::Name);
+ WideString wsInstName = JSNode()->GetCData(XFA_Attribute::Name);
if (wsInstName.GetLength() < 1 || wsInstName[0] != '_' ||
wsInstName.Right(wsInstName.GetLength() - 1) != wsName) {
return nullptr;
@@ -1089,8 +1087,8 @@ int32_t CXFA_Node::GetCount() {
continue;
}
if (iCount == 0) {
- WideStringView wsName = pNode->JSNode()->GetCData(XFA_Attribute::Name);
- WideStringView wsInstName = JSNode()->GetCData(XFA_Attribute::Name);
+ WideString wsName = pNode->JSNode()->GetCData(XFA_Attribute::Name);
+ WideString wsInstName = JSNode()->GetCData(XFA_Attribute::Name);
if (wsInstName.GetLength() < 1 || wsInstName[0] != '_' ||
wsInstName.Right(wsInstName.GetLength() - 1) != wsName) {
return iCount;
@@ -1229,3 +1227,57 @@ CXFA_Node* CXFA_Node::CreateInstance(bool bDataMerge) {
return pInstance;
}
+pdfium::Optional<bool> CXFA_Node::GetDefaultBoolean(XFA_Attribute attr) const {
+ void* pValue = nullptr;
+ if (!XFA_GetAttributeDefaultValue(pValue, GetElementType(), attr,
+ XFA_AttributeType::Boolean,
+ GetPacketID())) {
+ return {};
+ }
+ return {!!pValue};
+}
+
+pdfium::Optional<int32_t> CXFA_Node::GetDefaultInteger(
+ XFA_Attribute attr) const {
+ void* pValue = nullptr;
+ if (!XFA_GetAttributeDefaultValue(pValue, GetElementType(), attr,
+ XFA_AttributeType::Integer,
+ GetPacketID())) {
+ return {};
+ }
+ return {static_cast<int32_t>(reinterpret_cast<uintptr_t>(pValue))};
+}
+
+pdfium::Optional<CXFA_Measurement> CXFA_Node::GetDefaultMeasurement(
+ XFA_Attribute attr) const {
+ void* pValue = nullptr;
+ if (!XFA_GetAttributeDefaultValue(pValue, GetElementType(), attr,
+ XFA_AttributeType::Measure,
+ GetPacketID())) {
+ return {};
+ }
+ CXFA_Measurement measure;
+ memcpy(&measure, pValue, sizeof(measure));
+ return {measure};
+}
+
+pdfium::Optional<WideString> CXFA_Node::GetDefaultCData(
+ XFA_Attribute attr) const {
+ void* pValue = nullptr;
+ if (!XFA_GetAttributeDefaultValue(pValue, GetElementType(), attr,
+ XFA_AttributeType::CData, GetPacketID())) {
+ return {};
+ }
+ WideStringView view((const wchar_t*)pValue);
+ return {WideString(view)};
+}
+
+pdfium::Optional<XFA_ATTRIBUTEENUM> CXFA_Node::GetDefaultEnum(
+ XFA_Attribute attr) const {
+ void* pValue = nullptr;
+ if (!XFA_GetAttributeDefaultValue(pValue, GetElementType(), attr,
+ XFA_AttributeType::Enum, GetPacketID())) {
+ return {};
+ }
+ return {static_cast<XFA_ATTRIBUTEENUM>(reinterpret_cast<uintptr_t>(pValue))};
+}
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 073fd5261f..66a3174901 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -140,6 +140,13 @@ class CXFA_Node : public CXFA_Object {
CXFA_Node* GetOccurNode();
+ pdfium::Optional<bool> GetDefaultBoolean(XFA_Attribute attr) const;
+ pdfium::Optional<int32_t> GetDefaultInteger(XFA_Attribute attr) const;
+ pdfium::Optional<CXFA_Measurement> GetDefaultMeasurement(
+ XFA_Attribute attr) const;
+ pdfium::Optional<WideString> GetDefaultCData(XFA_Attribute attr) const;
+ pdfium::Optional<XFA_ATTRIBUTEENUM> GetDefaultEnum(XFA_Attribute attr) const;
+
private:
CXFA_Node(CXFA_Document* pDoc,
uint16_t ePacket,
diff --git a/xfa/fxfa/parser/cxfa_scriptdata.cpp b/xfa/fxfa/parser/cxfa_scriptdata.cpp
index ea957f94c5..f7352be79c 100644
--- a/xfa/fxfa/parser/cxfa_scriptdata.cpp
+++ b/xfa/fxfa/parser/cxfa_scriptdata.cpp
@@ -11,7 +11,7 @@
CXFA_ScriptData::CXFA_ScriptData(CXFA_Node* pNode) : CXFA_DataData(pNode) {}
XFA_ScriptDataType CXFA_ScriptData::GetContentType() {
- WideStringView cData;
+ WideString cData;
if (!m_pNode->JSNode()->TryCData(XFA_Attribute::ContentType, cData, false))
return XFA_ScriptDataType::Formcalc;
if (cData == L"application/x-javascript")
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp
index 79214356fe..579ca9e832 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp
@@ -60,8 +60,8 @@ CFX_XMLNode* GetDocumentNode(CFX_XMLDoc* pXMLDoc,
WideString GetElementTagNamespaceURI(CFX_XMLElement* pElement) {
WideString wsNodeStr = pElement->GetNamespacePrefix();
WideString wsNamespaceURI;
- if (!XFA_FDEExtension_ResolveNamespaceQualifier(
- pElement, wsNodeStr.AsStringView(), &wsNamespaceURI)) {
+ if (!XFA_FDEExtension_ResolveNamespaceQualifier(pElement, wsNodeStr,
+ &wsNamespaceURI)) {
return WideString();
}
return wsNamespaceURI;
@@ -103,21 +103,20 @@ bool GetAttributeLocalName(const WideStringView& wsAttributeName,
}
bool ResolveAttribute(CFX_XMLElement* pElement,
- const WideStringView& wsAttributeName,
+ const WideString& wsAttrName,
WideString& wsLocalAttrName,
WideString& wsNamespaceURI) {
- WideString wsAttrName(wsAttributeName);
WideString wsNSPrefix;
- if (GetAttributeLocalName(wsAttributeName, wsLocalAttrName)) {
- wsNSPrefix = wsAttrName.Left(wsAttributeName.GetLength() -
+ if (GetAttributeLocalName(wsAttrName.AsStringView(), wsLocalAttrName)) {
+ wsNSPrefix = wsAttrName.Left(wsAttrName.GetLength() -
wsLocalAttrName.GetLength() - 1);
}
if (wsLocalAttrName == L"xmlns" || wsNSPrefix == L"xmlns" ||
wsNSPrefix == L"xml") {
return false;
}
- if (!XFA_FDEExtension_ResolveNamespaceQualifier(
- pElement, wsNSPrefix.AsStringView(), &wsNamespaceURI)) {
+ if (!XFA_FDEExtension_ResolveNamespaceQualifier(pElement, wsNSPrefix,
+ &wsNamespaceURI)) {
wsNamespaceURI.clear();
return false;
}
@@ -147,8 +146,8 @@ bool FindAttributeWithNS(CFX_XMLElement* pElement,
wsNSPrefix = it.first.Left(pos.value());
}
- if (!XFA_FDEExtension_ResolveNamespaceQualifier(
- pElement, wsNSPrefix.AsStringView(), &wsAttrNS)) {
+ if (!XFA_FDEExtension_ResolveNamespaceQualifier(pElement, wsNSPrefix,
+ &wsAttrNS)) {
continue;
}
if (bMatchNSAsPrefix) {
@@ -388,10 +387,9 @@ CFX_XMLDoc* CXFA_SimpleParser::GetXMLDoc() const {
return m_pXMLDoc.get();
}
-bool XFA_FDEExtension_ResolveNamespaceQualifier(
- CFX_XMLElement* pNode,
- const WideStringView& wsQualifier,
- WideString* wsNamespaceURI) {
+bool XFA_FDEExtension_ResolveNamespaceQualifier(CFX_XMLElement* pNode,
+ const WideString& wsQualifier,
+ WideString* wsNamespaceURI) {
if (!pNode)
return false;
@@ -952,7 +950,7 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode,
XFA_XDPPACKET ePacketID) {
XFA_Element element = XFA_Element::Sharptext;
if (pXFANode->GetElementType() == XFA_Element::ExData) {
- WideStringView wsContentType =
+ WideString wsContentType =
pXFANode->JSNode()->GetCData(XFA_Attribute::ContentType);
if (wsContentType == L"text/html")
element = XFA_Element::SharpxHTML;
@@ -1072,8 +1070,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
for (auto it : pXMLElement->GetAttributes()) {
WideString wsName;
WideString wsNS;
- if (!ResolveAttribute(pXMLElement, it.first.AsStringView(), wsName,
- wsNS)) {
+ if (!ResolveAttribute(pXMLElement, it.first, wsName, wsNS)) {
continue;
}
if (wsName == L"nil" && it.second == L"true") {
@@ -1205,7 +1202,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode,
pXFANode->InsertChild(pXFAChild, nullptr);
pXFAChild->SetXMLMappingNode(pXMLChild);
pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false);
- WideStringView wsCurValue =
+ WideString wsCurValue =
pXFAChild->JSNode()->GetCData(XFA_Attribute::Value);
wsValueTextBuf << wsCurValue;
}
diff --git a/xfa/fxfa/parser/cxfa_strokedata.cpp b/xfa/fxfa/parser/cxfa_strokedata.cpp
index 93247e3537..76798cb4bb 100644
--- a/xfa/fxfa/parser/cxfa_strokedata.cpp
+++ b/xfa/fxfa/parser/cxfa_strokedata.cpp
@@ -32,9 +32,7 @@ float CXFA_StrokeData::GetThickness() const {
CXFA_Measurement CXFA_StrokeData::GetMSThickness() const {
return m_pNode ? m_pNode->JSNode()->GetMeasure(XFA_Attribute::Thickness)
- : XFA_GetAttributeDefaultValue_Measure(
- XFA_Element::Edge, XFA_Attribute::Thickness,
- XFA_XDPPACKET_Form);
+ : CXFA_Measurement(0.5, XFA_Unit::Pt);
}
void CXFA_StrokeData::SetMSThickness(CXFA_Measurement msThinkness) {
@@ -52,9 +50,9 @@ FX_ARGB CXFA_StrokeData::GetColor() const {
if (!pNode)
return 0xFF000000;
- WideStringView wsColor;
+ WideString wsColor;
pNode->JSNode()->TryCData(XFA_Attribute::Value, wsColor, true);
- return CXFA_DataData::ToColor(wsColor);
+ return CXFA_DataData::ToColor(wsColor.AsStringView());
}
void CXFA_StrokeData::SetColor(FX_ARGB argb) {
diff --git a/xfa/fxfa/parser/cxfa_submitdata.cpp b/xfa/fxfa/parser/cxfa_submitdata.cpp
index 629cb9ea61..1d4b91c5b6 100644
--- a/xfa/fxfa/parser/cxfa_submitdata.cpp
+++ b/xfa/fxfa/parser/cxfa_submitdata.cpp
@@ -18,10 +18,10 @@ int32_t CXFA_SubmitData::GetSubmitFormat() {
return m_pNode->JSNode()->GetEnum(XFA_Attribute::Format);
}
-void CXFA_SubmitData::GetSubmitTarget(WideStringView& wsTarget) {
+void CXFA_SubmitData::GetSubmitTarget(WideString& wsTarget) {
m_pNode->JSNode()->TryCData(XFA_Attribute::Target, wsTarget, true);
}
-void CXFA_SubmitData::GetSubmitXDPContent(WideStringView& wsContent) {
+void CXFA_SubmitData::GetSubmitXDPContent(WideString& wsContent) {
m_pNode->JSNode()->TryCData(XFA_Attribute::XdpContent, wsContent, true);
}
diff --git a/xfa/fxfa/parser/cxfa_submitdata.h b/xfa/fxfa/parser/cxfa_submitdata.h
index 28cb3c29f2..e90848d9f1 100644
--- a/xfa/fxfa/parser/cxfa_submitdata.h
+++ b/xfa/fxfa/parser/cxfa_submitdata.h
@@ -19,8 +19,8 @@ class CXFA_SubmitData : public CXFA_DataData {
bool IsSubmitEmbedPDF();
int32_t GetSubmitFormat();
- void GetSubmitTarget(WideStringView& wsTarget);
- void GetSubmitXDPContent(WideStringView& wsContent);
+ void GetSubmitTarget(WideString& wsTarget);
+ void GetSubmitXDPContent(WideString& wsContent);
};
#endif // XFA_FXFA_PARSER_CXFA_SUBMITDATA_H_
diff --git a/xfa/fxfa/parser/cxfa_validatedata.cpp b/xfa/fxfa/parser/cxfa_validatedata.cpp
index c332b12c7b..c7cfbabe6e 100644
--- a/xfa/fxfa/parser/cxfa_validatedata.cpp
+++ b/xfa/fxfa/parser/cxfa_validatedata.cpp
@@ -45,7 +45,7 @@ void CXFA_ValidateData::GetMessageText(WideString& wsMessage,
if (pItemNode->GetElementType() != XFA_Element::Text)
continue;
- WideStringView wsName;
+ WideString wsName;
pItemNode->JSNode()->TryCData(XFA_Attribute::Name, wsName, true);
if (wsName.IsEmpty() || wsName == wsMessageType) {
pItemNode->JSNode()->TryContent(wsMessage, false, true);
@@ -83,7 +83,7 @@ void CXFA_ValidateData::SetMessageText(WideString& wsMessage,
if (pItemNode->GetElementType() != XFA_Element::Text)
continue;
- WideStringView wsName;
+ WideString wsName;
pItemNode->JSNode()->TryCData(XFA_Attribute::Name, wsName, true);
if (wsName.IsEmpty() || wsName == wsMessageType) {
pItemNode->JSNode()->SetContent(wsMessage, wsMessage, false, false, true);
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 48832eb5e9..2e9eda8b8c 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -198,39 +198,6 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) {
return pUIChild;
}
-XFA_ATTRIBUTEENUM GetAttributeDefaultValue_Enum(XFA_Element eElement,
- XFA_Attribute eAttribute,
- uint32_t dwPacket) {
- void* pValue;
- if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute,
- XFA_AttributeType::Enum, dwPacket)) {
- return (XFA_ATTRIBUTEENUM)(uintptr_t)pValue;
- }
- return XFA_ATTRIBUTEENUM_Unknown;
-}
-
-WideStringView GetAttributeDefaultValue_Cdata(XFA_Element eElement,
- XFA_Attribute eAttribute,
- uint32_t dwPacket) {
- void* pValue;
- if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute,
- XFA_AttributeType::CData, dwPacket)) {
- return (const wchar_t*)pValue;
- }
- return nullptr;
-}
-
-bool GetAttributeDefaultValue_Boolean(XFA_Element eElement,
- XFA_Attribute eAttribute,
- uint32_t dwPacket) {
- void* pValue;
- if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute,
- XFA_AttributeType::Boolean, dwPacket)) {
- return !!pValue;
- }
- return false;
-}
-
} // namespace
CXFA_WidgetData::CXFA_WidgetData(CXFA_Node* pNode)
@@ -315,7 +282,7 @@ std::vector<CXFA_Node*> CXFA_WidgetData::GetEventByActivity(int32_t iActivity,
CXFA_EventData eventData(pNode);
if (eventData.GetActivity() == iActivity) {
if (iActivity == XFA_ATTRIBUTEENUM_Ready) {
- WideStringView wsRef;
+ WideString wsRef;
eventData.GetRef(wsRef);
if (bIsFormReady) {
if (wsRef == WideStringView(L"$form"))
@@ -427,12 +394,11 @@ CFX_RectF CXFA_WidgetData::GetUIMargin() {
return CFX_RectF(fLeftInset, fTopInset, fRightInset, fBottomInset);
}
-int32_t CXFA_WidgetData::GetButtonHighlight() {
+XFA_ATTRIBUTEENUM CXFA_WidgetData::GetButtonHighlight() {
CXFA_Node* pUIChild = GetUIChild();
if (pUIChild)
return pUIChild->JSNode()->GetEnum(XFA_Attribute::Highlight);
- return GetAttributeDefaultValue_Enum(
- XFA_Element::Button, XFA_Attribute::Highlight, XFA_XDPPACKET_Form);
+ return XFA_ATTRIBUTEENUM_Inverted;
}
bool CXFA_WidgetData::GetButtonRollover(WideString& wsRollover,
@@ -440,7 +406,7 @@ bool CXFA_WidgetData::GetButtonRollover(WideString& wsRollover,
if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items, false)) {
CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild);
while (pText) {
- WideStringView wsName;
+ WideString wsName;
pText->JSNode()->TryCData(XFA_Attribute::Name, wsName, true);
if (wsName == L"rollover") {
pText->JSNode()->TryContent(wsRollover, false, true);
@@ -457,7 +423,7 @@ bool CXFA_WidgetData::GetButtonDown(WideString& wsDown, bool& bRichText) {
if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items, false)) {
CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild);
while (pText) {
- WideStringView wsName;
+ WideString wsName;
pText->JSNode()->TryCData(XFA_Attribute::Name, wsName, true);
if (wsName == L"down") {
pText->JSNode()->TryContent(wsDown, false, true);
@@ -470,46 +436,39 @@ bool CXFA_WidgetData::GetButtonDown(WideString& wsDown, bool& bRichText) {
return false;
}
-int32_t CXFA_WidgetData::GetCheckButtonShape() {
+XFA_ATTRIBUTEENUM CXFA_WidgetData::GetCheckButtonShape() {
CXFA_Node* pUIChild = GetUIChild();
if (pUIChild)
return pUIChild->JSNode()->GetEnum(XFA_Attribute::Shape);
- return GetAttributeDefaultValue_Enum(
- XFA_Element::CheckButton, XFA_Attribute::Shape, XFA_XDPPACKET_Form);
+ return XFA_ATTRIBUTEENUM_Square;
}
-int32_t CXFA_WidgetData::GetCheckButtonMark() {
+XFA_ATTRIBUTEENUM CXFA_WidgetData::GetCheckButtonMark() {
CXFA_Node* pUIChild = GetUIChild();
if (pUIChild)
return pUIChild->JSNode()->GetEnum(XFA_Attribute::Mark);
- return GetAttributeDefaultValue_Enum(XFA_Element::CheckButton,
- XFA_Attribute::Mark, XFA_XDPPACKET_Form);
+ return XFA_ATTRIBUTEENUM_Default;
}
bool CXFA_WidgetData::IsRadioButton() {
- if (CXFA_Node* pParent = m_pNode->GetNodeItem(XFA_NODEITEM_Parent))
- return pParent->GetElementType() == XFA_Element::ExclGroup;
- return false;
+ CXFA_Node* pParent = m_pNode->GetNodeItem(XFA_NODEITEM_Parent);
+ return pParent && pParent->GetElementType() == XFA_Element::ExclGroup;
}
float CXFA_WidgetData::GetCheckButtonSize() {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild)
+ if (pUIChild) {
return pUIChild->JSNode()
->GetMeasure(XFA_Attribute::Size)
.ToUnit(XFA_Unit::Pt);
- return XFA_GetAttributeDefaultValue_Measure(
- XFA_Element::CheckButton, XFA_Attribute::Size, XFA_XDPPACKET_Form)
- .ToUnit(XFA_Unit::Pt);
+ }
+ return CXFA_Measurement(10, XFA_Unit::Pt).ToUnit(XFA_Unit::Pt);
}
bool CXFA_WidgetData::IsAllowNeutral() {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild)
- return pUIChild->JSNode()->GetBoolean(XFA_Attribute::AllowNeutral);
- return GetAttributeDefaultValue_Boolean(XFA_Element::CheckButton,
- XFA_Attribute::AllowNeutral,
- XFA_XDPPACKET_Form);
+ return pUIChild &&
+ pUIChild->JSNode()->GetBoolean(XFA_Attribute::AllowNeutral);
}
XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() {
@@ -695,28 +654,23 @@ CXFA_Node* CXFA_WidgetData::GetExclGroupNextMember(CXFA_Node* pNode) {
return nullptr;
}
-int32_t CXFA_WidgetData::GetChoiceListCommitOn() {
+XFA_ATTRIBUTEENUM CXFA_WidgetData::GetChoiceListCommitOn() {
CXFA_Node* pUIChild = GetUIChild();
if (pUIChild)
return pUIChild->JSNode()->GetEnum(XFA_Attribute::CommitOn);
- return GetAttributeDefaultValue_Enum(
- XFA_Element::ChoiceList, XFA_Attribute::CommitOn, XFA_XDPPACKET_Form);
+ return XFA_ATTRIBUTEENUM_Select;
}
bool CXFA_WidgetData::IsChoiceListAllowTextEntry() {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild)
- return pUIChild->JSNode()->GetBoolean(XFA_Attribute::TextEntry);
- return GetAttributeDefaultValue_Boolean(
- XFA_Element::ChoiceList, XFA_Attribute::TextEntry, XFA_XDPPACKET_Form);
+ return pUIChild && pUIChild->JSNode()->GetBoolean(XFA_Attribute::TextEntry);
}
-int32_t CXFA_WidgetData::GetChoiceListOpen() {
+XFA_ATTRIBUTEENUM CXFA_WidgetData::GetChoiceListOpen() {
CXFA_Node* pUIChild = GetUIChild();
if (pUIChild)
return pUIChild->JSNode()->GetEnum(XFA_Attribute::Open);
- return GetAttributeDefaultValue_Enum(XFA_Element::ChoiceList,
- XFA_Attribute::Open, XFA_XDPPACKET_Form);
+ return XFA_ATTRIBUTEENUM_UserControl;
}
bool CXFA_WidgetData::IsListBox() {
@@ -1231,7 +1185,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_DataLength(int32_t* val) {
bool CXFA_WidgetData::GetBarcodeAttribute_StartChar(char* val) {
CXFA_Node* pUIChild = GetUIChild();
- WideStringView wsStartEndChar;
+ WideString wsStartEndChar;
if (pUIChild->JSNode()->TryCData(XFA_Attribute::StartChar, wsStartEndChar,
true)) {
if (wsStartEndChar.GetLength()) {
@@ -1244,7 +1198,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_StartChar(char* val) {
bool CXFA_WidgetData::GetBarcodeAttribute_EndChar(char* val) {
CXFA_Node* pUIChild = GetUIChild();
- WideStringView wsStartEndChar;
+ WideString wsStartEndChar;
if (pUIChild->JSNode()->TryCData(XFA_Attribute::EndChar, wsStartEndChar,
true)) {
if (wsStartEndChar.GetLength()) {
@@ -1364,29 +1318,22 @@ bool CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(float* val) {
void CXFA_WidgetData::GetPasswordChar(WideString& wsPassWord) {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild) {
+ if (pUIChild)
pUIChild->JSNode()->TryCData(XFA_Attribute::PasswordChar, wsPassWord, true);
- } else {
- wsPassWord = GetAttributeDefaultValue_Cdata(XFA_Element::PasswordEdit,
- XFA_Attribute::PasswordChar,
- XFA_XDPPACKET_Form);
- }
+ else
+ wsPassWord = L"*";
}
bool CXFA_WidgetData::IsMultiLine() {
CXFA_Node* pUIChild = GetUIChild();
- if (pUIChild)
- return pUIChild->JSNode()->GetBoolean(XFA_Attribute::MultiLine);
- return GetAttributeDefaultValue_Boolean(
- XFA_Element::TextEdit, XFA_Attribute::MultiLine, XFA_XDPPACKET_Form);
+ return pUIChild && pUIChild->JSNode()->GetBoolean(XFA_Attribute::MultiLine);
}
-int32_t CXFA_WidgetData::GetVerticalScrollPolicy() {
+XFA_ATTRIBUTEENUM CXFA_WidgetData::GetVerticalScrollPolicy() {
CXFA_Node* pUIChild = GetUIChild();
if (pUIChild)
return pUIChild->JSNode()->GetEnum(XFA_Attribute::VScrollPolicy);
- return GetAttributeDefaultValue_Enum(
- XFA_Element::TextEdit, XFA_Attribute::VScrollPolicy, XFA_XDPPACKET_Form);
+ return XFA_ATTRIBUTEENUM_Auto;
}
int32_t CXFA_WidgetData::GetMaxChars(XFA_Element& eType) {
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h
index 3f1b4dc399..12e811361b 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.h
+++ b/xfa/fxfa/parser/cxfa_widgetdata.h
@@ -70,11 +70,11 @@ class CXFA_WidgetData : public CXFA_DataData {
CXFA_BorderData GetUIBorderData();
CFX_RectF GetUIMargin();
- int32_t GetButtonHighlight();
+ XFA_ATTRIBUTEENUM GetButtonHighlight();
bool GetButtonRollover(WideString& wsRollover, bool& bRichText);
bool GetButtonDown(WideString& wsDown, bool& bRichText);
- int32_t GetCheckButtonShape();
- int32_t GetCheckButtonMark();
+ XFA_ATTRIBUTEENUM GetCheckButtonShape();
+ XFA_ATTRIBUTEENUM GetCheckButtonMark();
float GetCheckButtonSize();
bool IsAllowNeutral();
bool IsRadioButton();
@@ -89,9 +89,9 @@ class CXFA_WidgetData : public CXFA_DataData {
bool bSyncData);
CXFA_Node* GetExclGroupFirstMember();
CXFA_Node* GetExclGroupNextMember(CXFA_Node* pNode);
- int32_t GetChoiceListCommitOn();
+ XFA_ATTRIBUTEENUM GetChoiceListCommitOn();
bool IsChoiceListAllowTextEntry();
- int32_t GetChoiceListOpen();
+ XFA_ATTRIBUTEENUM GetChoiceListOpen();
bool IsListBox();
int32_t CountChoiceListItems(bool bSaveValue);
bool GetChoiceListItem(WideString& wsText, int32_t nIndex, bool bSaveValue);
@@ -145,7 +145,7 @@ class CXFA_WidgetData : public CXFA_DataData {
void GetPasswordChar(WideString& wsPassWord);
bool IsMultiLine();
- int32_t GetVerticalScrollPolicy();
+ XFA_ATTRIBUTEENUM GetVerticalScrollPolicy();
int32_t GetMaxChars(XFA_Element& eType);
bool GetFracDigits(int32_t& iFracDigits);
bool GetLeadDigits(int32_t& iLeadDigits);
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 67256f2385..128ad7b2ad 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -424,13 +424,13 @@ CXFA_Node* ScopeMatchGlobalBinding(CXFA_Node* pDataScope,
}
CXFA_Node* FindGlobalDataNode(CXFA_Document* pDocument,
- WideStringView wsName,
+ const WideString& wsName,
CXFA_Node* pDataScope,
XFA_Element eMatchNodeType) {
if (wsName.IsEmpty())
return nullptr;
- uint32_t dwNameHash = FX_HashCode_GetW(wsName, false);
+ uint32_t dwNameHash = FX_HashCode_GetW(wsName.AsStringView(), false);
CXFA_Node* pBounded = GetGlobalBinding(pDocument, dwNameHash);
if (!pBounded) {
pBounded =
@@ -442,13 +442,13 @@ CXFA_Node* FindGlobalDataNode(CXFA_Document* pDocument,
}
CXFA_Node* FindOnceDataNode(CXFA_Document* pDocument,
- WideStringView wsName,
+ const WideString& wsName,
CXFA_Node* pDataScope,
XFA_Element eMatchNodeType) {
if (wsName.IsEmpty())
return nullptr;
- uint32_t dwNameHash = FX_HashCode_GetW(wsName, false);
+ uint32_t dwNameHash = FX_HashCode_GetW(wsName.AsStringView(), false);
CXFA_Node* pLastDataScope = nullptr;
for (CXFA_Node* pCurDataScope = pDataScope;
pCurDataScope && pCurDataScope->GetPacketID() == XFA_XDPPACKET_Datasets;
@@ -469,7 +469,7 @@ CXFA_Node* FindOnceDataNode(CXFA_Document* pDocument,
}
CXFA_Node* FindDataRefDataNode(CXFA_Document* pDocument,
- WideStringView wsRef,
+ const WideString& wsRef,
CXFA_Node* pDataScope,
XFA_Element eMatchNodeType,
CXFA_Node* pTemplateNode,
@@ -480,8 +480,8 @@ CXFA_Node* FindDataRefDataNode(CXFA_Document* pDocument,
dFlags |= (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings);
XFA_RESOLVENODE_RS rs;
- pDocument->GetScriptContext()->ResolveObjects(pDataScope, wsRef, rs, dFlags,
- pTemplateNode);
+ pDocument->GetScriptContext()->ResolveObjects(
+ pDataScope, wsRef.AsStringView(), rs, dFlags, pTemplateNode);
if (rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeAll ||
rs.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll ||
rs.objects.size() > 1) {
@@ -513,7 +513,7 @@ CXFA_Node* CloneOrMergeInstanceManager(CXFA_Document* pDocument,
CXFA_Node* pFormParent,
CXFA_Node* pTemplateNode,
std::vector<CXFA_Node*>* subforms) {
- WideStringView wsSubformName =
+ WideString wsSubformName =
pTemplateNode->JSNode()->GetCData(XFA_Attribute::Name);
WideString wsInstMgrNodeName = L"_" + wsSubformName;
uint32_t dwInstNameHash =
@@ -1165,13 +1165,13 @@ void UpdateBindingRelations(CXFA_Document* pDocument,
bMatchRef = bDataRef;
bParentDataRef = true;
if (!pDataNode && bDataRef) {
- WideStringView wsRef =
+ WideString wsRef =
pTemplateNodeBind->JSNode()->GetCData(XFA_Attribute::Ref);
uint32_t dFlags =
XFA_RESOLVENODE_Children | XFA_RESOLVENODE_CreateNode;
XFA_RESOLVENODE_RS rs;
- pDocument->GetScriptContext()->ResolveObjects(pDataScope, wsRef, rs,
- dFlags, pTemplateNode);
+ pDocument->GetScriptContext()->ResolveObjects(
+ pDataScope, wsRef.AsStringView(), rs, dFlags, pTemplateNode);
CXFA_Object* pObject =
!rs.objects.empty() ? rs.objects.front() : nullptr;
pDataNode = ToNode(pObject);
@@ -1465,7 +1465,7 @@ void CXFA_Document::DoDataMerge() {
this, pFormRoot, pTemplateChosen, false, nullptr);
ASSERT(pSubformSetNode);
if (!pDataTopLevel) {
- WideStringView wsFormName =
+ WideString wsFormName =
pSubformSetNode->JSNode()->GetCData(XFA_Attribute::Name);
WideString wsDataTopLevelName(wsFormName.IsEmpty() ? L"form" : wsFormName);
CFX_XMLElement* pDataTopLevelXMLNode =
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index 122cfb0a1a..5bdfe5853b 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -393,17 +393,6 @@ XFA_Element XFA_GetElementTypeForName(const WideStringView& wsName) {
return XFA_Element::Unknown;
}
-CXFA_Measurement XFA_GetAttributeDefaultValue_Measure(XFA_Element eElement,
- XFA_Attribute eAttribute,
- uint32_t dwPacket) {
- void* pValue;
- if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute,
- XFA_AttributeType::Measure, dwPacket)) {
- return *(CXFA_Measurement*)pValue;
- }
- return CXFA_Measurement();
-}
-
bool XFA_GetAttributeDefaultValue(void*& pValue,
XFA_Element eElement,
XFA_Attribute eAttribute,
diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h
index a7498561e1..cfa27bbccd 100644
--- a/xfa/fxfa/parser/xfa_utils.h
+++ b/xfa/fxfa/parser/xfa_utils.h
@@ -19,10 +19,9 @@ class CXFA_WidgetData;
double XFA_GetFractionalScale(uint32_t idx);
int XFA_GetMaxFractionalScale();
-bool XFA_FDEExtension_ResolveNamespaceQualifier(
- CFX_XMLElement* pNode,
- const WideStringView& wsQualifier,
- WideString* wsNamespaceURI);
+bool XFA_FDEExtension_ResolveNamespaceQualifier(CFX_XMLElement* pNode,
+ const WideString& wsQualifier,
+ WideString* wsNamespaceURI);
template <class NodeType, class TraverseStrategy>
class CXFA_NodeIteratorTemplate {
@@ -177,9 +176,6 @@ const XFA_Attribute* XFA_GetElementAttributes(XFA_Element eElement,
int32_t& iCount);
const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_Element eName);
XFA_Element XFA_GetElementTypeForName(const WideStringView& wsName);
-CXFA_Measurement XFA_GetAttributeDefaultValue_Measure(XFA_Element eElement,
- XFA_Attribute eAttribute,
- uint32_t dwPacket);
bool XFA_GetAttributeDefaultValue(void*& pValue,
XFA_Element eElement,
XFA_Attribute eAttribute,