diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-02 19:09:58 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-02 19:09:58 +0000 |
commit | 3ac07ffafea1ee4d3cf985e32692849dd3fcfdfb (patch) | |
tree | 3edbd3db87541a57fa0ee172bd50b70d35d45a11 | |
parent | bf29e5b532e4ef9a309906083b33b6d4c48ff757 (diff) | |
download | pdfium-3ac07ffafea1ee4d3cf985e32692849dd3fcfdfb.tar.xz |
Cleanup params to CJX_Node::TryCData
This CL removes the bProto param as it was never set and inlines the
value where needed in the methods. The default value was removed from
bUseDefault and inlined into callsites as needed.
Change-Id: I773261d19aa3799bc607e7df482b5f5e5217bee6
Reviewed-on: https://pdfium-review.googlesource.com/17533
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
-rw-r--r-- | fxjs/cfxjse_engine.cpp | 2 | ||||
-rw-r--r-- | fxjs/cjx_node.cpp | 16 | ||||
-rw-r--r-- | fxjs/cjx_node.h | 10 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_textprovider.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_binditems.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_document.cpp | 15 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_event.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_font.cpp | 8 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_image.cpp | 5 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 29 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_stroke.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_submit.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_validate.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_widgetdata.cpp | 23 |
16 files changed, 68 insertions, 66 deletions
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp index 5fa0a11e21..fb36c6dba0 100644 --- a/fxjs/cfxjse_engine.cpp +++ b/fxjs/cfxjse_engine.cpp @@ -483,7 +483,7 @@ bool CFXJSE_Engine::RunVariablesScript(CXFA_Node* pScriptNode) { return false; WideStringView wsScript; - if (!pTextNode->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsScript)) + if (!pTextNode->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsScript, true)) return false; ByteString btScript = FX_UTF8Encode(wsScript); diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp index 0c78f99551..c6e60933f0 100644 --- a/fxjs/cjx_node.cpp +++ b/fxjs/cjx_node.cpp @@ -3031,7 +3031,7 @@ CXFA_Measurement CJX_Node::GetMeasure(XFA_ATTRIBUTE eAttr) const { WideStringView CJX_Node::GetCData(XFA_ATTRIBUTE eAttr) { WideStringView wsValue; - return TryCData(eAttr, wsValue) ? wsValue : WideStringView(); + return TryCData(eAttr, wsValue, true) ? wsValue : WideStringView(); } bool CJX_Node::SetCData(XFA_ATTRIBUTE eAttr, @@ -3166,11 +3166,10 @@ bool CJX_Node::SetAttributeValue(const WideString& wsValue, bool CJX_Node::TryCData(XFA_ATTRIBUTE eAttr, WideString& wsValue, - bool bUseDefault, - bool bProto) { + bool bUseDefault) { void* pKey = GetMapKey_Element(GetXFANode()->GetElementType(), eAttr); if (eAttr == XFA_ATTRIBUTE_Value) { - WideString* pStr = (WideString*)GetUserData(pKey, bProto); + WideString* pStr = (WideString*)GetUserData(pKey, true); if (pStr) { wsValue = *pStr; return true; @@ -3197,11 +3196,10 @@ bool CJX_Node::TryCData(XFA_ATTRIBUTE eAttr, bool CJX_Node::TryCData(XFA_ATTRIBUTE eAttr, WideStringView& wsValue, - bool bUseDefault, - bool bProto) { + bool bUseDefault) { void* pKey = GetMapKey_Element(GetXFANode()->GetElementType(), eAttr); if (eAttr == XFA_ATTRIBUTE_Value) { - WideString* pStr = (WideString*)GetUserData(pKey, bProto); + WideString* pStr = (WideString*)GetUserData(pKey, true); if (pStr) { wsValue = pStr->AsStringView(); return true; @@ -3556,7 +3554,7 @@ bool CJX_Node::TryContent(WideString& wsContent, GetXFANode()->InsertChild(pContentRawDataNode); } return pContentRawDataNode->JSNode()->TryContent(wsContent, bScriptModify, - bProto); + true); } case XFA_ObjectType::NodeC: case XFA_ObjectType::NodeV: @@ -3575,7 +3573,7 @@ bool CJX_Node::TryContent(WideString& wsContent, GetDocument()->GetScriptContext()->AddNodesOfRunScript(GetXFANode()); } } - return TryCData(XFA_ATTRIBUTE_Value, wsContent, false, bProto); + return TryCData(XFA_ATTRIBUTE_Value, wsContent, false); } return false; } diff --git a/fxjs/cjx_node.h b/fxjs/cjx_node.h index 863dcc53af..df360011a4 100644 --- a/fxjs/cjx_node.h +++ b/fxjs/cjx_node.h @@ -84,14 +84,8 @@ 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 = true, - bool bProto = true); - bool TryCData(XFA_ATTRIBUTE eAttr, - WideString& wsValue, - bool bUseDefault = true, - bool bProto = true); + 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 = false, diff --git a/xfa/fxfa/cxfa_textprovider.cpp b/xfa/fxfa/cxfa_textprovider.cpp index fa564290ee..db220b3f0f 100644 --- a/xfa/fxfa/cxfa_textprovider.cpp +++ b/xfa/fxfa/cxfa_textprovider.cpp @@ -98,7 +98,7 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) { CXFA_Node* pNode = pItemNode->GetNodeItem(XFA_NODEITEM_FirstChild); while (pNode) { WideStringView wsName; - pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName); + pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName, true); if (m_eType == XFA_TEXTPROVIDERTYPE_Rollover && wsName == L"rollover") return pNode; if (m_eType == XFA_TEXTPROVIDERTYPE_Down && wsName == L"down") diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index c8b4a9389c..af29535dce 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -162,7 +162,7 @@ CXFA_WidgetAcc::~CXFA_WidgetAcc() {} bool CXFA_WidgetAcc::GetName(WideString& wsName, int32_t iNameType) { if (iNameType == 0) { - m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName); + m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName, true); return !wsName.IsEmpty(); } m_pNode->GetSOMExpression(wsName); diff --git a/xfa/fxfa/parser/cxfa_binditems.cpp b/xfa/fxfa/parser/cxfa_binditems.cpp index bfa4c30de2..c9d224050f 100644 --- a/xfa/fxfa/parser/cxfa_binditems.cpp +++ b/xfa/fxfa/parser/cxfa_binditems.cpp @@ -11,15 +11,15 @@ CXFA_BindItems::CXFA_BindItems(CXFA_Node* pNode) : CXFA_Data(pNode) {} void CXFA_BindItems::GetLabelRef(WideStringView& wsLabelRef) { - m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_LabelRef, wsLabelRef); + m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_LabelRef, wsLabelRef, true); } void CXFA_BindItems::GetValueRef(WideStringView& wsValueRef) { - m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_ValueRef, wsValueRef); + m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_ValueRef, wsValueRef, true); } void CXFA_BindItems::GetRef(WideStringView& wsRef) { - m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Ref, wsRef); + m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Ref, wsRef, true); } bool CXFA_BindItems::SetConnection(const WideString& wsConnection) { diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp index 7723d0b5a7..d2c2da814d 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -334,7 +334,7 @@ CXFA_Node* CXFA_Document::GetNodeByID(CXFA_Node* pRoot, for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; pNode = sIterator.MoveToNext()) { WideStringView wsIDVal; - if (pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && + if (pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Id, wsIDVal, true) && !wsIDVal.IsEmpty()) { if (wsIDVal == wsID) return pNode; @@ -354,15 +354,16 @@ void CXFA_Document::DoProtoMerge() { for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; pNode = sIterator.MoveToNext()) { WideStringView wsIDVal; - if (pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Id, wsIDVal) && + if (pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Id, wsIDVal, true) && !wsIDVal.IsEmpty()) { mIDMap[FX_HashCode_GetW(wsIDVal, false)] = pNode; } WideStringView wsUseVal; - if (pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) && + if (pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Use, wsUseVal, true) && !wsUseVal.IsEmpty()) { sUseNodes.insert(pNode); - } else if (pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Usehref, wsUseVal) && + } else if (pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Usehref, wsUseVal, + true) && !wsUseVal.IsEmpty()) { sUseNodes.insert(pNode); } @@ -371,7 +372,8 @@ void CXFA_Document::DoProtoMerge() { for (CXFA_Node* pUseHrefNode : sUseNodes) { WideString wsUseVal; WideStringView wsURI, wsID, wsSOM; - if (pUseHrefNode->JSNode()->TryCData(XFA_ATTRIBUTE_Usehref, wsUseVal) && + if (pUseHrefNode->JSNode()->TryCData(XFA_ATTRIBUTE_Usehref, wsUseVal, + true) && !wsUseVal.IsEmpty()) { auto uSharpPos = wsUseVal.Find('#'); if (!uSharpPos.has_value()) { @@ -390,7 +392,8 @@ void CXFA_Document::DoProtoMerge() { uLen - uSharpPos.value() - 1); } } - } else if (pUseHrefNode->JSNode()->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) && + } else if (pUseHrefNode->JSNode()->TryCData(XFA_ATTRIBUTE_Use, wsUseVal, + true) && !wsUseVal.IsEmpty()) { if (wsUseVal[0] == '#') wsID = WideStringView(wsUseVal.c_str() + 1, wsUseVal.GetLength() - 1); diff --git a/xfa/fxfa/parser/cxfa_event.cpp b/xfa/fxfa/parser/cxfa_event.cpp index 822baf8ce7..e9f1961f07 100644 --- a/xfa/fxfa/parser/cxfa_event.cpp +++ b/xfa/fxfa/parser/cxfa_event.cpp @@ -27,7 +27,7 @@ XFA_Element CXFA_Event::GetEventType() const { } void CXFA_Event::GetRef(WideStringView& wsRef) { - m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Ref, wsRef); + m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Ref, wsRef, true); } CXFA_Script CXFA_Event::GetScript() const { @@ -45,6 +45,6 @@ void CXFA_Event::GetSignDataTarget(WideString& wsTarget) { return; WideStringView wsCData; - pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Target, wsCData); + pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Target, wsCData, true); wsTarget = wsCData; } diff --git a/xfa/fxfa/parser/cxfa_font.cpp b/xfa/fxfa/parser/cxfa_font.cpp index 4fc0a57092..d54ac0ba72 100644 --- a/xfa/fxfa/parser/cxfa_font.cpp +++ b/xfa/fxfa/parser/cxfa_font.cpp @@ -21,21 +21,21 @@ float CXFA_Font::GetBaselineShift() { float CXFA_Font::GetHorizontalScale() { WideString wsValue; - m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_FontHorizontalScale, wsValue); + m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_FontHorizontalScale, wsValue, true); int32_t iScale = FXSYS_wtoi(wsValue.c_str()); return iScale > 0 ? (float)iScale : 100.0f; } float CXFA_Font::GetVerticalScale() { WideString wsValue; - m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_FontVerticalScale, wsValue); + m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_FontVerticalScale, wsValue, true); int32_t iScale = FXSYS_wtoi(wsValue.c_str()); return iScale > 0 ? (float)iScale : 100.0f; } float CXFA_Font::GetLetterSpacing() { WideStringView wsValue; - if (!m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_LetterSpacing, wsValue)) + if (!m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_LetterSpacing, wsValue, true)) return 0; CXFA_Measurement ms(wsValue); @@ -69,7 +69,7 @@ float CXFA_Font::GetFontSize() { } void CXFA_Font::GetTypeface(WideStringView& wsTypeFace) { - m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Typeface, wsTypeFace); + m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Typeface, wsTypeFace, true); } bool CXFA_Font::IsBold() { diff --git a/xfa/fxfa/parser/cxfa_image.cpp b/xfa/fxfa/parser/cxfa_image.cpp index 8a346e0f42..b0afca0d68 100644 --- a/xfa/fxfa/parser/cxfa_image.cpp +++ b/xfa/fxfa/parser/cxfa_image.cpp @@ -16,12 +16,13 @@ int32_t CXFA_Image::GetAspect() { } bool CXFA_Image::GetContentType(WideString& wsContentType) { - return m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_ContentType, wsContentType); + return m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_ContentType, wsContentType, + true); } bool CXFA_Image::GetHref(WideString& wsHref) { if (m_bDefValue) - return m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Href, wsHref); + return m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Href, wsHref, true); return m_pNode->JSNode()->GetAttribute(L"href", wsHref, true); } diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp index 688990b2fd..428746d3c2 100644 --- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp @@ -1780,7 +1780,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { : containerSize.width - fLeftInset - fRightInset; WideStringView wsColumnWidths; if (pLayoutNode->JSNode()->TryCData(XFA_ATTRIBUTE_ColumnWidths, - wsColumnWidths)) { + wsColumnWidths, true)) { auto widths = SeparateStringW(wsColumnWidths.unterminated_c_str(), wsColumnWidths.GetLength(), L' '); for (auto& width : widths) { diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index d3a33e7de9..2c1e6e4fd3 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -66,7 +66,7 @@ class PageSetContainerLayoutItem { uint32_t GetRelevant(CXFA_Node* pFormItem, uint32_t dwParentRelvant) { uint32_t dwRelevant = XFA_WidgetStatus_Viewable | XFA_WidgetStatus_Printable; WideStringView wsRelevant; - if (pFormItem->JSNode()->TryCData(XFA_ATTRIBUTE_Relevant, wsRelevant)) { + if (pFormItem->JSNode()->TryCData(XFA_ATTRIBUTE_Relevant, wsRelevant, true)) { if (wsRelevant == L"+print" || wsRelevant == L"print") dwRelevant &= ~XFA_WidgetStatus_Viewable; else if (wsRelevant == L"-print") @@ -950,11 +950,11 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, WideStringView wsOverflowTarget; WideStringView wsOverflowTrailer; pOverflowNode->JSNode()->TryCData(XFA_ATTRIBUTE_OverflowLeader, - wsOverflowLeader); + wsOverflowLeader, true); pOverflowNode->JSNode()->TryCData(XFA_ATTRIBUTE_OverflowTrailer, - wsOverflowTrailer); + wsOverflowTrailer, true); pOverflowNode->JSNode()->TryCData(XFA_ATTRIBUTE_OverflowTarget, - wsOverflowTarget); + wsOverflowTarget, true); if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || !wsOverflowTarget.IsEmpty()) { if (!wsOverflowTarget.IsEmpty() && bCreatePage && @@ -994,9 +994,12 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, WideStringView wsOverflowLeader; WideStringView wsOverflowTrailer; WideStringView wsOverflowTarget; - pOverflowNode->JSNode()->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader); - pOverflowNode->JSNode()->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer); - pOverflowNode->JSNode()->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget); + pOverflowNode->JSNode()->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader, + true); + pOverflowNode->JSNode()->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer, + true); + pOverflowNode->JSNode()->TryCData(XFA_ATTRIBUTE_Target, wsOverflowTarget, + true); if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) { CXFA_Node* pTarget = ResolveBreakTarget(m_pTemplatePageSetRoot, true, wsOverflowTarget); @@ -1088,7 +1091,7 @@ bool CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer( if (pBookendNode->GetElementType() == XFA_Element::Break) { pBookendNode->JSNode()->TryCData( bLeader ? XFA_ATTRIBUTE_BookendLeader : XFA_ATTRIBUTE_BookendTrailer, - wsBookendLeader); + wsBookendLeader, true); if (!wsBookendLeader.IsEmpty()) { pBookendAppendTemplate = ResolveBreakTarget(pContainer, false, wsBookendLeader); @@ -1097,8 +1100,8 @@ bool CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer( return false; } else if (pBookendNode->GetElementType() == XFA_Element::Bookend) { pBookendNode->JSNode()->TryCData( - bLeader ? XFA_ATTRIBUTE_Leader : XFA_ATTRIBUTE_Trailer, - wsBookendLeader); + bLeader ? XFA_ATTRIBUTE_Leader : XFA_ATTRIBUTE_Trailer, wsBookendLeader, + true); pBookendAppendTemplate = ResolveBreakTarget(pContainer, true, wsBookendLeader); return true; @@ -1664,11 +1667,11 @@ CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow(CXFA_Node* pFormNode) { WideStringView wsOverflowTarget; WideStringView wsOverflowTrailer; pCurNode->JSNode()->TryCData(XFA_ATTRIBUTE_OverflowLeader, - wsOverflowLeader); + wsOverflowLeader, true); pCurNode->JSNode()->TryCData(XFA_ATTRIBUTE_OverflowTrailer, - wsOverflowTrailer); + wsOverflowTrailer, true); pCurNode->JSNode()->TryCData(XFA_ATTRIBUTE_OverflowTarget, - wsOverflowTarget); + wsOverflowTarget, true); if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || !wsOverflowTarget.IsEmpty()) { return pCurNode; diff --git a/xfa/fxfa/parser/cxfa_stroke.cpp b/xfa/fxfa/parser/cxfa_stroke.cpp index 15ff71313e..062e2e8da0 100644 --- a/xfa/fxfa/parser/cxfa_stroke.cpp +++ b/xfa/fxfa/parser/cxfa_stroke.cpp @@ -53,7 +53,7 @@ FX_ARGB CXFA_Stroke::GetColor() const { return 0xFF000000; WideStringView wsColor; - pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsColor); + pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Value, wsColor, true); return CXFA_Data::ToColor(wsColor); } diff --git a/xfa/fxfa/parser/cxfa_submit.cpp b/xfa/fxfa/parser/cxfa_submit.cpp index c4fb22582c..b7802c0248 100644 --- a/xfa/fxfa/parser/cxfa_submit.cpp +++ b/xfa/fxfa/parser/cxfa_submit.cpp @@ -19,9 +19,9 @@ int32_t CXFA_Submit::GetSubmitFormat() { } void CXFA_Submit::GetSubmitTarget(WideStringView& wsTarget) { - m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Target, wsTarget); + m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Target, wsTarget, true); } void CXFA_Submit::GetSubmitXDPContent(WideStringView& wsContent) { - m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_XdpContent, wsContent); + m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_XdpContent, wsContent, true); } diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp index f2892e507f..0df92d310c 100644 --- a/xfa/fxfa/parser/cxfa_validate.cpp +++ b/xfa/fxfa/parser/cxfa_validate.cpp @@ -54,7 +54,7 @@ void CXFA_Validate::GetMessageText(WideString& wsMessage, continue; WideStringView wsName; - pItemNode->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName); + pItemNode->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName, true); if (wsName.IsEmpty() || wsName == wsMessageType) { pItemNode->JSNode()->TryContent(wsMessage); return; @@ -92,7 +92,7 @@ void CXFA_Validate::SetMessageText(WideString& wsMessage, continue; WideStringView wsName; - pItemNode->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName); + pItemNode->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName, true); if (wsName.IsEmpty() || wsName == wsMessageType) { pItemNode->JSNode()->SetContent(wsMessage, wsMessage, false, false, true); return; diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index a0ac520981..1d6ea33859 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -445,7 +445,7 @@ bool CXFA_WidgetData::GetButtonRollover(WideString& wsRollover, CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); while (pText) { WideStringView wsName; - pText->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName); + pText->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName, true); if (wsName == L"rollover") { pText->JSNode()->TryContent(wsRollover); bRichText = pText->GetElementType() == XFA_Element::ExData; @@ -462,7 +462,7 @@ bool CXFA_WidgetData::GetButtonDown(WideString& wsDown, bool& bRichText) { CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); while (pText) { WideStringView wsName; - pText->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName); + pText->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName, true); if (wsName == L"down") { pText->JSNode()->TryContent(wsDown); bRichText = pText->GetElementType() == XFA_Element::ExData; @@ -1177,8 +1177,8 @@ WideString CXFA_WidgetData::GetBarcodeType() { bool CXFA_WidgetData::GetBarcodeAttribute_CharEncoding(int32_t* val) { CXFA_Node* pUIChild = GetUIChild(); WideString wsCharEncoding; - if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_CharEncoding, - wsCharEncoding)) { + if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_CharEncoding, wsCharEncoding, + true)) { if (wsCharEncoding.CompareNoCase(L"UTF-16")) { *val = CHAR_ENCODING_UNICODE; return true; @@ -1218,7 +1218,8 @@ bool CXFA_WidgetData::GetBarcodeAttribute_Checksum(bool* val) { bool CXFA_WidgetData::GetBarcodeAttribute_DataLength(int32_t* val) { CXFA_Node* pUIChild = GetUIChild(); WideString wsDataLength; - if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_DataLength, wsDataLength)) { + if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_DataLength, wsDataLength, + true)) { *val = FXSYS_wtoi(wsDataLength.c_str()); return true; } @@ -1228,7 +1229,8 @@ bool CXFA_WidgetData::GetBarcodeAttribute_DataLength(int32_t* val) { bool CXFA_WidgetData::GetBarcodeAttribute_StartChar(char* val) { CXFA_Node* pUIChild = GetUIChild(); WideStringView wsStartEndChar; - if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_StartChar, wsStartEndChar)) { + if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_StartChar, wsStartEndChar, + true)) { if (wsStartEndChar.GetLength()) { *val = static_cast<char>(wsStartEndChar[0]); return true; @@ -1240,7 +1242,8 @@ bool CXFA_WidgetData::GetBarcodeAttribute_StartChar(char* val) { bool CXFA_WidgetData::GetBarcodeAttribute_EndChar(char* val) { CXFA_Node* pUIChild = GetUIChild(); WideStringView wsStartEndChar; - if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_EndChar, wsStartEndChar)) { + if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_EndChar, wsStartEndChar, + true)) { if (wsStartEndChar.GetLength()) { *val = static_cast<char>(wsStartEndChar[0]); return true; @@ -1253,7 +1256,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_ECLevel(int32_t* val) { CXFA_Node* pUIChild = GetUIChild(); WideString wsECLevel; if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_ErrorCorrectionLevel, - wsECLevel)) { + wsECLevel, true)) { *val = FXSYS_wtoi(wsECLevel.c_str()); return true; } @@ -1334,7 +1337,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(float* val) { CXFA_Node* pUIChild = GetUIChild(); WideString wsWideNarrowRatio; if (pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_WideNarrowRatio, - wsWideNarrowRatio)) { + wsWideNarrowRatio, true)) { auto ptPos = wsWideNarrowRatio.Find(':'); float fRatio = 0; if (!ptPos.has_value()) { @@ -1358,7 +1361,7 @@ bool CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(float* val) { void CXFA_WidgetData::GetPasswordChar(WideString& wsPassWord) { CXFA_Node* pUIChild = GetUIChild(); if (pUIChild) { - pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_PasswordChar, wsPassWord); + pUIChild->JSNode()->TryCData(XFA_ATTRIBUTE_PasswordChar, wsPassWord, true); } else { wsPassWord = GetAttributeDefaultValue_Cdata(XFA_Element::PasswordEdit, XFA_ATTRIBUTE_PasswordChar, |