diff options
Diffstat (limited to 'xfa/fxfa/parser')
37 files changed, 578 insertions, 554 deletions
diff --git a/xfa/fxfa/parser/cxfa_binddata.cpp b/xfa/fxfa/parser/cxfa_binddata.cpp index 19c4c96c87..62146e3419 100644 --- a/xfa/fxfa/parser/cxfa_binddata.cpp +++ b/xfa/fxfa/parser/cxfa_binddata.cpp @@ -14,5 +14,5 @@ WideString CXFA_BindData::GetPicture() { CXFA_Node* pPicture = m_pNode->GetChild(0, XFA_Element::Picture, false); if (!pPicture) return L""; - return pPicture->JSNode()->GetContent(false); + return pPicture->JSObject()->GetContent(false); } diff --git a/xfa/fxfa/parser/cxfa_binditemsdata.cpp b/xfa/fxfa/parser/cxfa_binditemsdata.cpp index 46ee0d5c15..0477d3e5d5 100644 --- a/xfa/fxfa/parser/cxfa_binditemsdata.cpp +++ b/xfa/fxfa/parser/cxfa_binditemsdata.cpp @@ -12,13 +12,13 @@ CXFA_BindItemsData::CXFA_BindItemsData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} WideString CXFA_BindItemsData::GetLabelRef() const { - return m_pNode->JSNode()->GetCData(XFA_Attribute::LabelRef); + return m_pNode->JSObject()->GetCData(XFA_Attribute::LabelRef); } WideString CXFA_BindItemsData::GetValueRef() const { - return m_pNode->JSNode()->GetCData(XFA_Attribute::ValueRef); + return m_pNode->JSObject()->GetCData(XFA_Attribute::ValueRef); } WideString CXFA_BindItemsData::GetRef() const { - return m_pNode->JSNode()->GetCData(XFA_Attribute::Ref); + return m_pNode->JSObject()->GetCData(XFA_Attribute::Ref); } diff --git a/xfa/fxfa/parser/cxfa_boxdata.cpp b/xfa/fxfa/parser/cxfa_boxdata.cpp index b8a82c2b80..8f2674cda0 100644 --- a/xfa/fxfa/parser/cxfa_boxdata.cpp +++ b/xfa/fxfa/parser/cxfa_boxdata.cpp @@ -21,7 +21,7 @@ std::vector<CXFA_StrokeData> GetStrokesInternal(CXFA_Node* pNode, bool bNull) { int32_t i, j; for (i = 0, j = 0; i < 4; i++) { CXFA_CornerData cornerData = CXFA_CornerData( - pNode->JSNode()->GetProperty(i, XFA_Element::Corner, i == 0)); + pNode->JSObject()->GetProperty(i, XFA_Element::Corner, i == 0)); if (cornerData.HasValidNode() || i == 0) { strokes[j] = cornerData; } else if (!bNull) { @@ -32,7 +32,7 @@ std::vector<CXFA_StrokeData> GetStrokesInternal(CXFA_Node* pNode, bool bNull) { } j++; CXFA_EdgeData edgeData = CXFA_EdgeData( - pNode->JSNode()->GetProperty(i, XFA_Element::Edge, i == 0)); + pNode->JSObject()->GetProperty(i, XFA_Element::Edge, i == 0)); if (edgeData.HasValidNode() || i == 0) { strokes[j] = edgeData; } else if (!bNull) { @@ -79,13 +79,13 @@ static XFA_AttributeEnum Style3D(const std::vector<CXFA_StrokeData>& strokes, XFA_AttributeEnum CXFA_BoxData::GetHand() const { if (!m_pNode) return XFA_AttributeEnum::Even; - return m_pNode->JSNode()->GetEnum(XFA_Attribute::Hand); + return m_pNode->JSObject()->GetEnum(XFA_Attribute::Hand); } XFA_AttributeEnum CXFA_BoxData::GetPresence() const { if (!m_pNode) return XFA_AttributeEnum::Hidden; - return m_pNode->JSNode() + return m_pNode->JSObject() ->TryEnum(XFA_Attribute::Presence, true) .value_or(XFA_AttributeEnum::Visible); } @@ -97,7 +97,7 @@ int32_t CXFA_BoxData::CountEdges() const { } CXFA_EdgeData CXFA_BoxData::GetEdgeData(int32_t nIndex) const { - return CXFA_EdgeData(m_pNode ? m_pNode->JSNode()->GetProperty( + return CXFA_EdgeData(m_pNode ? m_pNode->JSObject()->GetProperty( nIndex, XFA_Element::Edge, nIndex == 0) : nullptr); } @@ -109,19 +109,19 @@ std::vector<CXFA_StrokeData> CXFA_BoxData::GetStrokes() const { bool CXFA_BoxData::IsCircular() const { if (!m_pNode) return false; - return m_pNode->JSNode()->GetBoolean(XFA_Attribute::Circular); + return m_pNode->JSObject()->GetBoolean(XFA_Attribute::Circular); } pdfium::Optional<int32_t> CXFA_BoxData::GetStartAngle() const { if (!m_pNode) return {}; - return m_pNode->JSNode()->TryInteger(XFA_Attribute::StartAngle, false); + return m_pNode->JSObject()->TryInteger(XFA_Attribute::StartAngle, false); } pdfium::Optional<int32_t> CXFA_BoxData::GetSweepAngle() const { if (!m_pNode) return {}; - return m_pNode->JSNode()->TryInteger(XFA_Attribute::SweepAngle, false); + return m_pNode->JSObject()->TryInteger(XFA_Attribute::SweepAngle, false); } CXFA_FillData CXFA_BoxData::GetFillData(bool bModified) const { @@ -129,7 +129,7 @@ CXFA_FillData CXFA_BoxData::GetFillData(bool bModified) const { return CXFA_FillData(nullptr); CXFA_Node* pFillNode = - m_pNode->JSNode()->GetProperty(0, XFA_Element::Fill, bModified); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Fill, bModified); return CXFA_FillData(pFillNode); } diff --git a/xfa/fxfa/parser/cxfa_calculatedata.cpp b/xfa/fxfa/parser/cxfa_calculatedata.cpp index c5a2781308..b0feb59fd4 100644 --- a/xfa/fxfa/parser/cxfa_calculatedata.cpp +++ b/xfa/fxfa/parser/cxfa_calculatedata.cpp @@ -13,7 +13,7 @@ CXFA_CalculateData::CXFA_CalculateData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} XFA_AttributeEnum CXFA_CalculateData::GetOverride() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->TryEnum(XFA_Attribute::Override, false) .value_or(XFA_AttributeEnum::Error); } diff --git a/xfa/fxfa/parser/cxfa_captiondata.cpp b/xfa/fxfa/parser/cxfa_captiondata.cpp index af670f14dd..6d9f02b1ab 100644 --- a/xfa/fxfa/parser/cxfa_captiondata.cpp +++ b/xfa/fxfa/parser/cxfa_captiondata.cpp @@ -12,26 +12,26 @@ CXFA_CaptionData::CXFA_CaptionData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} bool CXFA_CaptionData::IsVisible() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->TryEnum(XFA_Attribute::Presence, true) .value_or(XFA_AttributeEnum::Visible) == XFA_AttributeEnum::Visible; } bool CXFA_CaptionData::IsHidden() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->TryEnum(XFA_Attribute::Presence, true) .value_or(XFA_AttributeEnum::Visible) == XFA_AttributeEnum::Hidden; } XFA_AttributeEnum CXFA_CaptionData::GetPlacementType() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->TryEnum(XFA_Attribute::Placement, true) .value_or(XFA_AttributeEnum::Left); } float CXFA_CaptionData::GetReserve() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->GetMeasure(XFA_Attribute::Reserve) .ToUnit(XFA_Unit::Pt); } diff --git a/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp b/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp index 07203caa85..28c0c2eedd 100644 --- a/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp +++ b/xfa/fxfa/parser/cxfa_containerlayoutitem.cpp @@ -31,10 +31,13 @@ CFX_SizeF CXFA_ContainerLayoutItem::GetPageSize() const { if (!pMedium) return size; - size = CFX_SizeF( - pMedium->JSNode()->GetMeasure(XFA_Attribute::Short).ToUnit(XFA_Unit::Pt), - pMedium->JSNode()->GetMeasure(XFA_Attribute::Long).ToUnit(XFA_Unit::Pt)); - if (pMedium->JSNode()->GetEnum(XFA_Attribute::Orientation) == + size = CFX_SizeF(pMedium->JSObject() + ->GetMeasure(XFA_Attribute::Short) + .ToUnit(XFA_Unit::Pt), + pMedium->JSObject() + ->GetMeasure(XFA_Attribute::Long) + .ToUnit(XFA_Unit::Pt)); + if (pMedium->JSObject()->GetEnum(XFA_Attribute::Orientation) == XFA_AttributeEnum::Landscape) { size = CFX_SizeF(size.height, size.width); } diff --git a/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp b/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp index 0c9cab4e2d..cfa5ae5eb9 100644 --- a/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp +++ b/xfa/fxfa/parser/cxfa_contentlayoutitem.cpp @@ -15,6 +15,6 @@ CXFA_ContentLayoutItem::CXFA_ContentLayoutItem(CXFA_Node* pNode) m_dwStatus(0) {} CXFA_ContentLayoutItem::~CXFA_ContentLayoutItem() { - if (m_pFormNode->JSNode()->GetLayoutItem() == this) - m_pFormNode->JSNode()->SetLayoutItem(nullptr); + if (m_pFormNode->JSObject()->GetLayoutItem() == this) + m_pFormNode->JSObject()->SetLayoutItem(nullptr); } diff --git a/xfa/fxfa/parser/cxfa_datadata.cpp b/xfa/fxfa/parser/cxfa_datadata.cpp index 8429dd4e5e..b2c8119639 100644 --- a/xfa/fxfa/parser/cxfa_datadata.cpp +++ b/xfa/fxfa/parser/cxfa_datadata.cpp @@ -72,7 +72,7 @@ XFA_Element CXFA_DataData::GetElementType() const { pdfium::Optional<float> CXFA_DataData::TryMeasureAsFloat( XFA_Attribute attr) const { pdfium::Optional<CXFA_Measurement> measure = - m_pNode->JSNode()->TryMeasure(attr, false); + m_pNode->JSObject()->TryMeasure(attr, false); if (measure) return {measure->ToUnit(XFA_Unit::Pt)}; return {}; diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp index 8e0d25d3a4..e418c839c6 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -162,12 +162,12 @@ CXFA_Object* CXFA_Document::GetXFAObject(XFA_HashCode dwNodeNameHash) { continue; pdfium::Optional<WideString> namespaceURI = - pDatasetsChild->JSNode()->TryNamespace(); + pDatasetsChild->JSObject()->TryNamespace(); if (!namespaceURI) continue; pdfium::Optional<WideString> datasetsURI = - pDatasetsNode->JSNode()->TryNamespace(); + pDatasetsNode->JSObject()->TryNamespace(); if (!datasetsURI) continue; if (*namespaceURI == *datasetsURI) @@ -265,7 +265,7 @@ bool CXFA_Document::IsInteractive() { if (pFormFiller) { m_dwDocFlags |= XFA_DOCFLAG_HasInteractive; - WideString wsInteractive = pFormFiller->JSNode()->GetContent(false); + WideString wsInteractive = pFormFiller->JSObject()->GetContent(false); if (wsInteractive == L"1") { m_dwDocFlags |= XFA_DOCFLAG_Interactive; return true; @@ -331,7 +331,7 @@ CXFA_Node* CXFA_Document::GetNodeByID(CXFA_Node* pRoot, CXFA_NodeIterator sIterator(pRoot); for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; pNode = sIterator.MoveToNext()) { - WideString wsIDVal = pNode->JSNode()->GetCData(XFA_Attribute::Id); + WideString wsIDVal = pNode->JSObject()->GetCData(XFA_Attribute::Id); if (!wsIDVal.IsEmpty() && wsIDVal == wsID) return pNode; } @@ -348,15 +348,15 @@ void CXFA_Document::DoProtoMerge() { CXFA_NodeIterator sIterator(pTemplateRoot); for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; pNode = sIterator.MoveToNext()) { - WideString wsIDVal = pNode->JSNode()->GetCData(XFA_Attribute::Id); + WideString wsIDVal = pNode->JSObject()->GetCData(XFA_Attribute::Id); if (!wsIDVal.IsEmpty()) mIDMap[FX_HashCode_GetW(wsIDVal.AsStringView(), false)] = pNode; - WideString wsUseVal = pNode->JSNode()->GetCData(XFA_Attribute::Use); + WideString wsUseVal = pNode->JSObject()->GetCData(XFA_Attribute::Use); if (!wsUseVal.IsEmpty()) { sUseNodes.insert(pNode); } else { - wsUseVal = pNode->JSNode()->GetCData(XFA_Attribute::Usehref); + wsUseVal = pNode->JSObject()->GetCData(XFA_Attribute::Usehref); if (!wsUseVal.IsEmpty()) sUseNodes.insert(pNode); } @@ -368,7 +368,7 @@ void CXFA_Document::DoProtoMerge() { WideStringView wsSOM; WideString wsUseVal = - pUseHrefNode->JSNode()->GetCData(XFA_Attribute::Usehref); + pUseHrefNode->JSObject()->GetCData(XFA_Attribute::Usehref); if (!wsUseVal.IsEmpty()) { auto uSharpPos = wsUseVal.Find('#'); if (!uSharpPos.has_value()) { @@ -388,7 +388,7 @@ void CXFA_Document::DoProtoMerge() { } } } else { - wsUseVal = pUseHrefNode->JSNode()->GetCData(XFA_Attribute::Use); + wsUseVal = pUseHrefNode->JSObject()->GetCData(XFA_Attribute::Use); if (!wsUseVal.IsEmpty()) { if (wsUseVal[0] == '#') wsID = WideStringView(wsUseVal.c_str() + 1, wsUseVal.GetLength() - 1); diff --git a/xfa/fxfa/parser/cxfa_eventdata.cpp b/xfa/fxfa/parser/cxfa_eventdata.cpp index 1af838974b..0250346d85 100644 --- a/xfa/fxfa/parser/cxfa_eventdata.cpp +++ b/xfa/fxfa/parser/cxfa_eventdata.cpp @@ -11,7 +11,7 @@ CXFA_EventData::CXFA_EventData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} XFA_AttributeEnum CXFA_EventData::GetActivity() { - return m_pNode->JSNode()->GetEnum(XFA_Attribute::Activity); + return m_pNode->JSObject()->GetEnum(XFA_Attribute::Activity); } XFA_Element CXFA_EventData::GetEventType() const { @@ -27,7 +27,7 @@ XFA_Element CXFA_EventData::GetEventType() const { } WideString CXFA_EventData::GetRef() const { - return m_pNode->JSNode()->GetCData(XFA_Attribute::Ref); + return m_pNode->JSObject()->GetCData(XFA_Attribute::Ref); } CXFA_ScriptData CXFA_EventData::GetScriptData() const { diff --git a/xfa/fxfa/parser/cxfa_exdatadata.cpp b/xfa/fxfa/parser/cxfa_exdatadata.cpp index 7508ba8584..41a1b03ec0 100644 --- a/xfa/fxfa/parser/cxfa_exdatadata.cpp +++ b/xfa/fxfa/parser/cxfa_exdatadata.cpp @@ -11,6 +11,6 @@ CXFA_ExDataData::CXFA_ExDataData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} void CXFA_ExDataData::SetContentType(const WideString& wsContentType) { - m_pNode->JSNode()->SetCData(XFA_Attribute::ContentType, wsContentType, false, - false); + m_pNode->JSObject()->SetCData(XFA_Attribute::ContentType, wsContentType, + false, false); } diff --git a/xfa/fxfa/parser/cxfa_filldata.cpp b/xfa/fxfa/parser/cxfa_filldata.cpp index b4ca99735f..2ea7652784 100644 --- a/xfa/fxfa/parser/cxfa_filldata.cpp +++ b/xfa/fxfa/parser/cxfa_filldata.cpp @@ -13,7 +13,7 @@ CXFA_FillData::CXFA_FillData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} CXFA_FillData::~CXFA_FillData() {} bool CXFA_FillData::IsVisible() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->TryEnum(XFA_Attribute::Presence, true) .value_or(XFA_AttributeEnum::Visible) == XFA_AttributeEnum::Visible; @@ -21,21 +21,21 @@ bool CXFA_FillData::IsVisible() const { void CXFA_FillData::SetColor(FX_ARGB color) { CXFA_Node* pNode = - m_pNode->JSNode()->GetProperty(0, XFA_Element::Color, true); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Color, true); int a; int r; int g; int b; std::tie(a, r, g, b) = ArgbDecode(color); - pNode->JSNode()->SetCData(XFA_Attribute::Value, - WideString::Format(L"%d,%d,%d", r, g, b), false, - false); + pNode->JSObject()->SetCData(XFA_Attribute::Value, + WideString::Format(L"%d,%d,%d", r, g, b), false, + false); } FX_ARGB CXFA_FillData::GetColor(bool bText) const { if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Color, false)) { pdfium::Optional<WideString> wsColor = - pNode->JSNode()->TryCData(XFA_Attribute::Value, false); + pNode->JSObject()->TryCData(XFA_Attribute::Value, false); if (wsColor) return CXFA_DataData::ToColor(wsColor->AsStringView()); } @@ -57,14 +57,14 @@ XFA_Element CXFA_FillData::GetFillType() const { } XFA_AttributeEnum CXFA_FillData::GetPatternType() const { - return GetPattern()->JSNode()->GetEnum(XFA_Attribute::Type); + return GetPattern()->JSObject()->GetEnum(XFA_Attribute::Type); } FX_ARGB CXFA_FillData::GetPatternColor() const { if (CXFA_Node* pColor = GetPattern()->GetChild(0, XFA_Element::Color, false)) { pdfium::Optional<WideString> wsColor = - pColor->JSNode()->TryCData(XFA_Attribute::Value, false); + pColor->JSObject()->TryCData(XFA_Attribute::Value, false); if (wsColor) return CXFA_DataData::ToColor(wsColor->AsStringView()); } @@ -73,7 +73,7 @@ FX_ARGB CXFA_FillData::GetPatternColor() const { int32_t CXFA_FillData::GetStippleRate() const { return GetStipple() - ->JSNode() + ->JSObject() ->TryInteger(XFA_Attribute::Rate, true) .value_or(50); } @@ -82,7 +82,7 @@ FX_ARGB CXFA_FillData::GetStippleColor() const { if (CXFA_Node* pColor = GetStipple()->GetChild(0, XFA_Element::Color, false)) { pdfium::Optional<WideString> wsColor = - pColor->JSNode()->TryCData(XFA_Attribute::Value, false); + pColor->JSObject()->TryCData(XFA_Attribute::Value, false); if (wsColor) return CXFA_DataData::ToColor(wsColor->AsStringView()); } @@ -91,7 +91,7 @@ FX_ARGB CXFA_FillData::GetStippleColor() const { XFA_AttributeEnum CXFA_FillData::GetLinearType() const { return GetLinear() - ->JSNode() + ->JSObject() ->TryEnum(XFA_Attribute::Type, true) .value_or(XFA_AttributeEnum::ToRight); } @@ -99,7 +99,7 @@ XFA_AttributeEnum CXFA_FillData::GetLinearType() const { FX_ARGB CXFA_FillData::GetLinearColor() const { if (CXFA_Node* pColor = GetLinear()->GetChild(0, XFA_Element::Color, false)) { pdfium::Optional<WideString> wsColor = - pColor->JSNode()->TryCData(XFA_Attribute::Value, false); + pColor->JSObject()->TryCData(XFA_Attribute::Value, false); if (wsColor) return CXFA_DataData::ToColor(wsColor->AsStringView()); } @@ -108,7 +108,7 @@ FX_ARGB CXFA_FillData::GetLinearColor() const { bool CXFA_FillData::IsRadialToEdge() const { return GetRadial() - ->JSNode() + ->JSObject() ->TryEnum(XFA_Attribute::Type, true) .value_or(XFA_AttributeEnum::ToEdge) == XFA_AttributeEnum::ToEdge; } @@ -116,7 +116,7 @@ bool CXFA_FillData::IsRadialToEdge() const { FX_ARGB CXFA_FillData::GetRadialColor() const { if (CXFA_Node* pColor = GetRadial()->GetChild(0, XFA_Element::Color, false)) { pdfium::Optional<WideString> wsColor = - pColor->JSNode()->TryCData(XFA_Attribute::Value, false); + pColor->JSObject()->TryCData(XFA_Attribute::Value, false); if (wsColor) return CXFA_DataData::ToColor(wsColor->AsStringView()); } @@ -124,17 +124,17 @@ FX_ARGB CXFA_FillData::GetRadialColor() const { } CXFA_Node* CXFA_FillData::GetStipple() const { - return m_pNode->JSNode()->GetProperty(0, XFA_Element::Stipple, true); + return m_pNode->JSObject()->GetProperty(0, XFA_Element::Stipple, true); } CXFA_Node* CXFA_FillData::GetRadial() const { - return m_pNode->JSNode()->GetProperty(0, XFA_Element::Radial, true); + return m_pNode->JSObject()->GetProperty(0, XFA_Element::Radial, true); } CXFA_Node* CXFA_FillData::GetLinear() const { - return m_pNode->JSNode()->GetProperty(0, XFA_Element::Linear, true); + return m_pNode->JSObject()->GetProperty(0, XFA_Element::Linear, true); } CXFA_Node* CXFA_FillData::GetPattern() const { - return m_pNode->JSNode()->GetProperty(0, XFA_Element::Pattern, true); + return m_pNode->JSObject()->GetProperty(0, XFA_Element::Pattern, true); } diff --git a/xfa/fxfa/parser/cxfa_fontdata.cpp b/xfa/fxfa/parser/cxfa_fontdata.cpp index 7eda807c1c..c2b4a79fea 100644 --- a/xfa/fxfa/parser/cxfa_fontdata.cpp +++ b/xfa/fxfa/parser/cxfa_fontdata.cpp @@ -14,28 +14,28 @@ CXFA_FontData::CXFA_FontData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} float CXFA_FontData::GetBaselineShift() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->GetMeasure(XFA_Attribute::BaselineShift) .ToUnit(XFA_Unit::Pt); } float CXFA_FontData::GetHorizontalScale() const { WideString wsValue = - m_pNode->JSNode()->GetCData(XFA_Attribute::FontHorizontalScale); + m_pNode->JSObject()->GetCData(XFA_Attribute::FontHorizontalScale); int32_t iScale = FXSYS_wtoi(wsValue.c_str()); return iScale > 0 ? (float)iScale : 100.0f; } float CXFA_FontData::GetVerticalScale() const { WideString wsValue = - m_pNode->JSNode()->GetCData(XFA_Attribute::FontVerticalScale); + m_pNode->JSObject()->GetCData(XFA_Attribute::FontVerticalScale); int32_t iScale = FXSYS_wtoi(wsValue.c_str()); return iScale > 0 ? (float)iScale : 100.0f; } float CXFA_FontData::GetLetterSpacing() const { WideString wsValue = - m_pNode->JSNode()->GetCData(XFA_Attribute::LetterSpacing); + m_pNode->JSObject()->GetCData(XFA_Attribute::LetterSpacing); CXFA_Measurement ms(wsValue.AsStringView()); if (ms.GetUnit() == XFA_Unit::Em) return ms.GetValue() * GetFontSize(); @@ -43,41 +43,41 @@ float CXFA_FontData::GetLetterSpacing() const { } int32_t CXFA_FontData::GetLineThrough() const { - return m_pNode->JSNode()->GetInteger(XFA_Attribute::LineThrough); + return m_pNode->JSObject()->GetInteger(XFA_Attribute::LineThrough); } int32_t CXFA_FontData::GetUnderline() const { - return m_pNode->JSNode()->GetInteger(XFA_Attribute::Underline); + return m_pNode->JSObject()->GetInteger(XFA_Attribute::Underline); } XFA_AttributeEnum CXFA_FontData::GetUnderlinePeriod() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->TryEnum(XFA_Attribute::UnderlinePeriod, true) .value_or(XFA_AttributeEnum::All); } float CXFA_FontData::GetFontSize() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->GetMeasure(XFA_Attribute::Size) .ToUnit(XFA_Unit::Pt); } WideString CXFA_FontData::GetTypeface() const { - return m_pNode->JSNode()->GetCData(XFA_Attribute::Typeface); + return m_pNode->JSObject()->GetCData(XFA_Attribute::Typeface); } bool CXFA_FontData::IsBold() const { - return m_pNode->JSNode()->GetEnum(XFA_Attribute::Weight) == + return m_pNode->JSObject()->GetEnum(XFA_Attribute::Weight) == XFA_AttributeEnum::Bold; } bool CXFA_FontData::IsItalic() const { - return m_pNode->JSNode()->GetEnum(XFA_Attribute::Posture) == + return m_pNode->JSObject()->GetEnum(XFA_Attribute::Posture) == XFA_AttributeEnum::Italic; } void CXFA_FontData::SetColor(FX_ARGB color) { - CXFA_FillData(m_pNode->JSNode()->GetProperty(0, XFA_Element::Fill, true)) + CXFA_FillData(m_pNode->JSObject()->GetProperty(0, XFA_Element::Fill, true)) .SetColor(color); } diff --git a/xfa/fxfa/parser/cxfa_imagedata.cpp b/xfa/fxfa/parser/cxfa_imagedata.cpp index ebd4a8adf5..cacbf9558d 100644 --- a/xfa/fxfa/parser/cxfa_imagedata.cpp +++ b/xfa/fxfa/parser/cxfa_imagedata.cpp @@ -11,38 +11,38 @@ CXFA_ImageData::CXFA_ImageData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} XFA_AttributeEnum CXFA_ImageData::GetAspect() const { - return m_pNode->JSNode()->GetEnum(XFA_Attribute::Aspect); + return m_pNode->JSObject()->GetEnum(XFA_Attribute::Aspect); } WideString CXFA_ImageData::GetContentType() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->TryCData(XFA_Attribute::ContentType, true) .value_or(L""); } WideString CXFA_ImageData::GetHref() const { - return m_pNode->JSNode()->TryCData(XFA_Attribute::Href, true).value_or(L""); + return m_pNode->JSObject()->TryCData(XFA_Attribute::Href, true).value_or(L""); } XFA_AttributeEnum CXFA_ImageData::GetTransferEncoding() const { return static_cast<XFA_AttributeEnum>( - m_pNode->JSNode()->GetEnum(XFA_Attribute::TransferEncoding)); + m_pNode->JSObject()->GetEnum(XFA_Attribute::TransferEncoding)); } WideString CXFA_ImageData::GetContent() const { - return m_pNode->JSNode()->TryContent(false, true).value_or(L""); + return m_pNode->JSObject()->TryContent(false, true).value_or(L""); } void CXFA_ImageData::SetContentType(const WideString& wsContentType) { - m_pNode->JSNode()->SetCData(XFA_Attribute::ContentType, wsContentType, false, - false); + m_pNode->JSObject()->SetCData(XFA_Attribute::ContentType, wsContentType, + false, false); } void CXFA_ImageData::SetHref(const WideString& wsHref) { - m_pNode->JSNode()->SetCData(XFA_Attribute::Href, wsHref, false, false); + m_pNode->JSObject()->SetCData(XFA_Attribute::Href, wsHref, false, false); } void CXFA_ImageData::SetTransferEncoding(XFA_AttributeEnum iTransferEncoding) { - m_pNode->JSNode()->SetEnum(XFA_Attribute::TransferEncoding, iTransferEncoding, - false); + m_pNode->JSObject()->SetEnum(XFA_Attribute::TransferEncoding, + iTransferEncoding, false); } diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp index 725eb535d4..a52821b218 100644 --- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp @@ -90,14 +90,14 @@ CFX_SizeF CalculateContainerSpecifiedSize(CXFA_Node* pFormNode, CFX_SizeF containerSize; if (eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup) { pdfium::Optional<CXFA_Measurement> wValue = - pFormNode->JSNode()->TryMeasure(XFA_Attribute::W, false); + pFormNode->JSObject()->TryMeasure(XFA_Attribute::W, false); if (wValue && wValue->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { containerSize.width = wValue->ToUnit(XFA_Unit::Pt); *bContainerWidthAutoSize = false; } pdfium::Optional<CXFA_Measurement> hValue = - pFormNode->JSNode()->TryMeasure(XFA_Attribute::H, false); + pFormNode->JSObject()->TryMeasure(XFA_Attribute::H, false); if (hValue && hValue->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { containerSize.height = hValue->ToUnit(XFA_Unit::Pt); *bContainerHeightAutoSize = false; @@ -106,14 +106,14 @@ CFX_SizeF CalculateContainerSpecifiedSize(CXFA_Node* pFormNode, if (*bContainerWidthAutoSize && eType == XFA_Element::Subform) { pdfium::Optional<CXFA_Measurement> maxW = - pFormNode->JSNode()->TryMeasure(XFA_Attribute::MaxW, false); + pFormNode->JSObject()->TryMeasure(XFA_Attribute::MaxW, false); if (maxW && maxW->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { containerSize.width = maxW->ToUnit(XFA_Unit::Pt); *bContainerWidthAutoSize = false; } pdfium::Optional<CXFA_Measurement> maxH = - pFormNode->JSNode()->TryMeasure(XFA_Attribute::MaxH, false); + pFormNode->JSObject()->TryMeasure(XFA_Attribute::MaxH, false); if (maxH && maxH->GetValue() > XFA_LAYOUT_FLOAT_PERCISION) { containerSize.height = maxH->ToUnit(XFA_Unit::Pt); *bContainerHeightAutoSize = false; @@ -135,12 +135,12 @@ CFX_SizeF CalculateContainerComponentSizeFromContentSize( componentSize.width = fContentCalculatedWidth; if (pMarginNode) { pdfium::Optional<CXFA_Measurement> leftInset = - pMarginNode->JSNode()->TryMeasure(XFA_Attribute::LeftInset, false); + pMarginNode->JSObject()->TryMeasure(XFA_Attribute::LeftInset, false); if (leftInset) componentSize.width += leftInset->ToUnit(XFA_Unit::Pt); pdfium::Optional<CXFA_Measurement> rightInset = - pMarginNode->JSNode()->TryMeasure(XFA_Attribute::RightInset, false); + pMarginNode->JSObject()->TryMeasure(XFA_Attribute::RightInset, false); if (rightInset) componentSize.width += rightInset->ToUnit(XFA_Unit::Pt); } @@ -150,12 +150,13 @@ CFX_SizeF CalculateContainerComponentSizeFromContentSize( componentSize.height = fContentCalculatedHeight; if (pMarginNode) { pdfium::Optional<CXFA_Measurement> topInset = - pMarginNode->JSNode()->TryMeasure(XFA_Attribute::TopInset, false); + pMarginNode->JSObject()->TryMeasure(XFA_Attribute::TopInset, false); if (topInset) componentSize.height += topInset->ToUnit(XFA_Unit::Pt); pdfium::Optional<CXFA_Measurement> bottomInset = - pMarginNode->JSNode()->TryMeasure(XFA_Attribute::BottomInset, false); + pMarginNode->JSObject()->TryMeasure(XFA_Attribute::BottomInset, + false); if (bottomInset) componentSize.height += bottomInset->ToUnit(XFA_Unit::Pt); } @@ -178,16 +179,16 @@ void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow, float fRightInset = 0; float fBottomInset = 0; if (pMarginNode) { - fLeftInset = pMarginNode->JSNode() + fLeftInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::LeftInset) .ToUnit(XFA_Unit::Pt); - fTopInset = pMarginNode->JSNode() + fTopInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::TopInset) .ToUnit(XFA_Unit::Pt); - fRightInset = pMarginNode->JSNode() + fRightInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::RightInset) .ToUnit(XFA_Unit::Pt); - fBottomInset = pMarginNode->JSNode() + fBottomInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::BottomInset) .ToUnit(XFA_Unit::Pt); } @@ -208,7 +209,8 @@ void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow, pLayoutChild; pLayoutChild = static_cast<CXFA_ContentLayoutItem*>( pLayoutChild->m_pNextSibling)) { int32_t nOriginalColSpan = - pLayoutChild->m_pFormNode->JSNode()->GetInteger(XFA_Attribute::ColSpan); + pLayoutChild->m_pFormNode->JSObject()->GetInteger( + XFA_Attribute::ColSpan); int32_t nColSpan = nOriginalColSpan; float fColSpanWidth = 0; if (nColSpan == -1 || @@ -258,7 +260,7 @@ void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow, if (pParaNode && pLayoutChild->m_pFirstChild) { float fOffHeight = fContentCalculatedHeight - fOldChildHeight; XFA_AttributeEnum eVType = - pParaNode->JSNode()->GetEnum(XFA_Attribute::VAlign); + pParaNode->JSObject()->GetEnum(XFA_Attribute::VAlign); switch (eVType) { case XFA_AttributeEnum::Middle: fOffHeight = fOffHeight / 2; @@ -295,7 +297,7 @@ void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow, fContentCalculatedWidth = containerSize.width - fLeftInset - fRightInset; } - if (pLayoutRow->m_pFormNode->JSNode()->GetEnum(XFA_Attribute::Layout) == + if (pLayoutRow->m_pFormNode->JSObject()->GetEnum(XFA_Attribute::Layout) == XFA_AttributeEnum::Rl_row) { for (CXFA_ContentLayoutItem* pLayoutChild = (CXFA_ContentLayoutItem*)pLayoutRow->m_pFirstChild; @@ -314,7 +316,7 @@ void RelocateTableRowCells(CXFA_ContentLayoutItem* pLayoutRow, void UpdatePendingItemLayout(CXFA_ItemLayoutProcessor* pProcessor, CXFA_ContentLayoutItem* pLayoutItem) { XFA_AttributeEnum eLayout = - pLayoutItem->m_pFormNode->JSNode()->GetEnum(XFA_Attribute::Layout); + pLayoutItem->m_pFormNode->JSObject()->GetEnum(XFA_Attribute::Layout); switch (eLayout) { case XFA_AttributeEnum::Row: case XFA_AttributeEnum::Rl_row: @@ -351,16 +353,16 @@ void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor, float fRightInset = 0; float fBottomInset = 0; if (pMarginNode) { - fLeftInset = pMarginNode->JSNode() + fLeftInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::LeftInset) .ToUnit(XFA_Unit::Pt); - fTopInset = pMarginNode->JSNode() + fTopInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::TopInset) .ToUnit(XFA_Unit::Pt); - fRightInset = pMarginNode->JSNode() + fRightInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::RightInset) .ToUnit(XFA_Unit::Pt); - fBottomInset = pMarginNode->JSNode() + fBottomInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::BottomInset) .ToUnit(XFA_Unit::Pt); } @@ -385,7 +387,7 @@ void AddTrailerBeforeSplit(CXFA_ItemLayoutProcessor* pProcessor, pTrailerLayoutItem->m_sPos.y = fSplitPos - fTopInset - fBottomInset; } - switch (pTrailerLayoutItem->m_pFormNode->JSNode()->GetEnum( + switch (pTrailerLayoutItem->m_pFormNode->JSObject()->GetEnum( XFA_Attribute::HAlign)) { case XFA_AttributeEnum::Right: pTrailerLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.width - @@ -416,10 +418,10 @@ void AddLeaderAfterSplit(CXFA_ItemLayoutProcessor* pProcessor, float fLeftInset = 0; float fRightInset = 0; if (pMarginNode) { - fLeftInset = pMarginNode->JSNode() + fLeftInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::LeftInset) .ToUnit(XFA_Unit::Pt); - fRightInset = pMarginNode->JSNode() + fRightInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::RightInset) .ToUnit(XFA_Unit::Pt); } @@ -433,7 +435,7 @@ void AddLeaderAfterSplit(CXFA_ItemLayoutProcessor* pProcessor, } pLeaderLayoutItem->m_sPos.y = 0; - switch (pLeaderLayoutItem->m_pFormNode->JSNode()->GetEnum( + switch (pLeaderLayoutItem->m_pFormNode->JSObject()->GetEnum( XFA_Attribute::HAlign)) { case XFA_AttributeEnum::Right: pLeaderLayoutItem->m_sPos.x = pProcessor->m_pLayoutItem->m_sSize.width - @@ -495,7 +497,7 @@ float InsertPendingItems(CXFA_ItemLayoutProcessor* pProcessor, XFA_AttributeEnum GetLayout(CXFA_Node* pFormNode, bool* bRootForceTb) { *bRootForceTb = false; pdfium::Optional<XFA_AttributeEnum> layoutMode = - pFormNode->JSNode()->TryEnum(XFA_Attribute::Layout, false); + pFormNode->JSObject()->TryEnum(XFA_Attribute::Layout, false); if (layoutMode) return *layoutMode; @@ -527,7 +529,7 @@ bool ExistContainerKeep(CXFA_Node* pCurNode, bool bPreFind) { eKeepType = XFA_Attribute::Next; pdfium::Optional<XFA_AttributeEnum> previous = - pKeep->JSNode()->TryEnum(eKeepType, false); + pKeep->JSObject()->TryEnum(eKeepType, false); if (previous) { if (*previous == XFA_AttributeEnum::ContentArea || *previous == XFA_AttributeEnum::PageArea) { @@ -545,7 +547,7 @@ bool ExistContainerKeep(CXFA_Node* pCurNode, bool bPreFind) { eKeepType = XFA_Attribute::Previous; pdfium::Optional<XFA_AttributeEnum> next = - pKeep->JSNode()->TryEnum(eKeepType, false); + pKeep->JSObject()->TryEnum(eKeepType, false); if (!next) return false; if (*next == XFA_AttributeEnum::ContentArea || @@ -584,7 +586,7 @@ bool FindBreakNode(CXFA_Node* pContainerNode, break; } case XFA_Element::Break: - if (pBreakNode->JSNode()->GetEnum(eAttributeType) != + if (pBreakNode->JSObject()->GetEnum(eAttributeType) != XFA_AttributeEnum::Auto) { pCurActionNode = pBreakNode; *nCurStage = XFA_ItemLayoutProcessorStages::BreakBefore; @@ -612,7 +614,8 @@ void DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) { for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode; pNode = sIterator.MoveToNext()) { CXFA_ContentLayoutItem* pCurLayoutItem = - static_cast<CXFA_ContentLayoutItem*>(pNode->JSNode()->GetLayoutItem()); + static_cast<CXFA_ContentLayoutItem*>( + pNode->JSObject()->GetLayoutItem()); CXFA_ContentLayoutItem* pNextLayoutItem = nullptr; while (pCurLayoutItem) { pNextLayoutItem = pCurLayoutItem->m_pNext; @@ -660,7 +663,7 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( bool bTakeSpace = XFA_ItemLayoutProcessor_IsTakingSpace(pProcessor->m_pFormNode); uint8_t uHAlign = HAlignEnumToInt( - pThis->m_pCurChildNode->JSNode()->GetEnum(XFA_Attribute::HAlign)); + pThis->m_pCurChildNode->JSObject()->GetEnum(XFA_Attribute::HAlign)); if (bContainerWidthAutoSize) uHAlign = 0; @@ -848,7 +851,7 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( float fSplitPos = pProcessor->FindSplitPos(fAvailHeight - *fContentCurRowY); if (fSplitPos > XFA_LAYOUT_FLOAT_PERCISION) { XFA_AttributeEnum eLayout = - pProcessor->m_pFormNode->JSNode()->GetEnum(XFA_Attribute::Layout); + pProcessor->m_pFormNode->JSObject()->GetEnum(XFA_Attribute::Layout); if (eLayout == XFA_AttributeEnum::Tb && eRetValue == XFA_ItemLayoutProcessorResult::Done) { pProcessor->ProcessUnUseOverFlow(pOverflowLeaderNode, @@ -943,7 +946,7 @@ XFA_ItemLayoutProcessorResult InsertFlowedItem( } XFA_AttributeEnum eLayout = - pProcessor->m_pFormNode->JSNode()->GetEnum(XFA_Attribute::Layout); + pProcessor->m_pFormNode->JSObject()->GetEnum(XFA_Attribute::Layout); if (pProcessor->m_pFormNode->GetIntact() == XFA_AttributeEnum::None && eLayout == XFA_AttributeEnum::Tb) { if (pThis->m_pPageMgr) { @@ -996,10 +999,10 @@ bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem, CXFA_Node* pMarginNode = pFormNode->GetFirstChildByClass(XFA_Element::Margin); if (pMarginNode && bCalculateMargin) { - fCurTopMargin = pMarginNode->JSNode() + fCurTopMargin = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::TopInset) .ToUnit(XFA_Unit::Pt); - fCurBottomMargin = pMarginNode->JSNode() + fCurBottomMargin = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::BottomInset) .ToUnit(XFA_Unit::Pt); } @@ -1062,7 +1065,7 @@ bool FindLayoutItemSplitPos(CXFA_ContentLayoutItem* pLayoutItem, CFX_PointF CalculatePositionedContainerPos(CXFA_Node* pNode, const CFX_SizeF& size) { XFA_AttributeEnum eAnchorType = - pNode->JSNode()->GetEnum(XFA_Attribute::AnchorType); + pNode->JSObject()->GetEnum(XFA_Attribute::AnchorType); int32_t nAnchorType = 0; switch (eAnchorType) { case XFA_AttributeEnum::TopLeft: @@ -1101,10 +1104,11 @@ CFX_PointF CalculatePositionedContainerPos(CXFA_Node* pNode, {2, 5, 8, 1, 4, 7, 0, 3, 6}}; CFX_PointF pos( - pNode->JSNode()->GetMeasure(XFA_Attribute::X).ToUnit(XFA_Unit::Pt), - pNode->JSNode()->GetMeasure(XFA_Attribute::Y).ToUnit(XFA_Unit::Pt)); + pNode->JSObject()->GetMeasure(XFA_Attribute::X).ToUnit(XFA_Unit::Pt), + pNode->JSObject()->GetMeasure(XFA_Attribute::Y).ToUnit(XFA_Unit::Pt)); int32_t nRotate = - XFA_MapRotation(pNode->JSNode()->GetInteger(XFA_Attribute::Rotate)) / 90; + XFA_MapRotation(pNode->JSObject()->GetInteger(XFA_Attribute::Rotate)) / + 90; int32_t nAbsoluteAnchorType = nNextPos[nRotate][nAnchorType]; switch (nAbsoluteAnchorType / 3) { case 1: @@ -1155,7 +1159,7 @@ CXFA_ItemLayoutProcessor::CXFA_ItemLayoutProcessor(CXFA_Node* pNode, ASSERT(m_pFormNode && (m_pFormNode->IsContainerNode() || m_pFormNode->GetElementType() == XFA_Element::Form)); m_pOldLayoutItem = static_cast<CXFA_ContentLayoutItem*>( - m_pFormNode->JSNode()->GetLayoutItem()); + m_pFormNode->JSObject()->GetLayoutItem()); } CXFA_ItemLayoutProcessor::~CXFA_ItemLayoutProcessor() {} @@ -1176,7 +1180,7 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( ->OnCreateLayoutItem(pFormNode); CXFA_ContentLayoutItem* pPrevLayoutItem = static_cast<CXFA_ContentLayoutItem*>( - pFormNode->JSNode()->GetLayoutItem()); + pFormNode->JSObject()->GetLayoutItem()); if (pPrevLayoutItem) { while (pPrevLayoutItem->m_pNext) pPrevLayoutItem = pPrevLayoutItem->m_pNext; @@ -1184,14 +1188,14 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::CreateContentLayoutItem( pPrevLayoutItem->m_pNext = pLayoutItem; pLayoutItem->m_pPrev = pPrevLayoutItem; } else { - pFormNode->JSNode()->SetLayoutItem(pLayoutItem); + pFormNode->JSObject()->SetLayoutItem(pLayoutItem); } return pLayoutItem; } float CXFA_ItemLayoutProcessor::FindSplitPos(float fProposedSplitPos) { ASSERT(m_pLayoutItem); - XFA_AttributeEnum eLayout = m_pFormNode->JSNode() + XFA_AttributeEnum eLayout = m_pFormNode->JSObject() ->TryEnum(XFA_Attribute::Layout, true) .value_or(XFA_AttributeEnum::Position); bool bCalculateMargin = eLayout != XFA_AttributeEnum::Position; @@ -1210,7 +1214,7 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( CXFA_ContentLayoutItem* pSecondParent, float fSplitPos) { float fCurTopMargin = 0, fCurBottomMargin = 0; - XFA_AttributeEnum eLayout = m_pFormNode->JSNode() + XFA_AttributeEnum eLayout = m_pFormNode->JSObject() ->TryEnum(XFA_Attribute::Layout, true) .value_or(XFA_AttributeEnum::Position); bool bCalculateMargin = true; @@ -1220,10 +1224,10 @@ void CXFA_ItemLayoutProcessor::SplitLayoutItem( CXFA_Node* pMarginNode = pLayoutItem->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); if (pMarginNode && bCalculateMargin) { - fCurTopMargin = pMarginNode->JSNode() + fCurTopMargin = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::TopInset) .ToUnit(XFA_Unit::Pt); - fCurBottomMargin = pMarginNode->JSNode() + fCurBottomMargin = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::BottomInset) .ToUnit(XFA_Unit::Pt); } @@ -1584,7 +1588,7 @@ bool CXFA_ItemLayoutProcessor::ProcessKeepNodesForBreakBefore( } bool XFA_ItemLayoutProcessor_IsTakingSpace(CXFA_Node* pNode) { - XFA_AttributeEnum ePresence = pNode->JSNode() + XFA_AttributeEnum ePresence = pNode->JSObject() ->TryEnum(XFA_Attribute::Presence, true) .value_or(XFA_AttributeEnum::Visible); return ePresence == XFA_AttributeEnum::Visible || @@ -1660,7 +1664,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( return; m_pLayoutItem = CreateContentLayoutItem(m_pFormNode); - bool bIgnoreXY = (m_pFormNode->JSNode() + bool bIgnoreXY = (m_pFormNode->JSObject() ->TryEnum(XFA_Attribute::Layout, true) .value_or(XFA_AttributeEnum::Position) != XFA_AttributeEnum::Position); @@ -1690,7 +1694,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutPositionedContainer( m_pCurChildNode, m_pPageMgr); if (pContext && pContext->m_prgSpecifiedColumnWidths) { int32_t iColSpan = - m_pCurChildNode->JSNode()->GetInteger(XFA_Attribute::ColSpan); + m_pCurChildNode->JSObject()->GetInteger(XFA_Attribute::ColSpan); if (iColSpan <= pdfium::CollectionSize<int32_t>( *pContext->m_prgSpecifiedColumnWidths) - iColIndex) { @@ -1785,10 +1789,10 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { float fLeftInset = 0; float fRightInset = 0; if (pMarginNode) { - fLeftInset = pMarginNode->JSNode() + fLeftInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::LeftInset) .ToUnit(XFA_Unit::Pt); - fRightInset = pMarginNode->JSNode() + fRightInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::RightInset) .ToUnit(XFA_Unit::Pt); } @@ -1797,7 +1801,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { bContainerWidthAutoSize ? FLT_MAX : containerSize.width - fLeftInset - fRightInset; WideString wsColumnWidths = - pLayoutNode->JSNode()->GetCData(XFA_Attribute::ColumnWidths); + pLayoutNode->JSObject()->GetCData(XFA_Attribute::ColumnWidths); if (!wsColumnWidths.IsEmpty()) { auto widths = SeparateStringW(wsColumnWidths.c_str(), wsColumnWidths.GetLength(), L' '); @@ -1854,7 +1858,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { continue; XFA_AttributeEnum eLayout = - pLayoutChild->m_pFormNode->JSNode()->GetEnum(XFA_Attribute::Layout); + pLayoutChild->m_pFormNode->JSObject()->GetEnum(XFA_Attribute::Layout); if (eLayout != XFA_AttributeEnum::Row && eLayout != XFA_AttributeEnum::Rl_row) { continue; @@ -1862,7 +1866,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { if (CXFA_ContentLayoutItem* pRowLayoutCell = (CXFA_ContentLayoutItem*)pLayoutChild->m_pFirstChild) { rgRowItems.push_back(pRowLayoutCell); - int32_t iColSpan = pRowLayoutCell->m_pFormNode->JSNode()->GetInteger( + int32_t iColSpan = pRowLayoutCell->m_pFormNode->JSObject()->GetInteger( XFA_Attribute::ColSpan); rgRowItemsSpan.push_back(iColSpan); rgRowItemsWidth.push_back(pRowLayoutCell->m_sSize.width); @@ -1886,10 +1890,10 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { pNewCell = nullptr; } rgRowItems[i] = pNewCell; - rgRowItemsSpan[i] = pNewCell - ? pNewCell->m_pFormNode->JSNode()->GetInteger( - XFA_Attribute::ColSpan) - : 0; + rgRowItemsSpan[i] = + pNewCell ? pNewCell->m_pFormNode->JSObject()->GetInteger( + XFA_Attribute::ColSpan) + : 0; rgRowItemsWidth[i] = pNewCell ? pNewCell->m_sSize.width : 0; } CXFA_ContentLayoutItem* pCell = rgRowItems[i]; @@ -1941,7 +1945,7 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { if (pLayoutChild->m_pFormNode->GetElementType() == XFA_Element::Subform) { XFA_AttributeEnum eSubformLayout = - pLayoutChild->m_pFormNode->JSNode()->GetEnum(XFA_Attribute::Layout); + pLayoutChild->m_pFormNode->JSObject()->GetEnum(XFA_Attribute::Layout); if (eSubformLayout == XFA_AttributeEnum::Row || eSubformLayout == XFA_AttributeEnum::Rl_row) { RelocateTableRowCells(pLayoutChild, m_rgSpecifiedColumnWidths, @@ -1953,8 +1957,8 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { if (bContainerWidthAutoSize) { pLayoutChild->m_sPos.x = 0; } else { - switch ( - pLayoutChild->m_pFormNode->JSNode()->GetEnum(XFA_Attribute::HAlign)) { + switch (pLayoutChild->m_pFormNode->JSObject()->GetEnum( + XFA_Attribute::HAlign)) { case XFA_AttributeEnum::Center: pLayoutChild->m_sPos.x = (fContentWidthLimit - pLayoutChild->m_sSize.width) / 2; @@ -1999,7 +2003,7 @@ bool CXFA_ItemLayoutProcessor::IsAddNewRowForTrailer( float fWidth = pTrailerItem->m_sSize.width; XFA_AttributeEnum eLayout = - m_pFormNode->JSNode()->GetEnum(XFA_Attribute::Layout); + m_pFormNode->JSObject()->GetEnum(XFA_Attribute::Layout); return eLayout == XFA_AttributeEnum::Tb || m_fWidthLimite <= fWidth; } @@ -2187,16 +2191,16 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( float fRightInset = 0; float fBottomInset = 0; if (pMarginNode) { - fLeftInset = pMarginNode->JSNode() + fLeftInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::LeftInset) .ToUnit(XFA_Unit::Pt); - fTopInset = pMarginNode->JSNode() + fTopInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::TopInset) .ToUnit(XFA_Unit::Pt); - fRightInset = pMarginNode->JSNode() + fRightInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::RightInset) .ToUnit(XFA_Unit::Pt); - fBottomInset = pMarginNode->JSNode() + fBottomInset = pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::BottomInset) .ToUnit(XFA_Unit::Pt); } @@ -2277,8 +2281,9 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( m_pCurChildPreprocessor->m_pLayoutItem = pLayoutNext; break; } - uint8_t uHAlign = HAlignEnumToInt( - pLayoutNext->m_pFormNode->JSNode()->GetEnum(XFA_Attribute::HAlign)); + uint8_t uHAlign = + HAlignEnumToInt(pLayoutNext->m_pFormNode->JSObject()->GetEnum( + XFA_Attribute::HAlign)); rgCurLineLayoutItems[uHAlign].push_back(pLayoutNext); if (eFlowStrategy == XFA_AttributeEnum::Lr_tb) { if (uHAlign > uCurHAlignState) @@ -2761,8 +2766,8 @@ void CXFA_ItemLayoutProcessor::DoLayoutField() { CFX_SizeF size(-1, -1); pNotify->StartFieldDrawLayout(m_pFormNode, size.width, size.height); - int32_t nRotate = - XFA_MapRotation(m_pFormNode->JSNode()->GetInteger(XFA_Attribute::Rotate)); + int32_t nRotate = XFA_MapRotation( + m_pFormNode->JSObject()->GetInteger(XFA_Attribute::Rotate)); if (nRotate == 90 || nRotate == 270) std::swap(size.width, size.height); diff --git a/xfa/fxfa/parser/cxfa_layoutitem.cpp b/xfa/fxfa/parser/cxfa_layoutitem.cpp index 322884b2de..02602fd55d 100644 --- a/xfa/fxfa/parser/cxfa_layoutitem.cpp +++ b/xfa/fxfa/parser/cxfa_layoutitem.cpp @@ -76,10 +76,10 @@ CFX_RectF CXFA_LayoutItem::GetRect(bool bRelative) const { CXFA_Node* pMarginNode = pLayoutItem->m_pFormNode->GetFirstChildByClass(XFA_Element::Margin); if (pMarginNode) { - sPos += CFX_PointF(pMarginNode->JSNode() + sPos += CFX_PointF(pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::LeftInset) .ToUnit(XFA_Unit::Pt), - pMarginNode->JSNode() + pMarginNode->JSObject() ->GetMeasure(XFA_Attribute::TopInset) .ToUnit(XFA_Unit::Pt)); } @@ -88,10 +88,10 @@ CFX_RectF CXFA_LayoutItem::GetRect(bool bRelative) const { if (pLayoutItem->m_pFormNode->GetElementType() == XFA_Element::ContentArea) { - sPos += CFX_PointF(pLayoutItem->m_pFormNode->JSNode() + sPos += CFX_PointF(pLayoutItem->m_pFormNode->JSObject() ->GetMeasure(XFA_Attribute::X) .ToUnit(XFA_Unit::Pt), - pLayoutItem->m_pFormNode->JSNode() + pLayoutItem->m_pFormNode->JSObject() ->GetMeasure(XFA_Attribute::Y) .ToUnit(XFA_Unit::Pt)); break; diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index 9ee05314ed..f9040d6b4d 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; WideString wsRelevant = - pFormItem->JSNode()->GetCData(XFA_Attribute::Relevant); + pFormItem->JSObject()->GetCData(XFA_Attribute::Relevant); if (!wsRelevant.IsEmpty()) { if (wsRelevant == L"+print" || wsRelevant == L"print") dwRelevant &= ~XFA_WidgetStatus_Viewable; @@ -97,7 +97,7 @@ void SyncContainer(CXFA_FFNotify* pNotify, uint32_t dwRelevantContainer = 0; if (bVisible) { XFA_AttributeEnum eAttributeValue = - pContainerItem->m_pFormNode->JSNode() + pContainerItem->m_pFormNode->JSObject() ->TryEnum(XFA_Attribute::Presence, true) .value_or(XFA_AttributeEnum::Visible); if (eAttributeValue == XFA_AttributeEnum::Visible) @@ -274,7 +274,7 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { return false; m_pTemplatePageSetRoot = - pTemplateNode->JSNode()->GetProperty(0, XFA_Element::PageSet, true); + pTemplateNode->JSObject()->GetProperty(0, XFA_Element::PageSet, true); ASSERT(m_pTemplatePageSetRoot); if (m_pPageSetLayoutItemRoot) { m_pPageSetLayoutItemRoot->m_pParent = nullptr; @@ -286,10 +286,10 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { new CXFA_ContainerLayoutItem(m_pTemplatePageSetRoot); } m_pPageSetCurRoot = m_pPageSetLayoutItemRoot; - m_pTemplatePageSetRoot->JSNode()->SetLayoutItem(m_pPageSetLayoutItemRoot); + m_pTemplatePageSetRoot->JSObject()->SetLayoutItem(m_pPageSetLayoutItemRoot); XFA_AttributeEnum eRelation = - m_pTemplatePageSetRoot->JSNode()->GetEnum(XFA_Attribute::Relation); + m_pTemplatePageSetRoot->JSObject()->GetEnum(XFA_Attribute::Relation); if (eRelation != XFA_AttributeEnum::Unknown) m_ePageSetMode = eRelation; @@ -329,13 +329,13 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { pPageArea->InsertChild(pContentArea, nullptr); pContentArea->SetFlag(XFA_NodeFlag_Initialized, true); - pContentArea->JSNode()->SetMeasure( + pContentArea->JSObject()->SetMeasure( XFA_Attribute::X, CXFA_Measurement(0.25f, XFA_Unit::In), false); - pContentArea->JSNode()->SetMeasure( + pContentArea->JSObject()->SetMeasure( XFA_Attribute::Y, CXFA_Measurement(0.25f, XFA_Unit::In), false); - pContentArea->JSNode()->SetMeasure( + pContentArea->JSObject()->SetMeasure( XFA_Attribute::W, CXFA_Measurement(8.0f, XFA_Unit::In), false); - pContentArea->JSNode()->SetMeasure( + pContentArea->JSObject()->SetMeasure( XFA_Attribute::H, CXFA_Measurement(10.5f, XFA_Unit::In), false); } CXFA_Node* pMedium = pPageArea->GetChild(0, XFA_Element::Medium, false); @@ -347,10 +347,10 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { pPageArea->InsertChild(pMedium, nullptr); pMedium->SetFlag(XFA_NodeFlag_Initialized, true); - pMedium->JSNode()->SetMeasure(XFA_Attribute::Short, - CXFA_Measurement(8.5f, XFA_Unit::In), false); - pMedium->JSNode()->SetMeasure(XFA_Attribute::Long, - CXFA_Measurement(11.0f, XFA_Unit::In), false); + pMedium->JSObject()->SetMeasure( + XFA_Attribute::Short, CXFA_Measurement(8.5f, XFA_Unit::In), false); + pMedium->JSObject()->SetMeasure( + XFA_Attribute::Long, CXFA_Measurement(11.0f, XFA_Unit::In), false); } return true; } @@ -366,7 +366,7 @@ bool CXFA_LayoutPageMgr::PrepareFirstPage(CXFA_Node* pRootSubform) { XFA_Element eType = pBreakNode->GetElementType(); if (eType == XFA_Element::BreakBefore || (eType == XFA_Element::Break && - pBreakNode->JSNode()->GetEnum(XFA_Attribute::Before) != + pBreakNode->JSObject()->GetEnum(XFA_Attribute::Before) != XFA_AttributeEnum::Auto)) { bProBreakBefore = true; pBreakBeforeNode = pBreakNode; @@ -471,7 +471,7 @@ float CXFA_LayoutPageMgr::GetAvailHeight() { if (!pLayoutItem || !pLayoutItem->m_pFormNode) return 0.0f; - float fAvailHeight = pLayoutItem->m_pFormNode->JSNode() + float fAvailHeight = pLayoutItem->m_pFormNode->JSObject() ->GetMeasure(XFA_Attribute::H) .ToUnit(XFA_Unit::Pt); if (fAvailHeight >= XFA_LAYOUT_FLOAT_PERCISION) @@ -482,7 +482,7 @@ float CXFA_LayoutPageMgr::GetAvailHeight() { } bool XFA_LayoutPageMgr_RunBreakTestScript(CXFA_Node* pTestScript) { - WideString wsExpression = pTestScript->JSNode()->GetContent(false); + WideString wsExpression = pTestScript->JSObject()->GetContent(false); if (wsExpression.IsEmpty()) return true; return pTestScript->GetDocument()->GetNotify()->RunScript( @@ -507,7 +507,7 @@ CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( } else { CXFA_ContainerLayoutItem* pParentLayoutItem = static_cast<CXFA_ContainerLayoutItem*>( - pPageSet->JSNode()->GetLayoutItem()); + pPageSet->JSObject()->GetLayoutItem()); if (!pParentLayoutItem) pParentLayoutItem = m_pPageSetCurRoot; @@ -521,12 +521,12 @@ CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( } else { pParentPageSetLayout = static_cast<CXFA_ContainerLayoutItem*>( pPageSet->GetNodeItem(XFA_NODEITEM_Parent) - ->JSNode() + ->JSObject() ->GetLayoutItem()); } CXFA_ContainerLayoutItem* pPageSetLayoutItem = new CXFA_ContainerLayoutItem(pPageSet); - pPageSet->JSNode()->SetLayoutItem(pPageSetLayoutItem); + pPageSet->JSObject()->SetLayoutItem(pPageSetLayoutItem); if (!pParentPageSetLayout) { CXFA_ContainerLayoutItem* pPrePageSet = m_pPageSetLayoutItemRoot; while (pPrePageSet->m_pNextSibling) { @@ -549,7 +549,7 @@ CXFA_ContainerRecord* CXFA_LayoutPageMgr::CreateContainerRecord( } else { CXFA_ContainerLayoutItem* pPageSetLayoutItem = new CXFA_ContainerLayoutItem(pPageSet); - pPageSet->JSNode()->SetLayoutItem(pPageSetLayoutItem); + pPageSet->JSObject()->SetLayoutItem(pPageSetLayoutItem); m_pPageSetLayoutItemRoot->AddChild(pPageSetLayoutItem); pNewRecord->pCurPageSet = pPageSetLayoutItem; } @@ -608,7 +608,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { for (CXFA_ContainerLayoutItem* pPageSetLayoutItem = sIterator.GetCurrent(); pPageSetLayoutItem; pPageSetLayoutItem = sIterator.MoveToNext()) { XFA_AttributeEnum ePageRelation = - pPageSetLayoutItem->m_pFormNode->JSNode()->GetEnum( + pPageSetLayoutItem->m_pFormNode->JSObject()->GetEnum( XFA_Attribute::Relation); switch (ePageRelation) { case XFA_AttributeEnum::OrderedOccurrence: @@ -644,12 +644,12 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { } CXFA_Node* pNode = m_pCurPageArea; XFA_AttributeEnum eCurChoice = - pNode->JSNode()->GetEnum(XFA_Attribute::PagePosition); + pNode->JSObject()->GetEnum(XFA_Attribute::PagePosition); if (eCurChoice == XFA_AttributeEnum::Last) { XFA_AttributeEnum eOddOrEven = - pNode->JSNode()->GetEnum(XFA_Attribute::OddOrEven); + pNode->JSObject()->GetEnum(XFA_Attribute::OddOrEven); XFA_AttributeEnum eLastChoice = - pLastPageAreaLayoutItem->m_pFormNode->JSNode()->GetEnum( + pLastPageAreaLayoutItem->m_pFormNode->JSObject()->GetEnum( XFA_Attribute::PagePosition); if (eLastChoice == XFA_AttributeEnum::First && (ePageRelation == XFA_AttributeEnum::SimplexPaginated || @@ -694,7 +694,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { } iCurContentAreaIndex++; if (rgUsedHeights[iCurContentAreaIndex] > - pContentAreaNode->JSNode() + pContentAreaNode->JSObject() ->GetMeasure(XFA_Attribute::H) .ToUnit(XFA_Unit::Pt) + XFA_LAYOUT_FLOAT_PERCISION) { @@ -725,7 +725,7 @@ void CXFA_LayoutPageMgr::FinishPaginatedPageSets() { pContentAreaNode = pContentAreaNode->GetNodeItem(XFA_NODEITEM_NextSibling); } - } else if (pNode->JSNode()->GetEnum(XFA_Attribute::PagePosition) == + } else if (pNode->JSObject()->GetEnum(XFA_Attribute::PagePosition) == XFA_AttributeEnum::Last) { CXFA_ContainerRecord* pRecord = CreateContainerRecord(); AddPageAreaLayoutItem(pRecord, pNode); @@ -815,22 +815,23 @@ bool CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); CXFA_Node* pContainer = pFormNode->GetTemplateNode(); bool bStartNew = - pCurNode->JSNode()->GetInteger(XFA_Attribute::StartNew) != 0; + pCurNode->JSObject()->GetInteger(XFA_Attribute::StartNew) != 0; CXFA_Node* pScript = pCurNode->GetFirstChildByClass(XFA_Element::Script); if (pScript && !XFA_LayoutPageMgr_RunBreakTestScript(pScript)) return false; - WideString wsTarget = pCurNode->JSNode()->GetCData(XFA_Attribute::Target); + WideString wsTarget = + pCurNode->JSObject()->GetCData(XFA_Attribute::Target); CXFA_Node* pTarget = ResolveBreakTarget(m_pTemplatePageSetRoot, true, wsTarget); - wsBreakTrailer = pCurNode->JSNode()->GetCData(XFA_Attribute::Trailer); - wsBreakLeader = pCurNode->JSNode()->GetCData(XFA_Attribute::Leader); + wsBreakTrailer = pCurNode->JSObject()->GetCData(XFA_Attribute::Trailer); + wsBreakLeader = pCurNode->JSObject()->GetCData(XFA_Attribute::Leader); pBreakLeaderTemplate = ResolveBreakTarget(pContainer, true, wsBreakLeader); pBreakTrailerTemplate = ResolveBreakTarget(pContainer, true, wsBreakTrailer); if (RunBreak(eType, - pCurNode->JSNode()->GetEnum(XFA_Attribute::TargetType), + pCurNode->JSObject()->GetEnum(XFA_Attribute::TargetType), pTarget, bStartNew)) { return true; } @@ -856,14 +857,14 @@ bool CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter( } case XFA_Element::Break: { bool bStartNew = - pCurNode->JSNode()->GetInteger(XFA_Attribute::StartNew) != 0; - WideString wsTarget = pCurNode->JSNode()->GetCData( + pCurNode->JSObject()->GetInteger(XFA_Attribute::StartNew) != 0; + WideString wsTarget = pCurNode->JSObject()->GetCData( bBefore ? XFA_Attribute::BeforeTarget : XFA_Attribute::AfterTarget); CXFA_Node* pTarget = ResolveBreakTarget(m_pTemplatePageSetRoot, true, wsTarget); if (RunBreak(bBefore ? XFA_Element::BreakBefore : XFA_Element::BreakAfter, - pCurNode->JSNode()->GetEnum(bBefore ? XFA_Attribute::Before - : XFA_Attribute::After), + pCurNode->JSObject()->GetEnum( + bBefore ? XFA_Attribute::Before : XFA_Attribute::After), pTarget, bStartNew)) { return true; } @@ -949,11 +950,11 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, ->GetTemplateNode(); if (pOverflowNode->GetElementType() == XFA_Element::Break) { WideString wsOverflowLeader = - pOverflowNode->JSNode()->GetCData(XFA_Attribute::OverflowLeader); + pOverflowNode->JSObject()->GetCData(XFA_Attribute::OverflowLeader); WideString wsOverflowTarget = - pOverflowNode->JSNode()->GetCData(XFA_Attribute::OverflowTarget); + pOverflowNode->JSObject()->GetCData(XFA_Attribute::OverflowTarget); WideString wsOverflowTrailer = - pOverflowNode->JSNode()->GetCData(XFA_Attribute::OverflowTrailer); + pOverflowNode->JSObject()->GetCData(XFA_Attribute::OverflowTrailer); if (wsOverflowTarget.IsEmpty() && wsOverflowLeader.IsEmpty() && wsOverflowTrailer.IsEmpty()) { return nullptr; @@ -990,7 +991,7 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, return nullptr; WideString wsOverflowTarget = - pOverflowNode->JSNode()->GetCData(XFA_Attribute::Target); + pOverflowNode->JSObject()->GetCData(XFA_Attribute::Target); if (!wsOverflowTarget.IsEmpty() && bCreatePage && !m_bCreateOverFlowPage) { CXFA_Node* pTarget = ResolveBreakTarget(m_pTemplatePageSetRoot, true, wsOverflowTarget); @@ -1012,9 +1013,9 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode, } if (!bCreatePage) { WideString wsLeader = - pOverflowNode->JSNode()->GetCData(XFA_Attribute::Leader); + pOverflowNode->JSObject()->GetCData(XFA_Attribute::Leader); WideString wsTrailer = - pOverflowNode->JSNode()->GetCData(XFA_Attribute::Trailer); + pOverflowNode->JSObject()->GetCData(XFA_Attribute::Trailer); pLeaderTemplate = ResolveBreakTarget(pContainer, true, wsLeader); pTrailerTemplate = ResolveBreakTarget(pContainer, true, wsTrailer); } @@ -1083,7 +1084,7 @@ bool CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer( ->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode) ->GetTemplateNode(); if (pBookendNode->GetElementType() == XFA_Element::Break) { - WideString leader = pBookendNode->JSNode()->GetCData( + WideString leader = pBookendNode->JSObject()->GetCData( bLeader ? XFA_Attribute::BookendLeader : XFA_Attribute::BookendTrailer); if (!leader.IsEmpty()) { pBookendAppendTemplate = ResolveBreakTarget(pContainer, false, leader); @@ -1093,7 +1094,7 @@ bool CXFA_LayoutPageMgr::ResolveBookendLeaderOrTrailer( } if (pBookendNode->GetElementType() == XFA_Element::Bookend) { - WideString leader = pBookendNode->JSNode()->GetCData( + WideString leader = pBookendNode->JSObject()->GetCData( bLeader ? XFA_Attribute::Leader : XFA_Attribute::Trailer); pBookendAppendTemplate = ResolveBreakTarget(pContainer, true, leader); return true; @@ -1140,7 +1141,7 @@ bool CXFA_LayoutPageMgr::FindPageAreaFromPageSet_Ordered( CXFA_Node* pOccurNode = pPageSet->GetFirstChildByClass(XFA_Element::Occur); if (pOccurNode) { pdfium::Optional<int32_t> ret = - pOccurNode->JSNode()->TryInteger(XFA_Attribute::Max, false); + pOccurNode->JSObject()->TryInteger(XFA_Attribute::Max, false); if (ret) iMax = *ret; } @@ -1220,12 +1221,12 @@ bool CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( continue; XFA_AttributeEnum eCurPagePosition = - pCurrentNode->JSNode()->GetEnum(XFA_Attribute::PagePosition); + pCurrentNode->JSObject()->GetEnum(XFA_Attribute::PagePosition); if (ePreferredPosition == XFA_AttributeEnum::Last) { if (eCurPagePosition != ePreferredPosition) continue; if (m_ePageSetMode == XFA_AttributeEnum::SimplexPaginated || - pCurrentNode->JSNode()->GetEnum(XFA_Attribute::OddOrEven) == + pCurrentNode->JSObject()->GetEnum(XFA_Attribute::OddOrEven) == XFA_AttributeEnum::Any) { pPreferredPageArea = pCurrentNode; break; @@ -1241,7 +1242,7 @@ bool CXFA_LayoutPageMgr::FindPageAreaFromPageSet_SimplexDuplex( if (eCurPagePosition != ePreferredPosition) continue; if (m_ePageSetMode != XFA_AttributeEnum::DuplexPaginated || - pCurrentNode->JSNode()->GetEnum(XFA_Attribute::OddOrEven) == + pCurrentNode->JSObject()->GetEnum(XFA_Attribute::OddOrEven) == XFA_AttributeEnum::Any) { pPreferredPageArea = pCurrentNode; break; @@ -1308,7 +1309,7 @@ bool CXFA_LayoutPageMgr::MatchPageAreaOddOrEven(CXFA_Node* pPageArea) { return true; pdfium::Optional<XFA_AttributeEnum> ret = - pPageArea->JSNode()->TryEnum(XFA_Attribute::OddOrEven, true); + pPageArea->JSObject()->TryEnum(XFA_Attribute::OddOrEven, true); if (!ret || *ret == XFA_AttributeEnum::Any) return true; @@ -1338,7 +1339,7 @@ CXFA_Node* CXFA_LayoutPageMgr::GetNextAvailPageArea( m_pCurPageArea->GetFirstChildByClass(XFA_Element::Occur); if (pOccurNode) { pdfium::Optional<int32_t> ret = - pOccurNode->JSNode()->TryInteger(XFA_Attribute::Max, false); + pOccurNode->JSObject()->TryInteger(XFA_Attribute::Max, false); if (ret) iMax = *ret; } @@ -1428,7 +1429,7 @@ void CXFA_LayoutPageMgr::InitPageSetMap() { pPageSetNode = sIterator.MoveToNext()) { if (pPageSetNode->GetElementType() == XFA_Element::PageSet) { XFA_AttributeEnum eRelation = - pPageSetNode->JSNode()->GetEnum(XFA_Attribute::Relation); + pPageSetNode->JSObject()->GetEnum(XFA_Attribute::Relation); if (eRelation == XFA_AttributeEnum::OrderedOccurrence) m_pPageSetMap[pPageSetNode] = 0; } @@ -1445,7 +1446,7 @@ int32_t CXFA_LayoutPageMgr::CreateMinPageRecord(CXFA_Node* pPageArea, pdfium::Optional<int32_t> ret; CXFA_Node* pOccurNode = pPageArea->GetFirstChildByClass(XFA_Element::Occur); if (pOccurNode) { - ret = pOccurNode->JSNode()->TryInteger(XFA_Attribute::Min, false); + ret = pOccurNode->JSObject()->TryInteger(XFA_Attribute::Min, false); if (ret) iMin = *ret; } @@ -1488,7 +1489,7 @@ void CXFA_LayoutPageMgr::CreateMinPageSetRecord(CXFA_Node* pPageSet, return; pdfium::Optional<int32_t> iMin = - pOccurNode->JSNode()->TryInteger(XFA_Attribute::Min, false); + pOccurNode->JSObject()->TryInteger(XFA_Attribute::Min, false); if (!iMin || iCurSetCount >= *iMin) return; @@ -1542,7 +1543,7 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(float fChildHeight) { pCurContentNode = pCurContentNode->GetNextSameClassSibling(XFA_Element::ContentArea); if (pCurContentNode) { - float fNextContentHeight = pCurContentNode->JSNode() + float fNextContentHeight = pCurContentNode->JSObject() ->GetMeasure(XFA_Attribute::H) .ToUnit(XFA_Unit::Pt); return fNextContentHeight > fChildHeight; @@ -1553,7 +1554,7 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(float fChildHeight) { int32_t iMax = 0; pdfium::Optional<int32_t> ret; if (pOccurNode) { - ret = pOccurNode->JSNode()->TryInteger(XFA_Attribute::Max, false); + ret = pOccurNode->JSObject()->TryInteger(XFA_Attribute::Max, false); if (ret) iMax = *ret; } @@ -1578,7 +1579,7 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(float fChildHeight) { CXFA_Node* pContentArea = pNextPage->GetFirstChildByClass(XFA_Element::ContentArea); if (pContentArea) { - float fNextContentHeight = pContentArea->JSNode() + float fNextContentHeight = pContentArea->JSObject() ->GetMeasure(XFA_Attribute::H) .ToUnit(XFA_Unit::Pt); if (fNextContentHeight > fChildHeight) @@ -1591,8 +1592,9 @@ bool CXFA_LayoutPageMgr::GetNextAvailContentHeight(float fChildHeight) { CXFA_Node* pContentArea = pPageNode->GetFirstChildByClass(XFA_Element::ContentArea); - float fNextContentHeight = - pContentArea->JSNode()->GetMeasure(XFA_Attribute::H).ToUnit(XFA_Unit::Pt); + float fNextContentHeight = pContentArea->JSObject() + ->GetMeasure(XFA_Attribute::H) + .ToUnit(XFA_Unit::Pt); if (fNextContentHeight < XFA_LAYOUT_FLOAT_PERCISION) return true; if (fNextContentHeight > fChildHeight) @@ -1667,11 +1669,11 @@ CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow(CXFA_Node* pFormNode) { pCurNode; pCurNode = pCurNode->GetNodeItem((XFA_NODEITEM_NextSibling))) { if (pCurNode->GetElementType() == XFA_Element::Break) { WideString wsOverflowLeader = - pCurNode->JSNode()->GetCData(XFA_Attribute::OverflowLeader); + pCurNode->JSObject()->GetCData(XFA_Attribute::OverflowLeader); WideString wsOverflowTarget = - pCurNode->JSNode()->GetCData(XFA_Attribute::OverflowTarget); + pCurNode->JSObject()->GetCData(XFA_Attribute::OverflowTarget); WideString wsOverflowTrailer = - pCurNode->JSNode()->GetCData(XFA_Attribute::OverflowTrailer); + pCurNode->JSObject()->GetCData(XFA_Attribute::OverflowTrailer); if (!wsOverflowLeader.IsEmpty() || !wsOverflowTrailer.IsEmpty() || !wsOverflowTarget.IsEmpty()) { @@ -1731,9 +1733,10 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { pPendingPageSet = pRootPageSetContainerItem->m_pFormNode; } } - if (pRootPageSetContainerItem->m_pFormNode->JSNode()->GetLayoutItem() == + if (pRootPageSetContainerItem->m_pFormNode->JSObject()->GetLayoutItem() == pRootPageSetContainerItem) { - pRootPageSetContainerItem->m_pFormNode->JSNode()->SetLayoutItem(nullptr); + pRootPageSetContainerItem->m_pFormNode->JSObject()->SetLayoutItem( + nullptr); } pRootPageSetContainerItem->m_pFormNode = pPendingPageSet; pPendingPageSet->ClearFlag(XFA_NodeFlag_UnusedNode); @@ -1781,7 +1784,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { pIter = sIterator.MoveToNext()) { if (pIter->GetElementType() != XFA_Element::ContentArea) { CXFA_LayoutItem* pLayoutItem = - pIter->JSNode()->GetLayoutItem(); + pIter->JSObject()->GetLayoutItem(); if (pLayoutItem) { pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); delete pLayoutItem; @@ -1845,14 +1848,14 @@ void CXFA_LayoutPageMgr::MergePageSetContents() { CXFA_Node* pChildNode = iteChild.MoveToNext(); for (; pChildNode; pChildNode = iteChild.MoveToNext()) { CXFA_LayoutItem* pLayoutItem = - pChildNode->JSNode()->GetLayoutItem(); + pChildNode->JSObject()->GetLayoutItem(); if (pLayoutItem) { pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); delete pLayoutItem; } } } else if (eType != XFA_Element::ContentArea) { - CXFA_LayoutItem* pLayoutItem = pNode->JSNode()->GetLayoutItem(); + CXFA_LayoutItem* pLayoutItem = pNode->JSObject()->GetLayoutItem(); if (pLayoutItem) { pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem); delete pLayoutItem; @@ -1932,7 +1935,7 @@ void CXFA_LayoutPageMgr::SyncLayoutData() { } XFA_AttributeEnum presence = - pContentItem->m_pFormNode->JSNode() + pContentItem->m_pFormNode->JSObject() ->TryEnum(XFA_Attribute::Presence, true) .value_or(XFA_AttributeEnum::Visible); bool bVisible = presence == XFA_AttributeEnum::Visible; diff --git a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp index b8afd6ec19..37906ce297 100644 --- a/xfa/fxfa/parser/cxfa_layoutprocessor.cpp +++ b/xfa/fxfa/parser/cxfa_layoutprocessor.cpp @@ -64,9 +64,9 @@ int32_t CXFA_LayoutProcessor::DoLayout() { XFA_ItemLayoutProcessorResult eStatus; CXFA_Node* pFormNode = m_pRootItemLayoutProcessor->GetFormNode(); float fPosX = - pFormNode->JSNode()->GetMeasure(XFA_Attribute::X).ToUnit(XFA_Unit::Pt); + pFormNode->JSObject()->GetMeasure(XFA_Attribute::X).ToUnit(XFA_Unit::Pt); float fPosY = - pFormNode->JSNode()->GetMeasure(XFA_Attribute::Y).ToUnit(XFA_Unit::Pt); + pFormNode->JSObject()->GetMeasure(XFA_Attribute::Y).ToUnit(XFA_Unit::Pt); do { float fAvailHeight = m_pLayoutPageMgr->GetAvailHeight(); eStatus = m_pRootItemLayoutProcessor->DoLayout(true, fAvailHeight, @@ -122,7 +122,7 @@ CXFA_ContainerLayoutItem* CXFA_LayoutProcessor::GetPage(int32_t index) const { } CXFA_LayoutItem* CXFA_LayoutProcessor::GetLayoutItem(CXFA_Node* pFormItem) { - return pFormItem->JSNode()->GetLayoutItem(); + return pFormItem->JSObject()->GetLayoutItem(); } void CXFA_LayoutProcessor::AddChangedContainer(CXFA_Node* pContainer) { diff --git a/xfa/fxfa/parser/cxfa_linedata.cpp b/xfa/fxfa/parser/cxfa_linedata.cpp index c4995d7338..47e45c77f5 100644 --- a/xfa/fxfa/parser/cxfa_linedata.cpp +++ b/xfa/fxfa/parser/cxfa_linedata.cpp @@ -9,11 +9,11 @@ #include "xfa/fxfa/parser/cxfa_node.h" XFA_AttributeEnum CXFA_LineData::GetHand() const { - return m_pNode->JSNode()->GetEnum(XFA_Attribute::Hand); + return m_pNode->JSObject()->GetEnum(XFA_Attribute::Hand); } bool CXFA_LineData::GetSlope() const { - return m_pNode->JSNode()->GetEnum(XFA_Attribute::Slope) == + return m_pNode->JSObject()->GetEnum(XFA_Attribute::Slope) == XFA_AttributeEnum::Slash; } diff --git a/xfa/fxfa/parser/cxfa_localemgr.cpp b/xfa/fxfa/parser/cxfa_localemgr.cpp index a4c041e95e..e7aa09b52d 100644 --- a/xfa/fxfa/parser/cxfa_localemgr.cpp +++ b/xfa/fxfa/parser/cxfa_localemgr.cpp @@ -1237,7 +1237,7 @@ WideStringView CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) { pCommon ? pCommon->GetFirstChildByClass(XFA_Element::Locale) : nullptr; if (pLocale) { - m_wsConfigLocale = pLocale->JSNode() + m_wsConfigLocale = pLocale->JSObject() ->TryCData(XFA_Attribute::Value, false) .value_or(WideString()); } diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index b404b343db..bede0a722c 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -216,22 +216,22 @@ CXFA_Node* CXFA_Node::Clone(bool bRecursive) { if (!pClone) return nullptr; - JSNode()->MergeAllData(pClone); + JSObject()->MergeAllData(pClone); pClone->UpdateNameHash(); if (IsNeedSavingXMLNode()) { std::unique_ptr<CFX_XMLNode> pCloneXML; if (IsAttributeInXML()) { - WideString wsName = JSNode() + WideString wsName = JSObject() ->TryAttribute(XFA_Attribute::Name, false) .value_or(WideString()); auto pCloneXMLElement = pdfium::MakeUnique<CFX_XMLElement>(wsName); - WideString wsValue = JSNode()->GetCData(XFA_Attribute::Value); + WideString wsValue = JSObject()->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); + pClone->JSObject()->SetEnum(XFA_Attribute::Contains, + XFA_AttributeEnum::Unknown, false); } else { pCloneXML = m_pXMLNode->Clone(); } @@ -556,7 +556,7 @@ bool CXFA_Node::HasBindItem() { } CXFA_WidgetData* CXFA_Node::GetWidgetData() { - return JSNode()->GetWidgetData(); + return JSObject()->GetWidgetData(); } CXFA_WidgetData* CXFA_Node::GetContainerWidgetData() { @@ -627,7 +627,7 @@ bool CXFA_Node::GetLocaleName(WideString& wsLocaleName) { CXFA_Node* pLocaleNode = this; do { pdfium::Optional<WideString> ret = - pLocaleNode->JSNode()->TryCData(XFA_Attribute::Locale, false); + pLocaleNode->JSObject()->TryCData(XFA_Attribute::Locale, false); if (ret) { wsLocaleName = *ret; return true; @@ -642,7 +642,7 @@ bool CXFA_Node::GetLocaleName(WideString& wsLocaleName) { if (pTopSubform) { pdfium::Optional<WideString> ret = - pTopSubform->JSNode()->TryCData(XFA_Attribute::Locale, false); + pTopSubform->JSObject()->TryCData(XFA_Attribute::Locale, false); if (ret) { wsLocaleName = *ret; return true; @@ -659,12 +659,12 @@ bool CXFA_Node::GetLocaleName(WideString& wsLocaleName) { XFA_AttributeEnum CXFA_Node::GetIntact() { CXFA_Node* pKeep = GetFirstChildByClass(XFA_Element::Keep); - XFA_AttributeEnum eLayoutType = JSNode() + XFA_AttributeEnum eLayoutType = JSObject() ->TryEnum(XFA_Attribute::Layout, true) .value_or(XFA_AttributeEnum::Position); if (pKeep) { pdfium::Optional<XFA_AttributeEnum> intact = - pKeep->JSNode()->TryEnum(XFA_Attribute::Intact, false); + pKeep->JSObject()->TryEnum(XFA_Attribute::Intact, false); if (intact) { if (*intact == XFA_AttributeEnum::None && eLayoutType == XFA_AttributeEnum::Row && @@ -672,10 +672,10 @@ XFA_AttributeEnum CXFA_Node::GetIntact() { CXFA_Node* pPreviewRow = GetNodeItem(XFA_NODEITEM_PrevSibling, XFA_ObjectType::ContainerNode); if (pPreviewRow && - pPreviewRow->JSNode()->GetEnum(XFA_Attribute::Layout) == + pPreviewRow->JSObject()->GetEnum(XFA_Attribute::Layout) == XFA_AttributeEnum::Row) { pdfium::Optional<XFA_AttributeEnum> value = - pKeep->JSNode()->TryEnum(XFA_Attribute::Previous, false); + pKeep->JSObject()->TryEnum(XFA_Attribute::Previous, false); if (value && (*value == XFA_AttributeEnum::ContentArea || *value == XFA_AttributeEnum::PageArea)) { return XFA_AttributeEnum::ContentArea; @@ -685,7 +685,7 @@ XFA_AttributeEnum CXFA_Node::GetIntact() { pPreviewRow->GetFirstChildByClass(XFA_Element::Keep); pdfium::Optional<XFA_AttributeEnum> ret; if (pNode) - ret = pNode->JSNode()->TryEnum(XFA_Attribute::Next, false); + ret = pNode->JSObject()->TryEnum(XFA_Attribute::Next, false); if (ret && (*ret == XFA_AttributeEnum::ContentArea || *ret == XFA_AttributeEnum::PageArea)) { return XFA_AttributeEnum::ContentArea; @@ -712,7 +712,7 @@ XFA_AttributeEnum CXFA_Node::GetIntact() { if (parent->GetIntact() != XFA_AttributeEnum::None) return XFA_AttributeEnum::ContentArea; - XFA_AttributeEnum eParLayout = parent->JSNode() + XFA_AttributeEnum eParLayout = parent->JSObject() ->TryEnum(XFA_Attribute::Layout, true) .value_or(XFA_AttributeEnum::Position); if (eParLayout == XFA_AttributeEnum::Position || @@ -724,7 +724,7 @@ XFA_AttributeEnum CXFA_Node::GetIntact() { XFA_VERSION version = m_pDocument->GetCurVersionMode(); if (eParLayout == XFA_AttributeEnum::Tb && version < XFA_VERSION_208) { pdfium::Optional<CXFA_Measurement> measureH = - JSNode()->TryMeasure(XFA_Attribute::H, false); + JSObject()->TryMeasure(XFA_Attribute::H, false); if (measureH) return XFA_AttributeEnum::ContentArea; } @@ -946,21 +946,21 @@ bool CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) { CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pNode->m_pXMLNode); WideString wsAttributeName = - pNode->JSNode()->GetCData(XFA_Attribute::QualifiedName); + pNode->JSObject()->GetCData(XFA_Attribute::QualifiedName); pXMLElement->RemoveAttribute(wsAttributeName.c_str()); } - WideString wsName = pNode->JSNode() + WideString wsName = pNode->JSObject() ->TryAttribute(XFA_Attribute::Name, false) .value_or(WideString()); CFX_XMLElement* pNewXMLElement = new CFX_XMLElement(wsName); - WideString wsValue = JSNode()->GetCData(XFA_Attribute::Value); + WideString wsValue = JSObject()->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); + pNode->JSObject()->SetEnum(XFA_Attribute::Contains, + XFA_AttributeEnum::Unknown, false); } else { m_pXMLNode->RemoveChildNode(pNode->m_pXMLNode); } @@ -1049,8 +1049,9 @@ CXFA_Node* CXFA_Node::GetInstanceMgrOfSubform() { break; } if (eType == XFA_Element::InstanceManager) { - WideString wsName = JSNode()->GetCData(XFA_Attribute::Name); - WideString wsInstName = pNode->JSNode()->GetCData(XFA_Attribute::Name); + WideString wsName = JSObject()->GetCData(XFA_Attribute::Name); + WideString wsInstName = + pNode->JSObject()->GetCData(XFA_Attribute::Name); if (wsInstName.GetLength() > 0 && wsInstName[0] == '_' && wsInstName.Right(wsInstName.GetLength() - 1) == wsName) { pInstanceMgr = pNode; @@ -1099,7 +1100,7 @@ void CXFA_Node::ReleaseBindingNodes() { } bool CXFA_Node::IsAttributeInXML() { - return JSNode()->GetEnum(XFA_Attribute::Contains) == + return JSObject()->GetEnum(XFA_Attribute::Contains) == XFA_AttributeEnum::MetaData; } @@ -1113,13 +1114,13 @@ void CXFA_Node::OnRemoved(bool bNotify) { } void CXFA_Node::UpdateNameHash() { - WideString wsName = JSNode()->GetCData(XFA_Attribute::Name); + WideString wsName = JSObject()->GetCData(XFA_Attribute::Name); m_dwNameHash = FX_HashCode_GetW(wsName.AsStringView(), false); } CFX_XMLNode* CXFA_Node::CreateXMLMappingNode() { if (!m_pXMLNode) { - WideString wsTag(JSNode()->GetCData(XFA_Attribute::Name)); + WideString wsTag(JSObject()->GetCData(XFA_Attribute::Name)); m_pXMLNode = new CFX_XMLElement(wsTag); SetFlag(XFA_NodeFlag_OwnXMLNode, false); } @@ -1144,8 +1145,8 @@ CXFA_Node* CXFA_Node::GetItem(int32_t iIndex) { continue; } if (iCount == 0) { - WideString wsName = pNode->JSNode()->GetCData(XFA_Attribute::Name); - WideString wsInstName = JSNode()->GetCData(XFA_Attribute::Name); + WideString wsName = pNode->JSObject()->GetCData(XFA_Attribute::Name); + WideString wsInstName = JSObject()->GetCData(XFA_Attribute::Name); if (wsInstName.GetLength() < 1 || wsInstName[0] != '_' || wsInstName.Right(wsInstName.GetLength() - 1) != wsName) { return nullptr; @@ -1175,8 +1176,8 @@ int32_t CXFA_Node::GetCount() { continue; } if (iCount == 0) { - WideString wsName = pNode->JSNode()->GetCData(XFA_Attribute::Name); - WideString wsInstName = JSNode()->GetCData(XFA_Attribute::Name); + WideString wsName = pNode->JSObject()->GetCData(XFA_Attribute::Name); + WideString wsInstName = JSObject()->GetCData(XFA_Attribute::Name); if (wsInstName.GetLength() < 1 || wsInstName[0] != '_' || wsInstName.Right(wsInstName.GetLength() - 1) != wsName) { return iCount; diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h index 6079ea7f3f..2b0b476d36 100644 --- a/xfa/fxfa/parser/cxfa_node.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -91,10 +91,6 @@ class CXFA_Node : public CXFA_Object { void SetFlag(uint32_t dwFlag, bool bNotify); void ClearFlag(uint32_t dwFlag); - CJX_Node* JSNode() { return static_cast<CJX_Node*>(JSObject()); } - const CJX_Node* JSNode() const { - return static_cast<const CJX_Node*>(JSObject()); - } CXFA_Node* GetParent() { return m_pParent; } CXFA_Node* GetChildNode() { return m_pChild; } diff --git a/xfa/fxfa/parser/cxfa_nodehelper.cpp b/xfa/fxfa/parser/cxfa_nodehelper.cpp index 3324a9ba3d..2c3c46dbb5 100644 --- a/xfa/fxfa/parser/cxfa_nodehelper.cpp +++ b/xfa/fxfa/parser/cxfa_nodehelper.cpp @@ -260,7 +260,7 @@ void CXFA_NodeHelper::GetNameExpression(CXFA_Node* refNode, GetIndex(refNode, eLogicType, bIsProperty, true)); return; } - ws = refNode->JSNode()->GetCData(XFA_Attribute::Name); + ws = refNode->JSObject()->GetCData(XFA_Attribute::Name); ws.Replace(L".", L"\\."); wsName = WideString::Format(L"%ls[%d]", ws.c_str(), @@ -354,8 +354,8 @@ bool CXFA_NodeHelper::ResolveNodes_CreateNode(WideString wsName, for (int32_t iIndex = 0; iIndex < m_iCreateCount; iIndex++) { CXFA_Node* pNewNode = m_pCreateParent->CreateSamePacketNode(eClassType); if (pNewNode) { - pNewNode->JSNode()->SetAttribute(XFA_Attribute::Name, - wsName.AsStringView(), false); + pNewNode->JSObject()->SetAttribute(XFA_Attribute::Name, + wsName.AsStringView(), false); pNewNode->CreateXMLMappingNode(); m_pCreateParent->InsertChild(pNewNode, nullptr); if (iIndex == m_iCreateCount - 1) { diff --git a/xfa/fxfa/parser/cxfa_nodelocale.cpp b/xfa/fxfa/parser/cxfa_nodelocale.cpp index da64c4a04c..54440d5834 100644 --- a/xfa/fxfa/parser/cxfa_nodelocale.cpp +++ b/xfa/fxfa/parser/cxfa_nodelocale.cpp @@ -43,8 +43,9 @@ CXFA_NodeLocale::CXFA_NodeLocale(CXFA_Node* pLocale) : m_pLocale(pLocale) {} CXFA_NodeLocale::~CXFA_NodeLocale() {} WideString CXFA_NodeLocale::GetName() const { - return WideString( - m_pLocale ? m_pLocale->JSNode()->GetCData(XFA_Attribute::Name) : nullptr); + return WideString(m_pLocale + ? m_pLocale->JSObject()->GetCData(XFA_Attribute::Name) + : nullptr); } WideString CXFA_NodeLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType) const { @@ -71,7 +72,7 @@ WideString CXFA_NodeLocale::GetDateTimeSymbols() const { CXFA_Node* pSymbols = m_pLocale ? m_pLocale->GetChild(0, XFA_Element::DateTimeSymbols, false) : nullptr; - return pSymbols ? pSymbols->JSNode()->GetContent(false) : WideString(); + return pSymbols ? pSymbols->JSObject()->GetContent(false) : WideString(); } WideString CXFA_NodeLocale::GetMonthName(int32_t nMonth, bool bAbbr) const { @@ -135,7 +136,7 @@ CXFA_Node* CXFA_NodeLocale::GetNodeByName(CXFA_Node* pParent, CXFA_Node* pChild = pParent ? pParent->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr; while (pChild) { - if (pChild->JSNode()->GetAttribute(XFA_Attribute::Name) == wsName) + if (pChild->JSObject()->GetAttribute(XFA_Attribute::Name) == wsName) return pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); @@ -148,7 +149,7 @@ WideString CXFA_NodeLocale::GetSymbol(XFA_Element eElement, CXFA_Node* pSymbols = m_pLocale ? m_pLocale->GetChild(0, eElement, false) : nullptr; CXFA_Node* pSymbol = GetNodeByName(pSymbols, symbol_type); - return pSymbol ? pSymbol->JSNode()->GetContent(false) : WideString(); + return pSymbol ? pSymbol->JSObject()->GetContent(false) : WideString(); } WideString CXFA_NodeLocale::GetCalendarSymbol(XFA_Element eElement, @@ -162,9 +163,9 @@ WideString CXFA_NodeLocale::GetCalendarSymbol(XFA_Element eElement, CXFA_Node* pNode = pCalendar->GetFirstChildByClass(eElement); for (; pNode; pNode = pNode->GetNextSameClassSibling(eElement)) { - if (pNode->JSNode()->GetBoolean(XFA_Attribute::Abbr) == bAbbr) { + if (pNode->JSObject()->GetBoolean(XFA_Attribute::Abbr) == bAbbr) { CXFA_Node* pSymbol = pNode->GetChild(index, XFA_Element::Unknown, false); - return pSymbol ? pSymbol->JSNode()->GetContent(false) : WideString(); + return pSymbol ? pSymbol->JSObject()->GetContent(false) : WideString(); } } return WideString(); diff --git a/xfa/fxfa/parser/cxfa_occurdata.cpp b/xfa/fxfa/parser/cxfa_occurdata.cpp index ffad9fdf00..195dce719a 100644 --- a/xfa/fxfa/parser/cxfa_occurdata.cpp +++ b/xfa/fxfa/parser/cxfa_occurdata.cpp @@ -15,7 +15,7 @@ int32_t CXFA_OccurData::GetMax() const { return 1; pdfium::Optional<int32_t> max = - m_pNode->JSNode()->TryInteger(XFA_Attribute::Max, true); + m_pNode->JSObject()->TryInteger(XFA_Attribute::Max, true); return max ? *max : GetMin(); } @@ -24,7 +24,7 @@ int32_t CXFA_OccurData::GetMin() const { return 1; pdfium::Optional<int32_t> min = - m_pNode->JSNode()->TryInteger(XFA_Attribute::Min, true); + m_pNode->JSObject()->TryInteger(XFA_Attribute::Min, true); return min && *min >= 0 ? *min : 1; } @@ -35,28 +35,28 @@ std::tuple<int32_t, int32_t, int32_t> CXFA_OccurData::GetOccurInfo() const { int32_t iMax = GetMax(); pdfium::Optional<int32_t> init = - m_pNode->JSNode()->TryInteger(XFA_Attribute::Initial, false); + m_pNode->JSObject()->TryInteger(XFA_Attribute::Initial, false); return {iMin, iMax, init && *init >= iMin ? *init : iMin}; } void CXFA_OccurData::SetMax(int32_t iMax) { iMax = (iMax != -1 && iMax < 1) ? 1 : iMax; - m_pNode->JSNode()->SetInteger(XFA_Attribute::Max, iMax, false); + m_pNode->JSObject()->SetInteger(XFA_Attribute::Max, iMax, false); int32_t iMin = GetMin(); if (iMax != -1 && iMax < iMin) { iMin = iMax; - m_pNode->JSNode()->SetInteger(XFA_Attribute::Min, iMin, false); + m_pNode->JSObject()->SetInteger(XFA_Attribute::Min, iMin, false); } } void CXFA_OccurData::SetMin(int32_t iMin) { iMin = (iMin < 0) ? 1 : iMin; - m_pNode->JSNode()->SetInteger(XFA_Attribute::Min, iMin, false); + m_pNode->JSObject()->SetInteger(XFA_Attribute::Min, iMin, false); int32_t iMax = GetMax(); if (iMax > 0 && iMax < iMin) { iMax = iMin; - m_pNode->JSNode()->SetInteger(XFA_Attribute::Max, iMax, false); + m_pNode->JSObject()->SetInteger(XFA_Attribute::Max, iMax, false); } } diff --git a/xfa/fxfa/parser/cxfa_paradata.cpp b/xfa/fxfa/parser/cxfa_paradata.cpp index 22cb678c99..7dfd924675 100644 --- a/xfa/fxfa/parser/cxfa_paradata.cpp +++ b/xfa/fxfa/parser/cxfa_paradata.cpp @@ -12,49 +12,49 @@ CXFA_ParaData::CXFA_ParaData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} XFA_AttributeEnum CXFA_ParaData::GetHorizontalAlign() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->TryEnum(XFA_Attribute::HAlign, true) .value_or(XFA_AttributeEnum::Left); } XFA_AttributeEnum CXFA_ParaData::GetVerticalAlign() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->TryEnum(XFA_Attribute::VAlign, true) .value_or(XFA_AttributeEnum::Top); } float CXFA_ParaData::GetLineHeight() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->GetMeasure(XFA_Attribute::LineHeight) .ToUnit(XFA_Unit::Pt); } float CXFA_ParaData::GetMarginLeft() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->GetMeasure(XFA_Attribute::MarginLeft) .ToUnit(XFA_Unit::Pt); } float CXFA_ParaData::GetMarginRight() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->GetMeasure(XFA_Attribute::MarginRight) .ToUnit(XFA_Unit::Pt); } float CXFA_ParaData::GetSpaceAbove() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->GetMeasure(XFA_Attribute::SpaceAbove) .ToUnit(XFA_Unit::Pt); } float CXFA_ParaData::GetSpaceBelow() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->GetMeasure(XFA_Attribute::SpaceBelow) .ToUnit(XFA_Unit::Pt); } float CXFA_ParaData::GetTextIndent() const { - return m_pNode->JSNode() + return m_pNode->JSObject() ->GetMeasure(XFA_Attribute::TextIndent) .ToUnit(XFA_Unit::Pt); } diff --git a/xfa/fxfa/parser/cxfa_scriptdata.cpp b/xfa/fxfa/parser/cxfa_scriptdata.cpp index 23e94384f0..7e9f49066f 100644 --- a/xfa/fxfa/parser/cxfa_scriptdata.cpp +++ b/xfa/fxfa/parser/cxfa_scriptdata.cpp @@ -12,7 +12,7 @@ CXFA_ScriptData::CXFA_ScriptData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} CXFA_ScriptData::Type CXFA_ScriptData::GetContentType() const { pdfium::Optional<WideString> cData = - m_pNode->JSNode()->TryCData(XFA_Attribute::ContentType, false); + m_pNode->JSObject()->TryCData(XFA_Attribute::ContentType, false); if (!cData || *cData == L"application/x-formcalc") return Type::Formcalc; if (*cData == L"application/x-javascript") @@ -21,9 +21,9 @@ CXFA_ScriptData::Type CXFA_ScriptData::GetContentType() const { } XFA_AttributeEnum CXFA_ScriptData::GetRunAt() const { - return m_pNode->JSNode()->GetEnum(XFA_Attribute::RunAt); + return m_pNode->JSObject()->GetEnum(XFA_Attribute::RunAt); } WideString CXFA_ScriptData::GetExpression() const { - return m_pNode->JSNode()->GetContent(false); + return m_pNode->JSObject()->GetContent(false); } diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp index bd3fdf7af1..5c722821cb 100644 --- a/xfa/fxfa/parser/cxfa_simple_parser.cpp +++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp @@ -436,12 +436,12 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode, CFX_XMLElement* child = static_cast<CFX_XMLElement*>(pXMLChild); WideString wsNodeStr = child->GetLocalTagName(); - pXFAChild->JSNode()->SetCData(XFA_Attribute::Name, wsNodeStr, false, - false); + pXFAChild->JSObject()->SetCData(XFA_Attribute::Name, wsNodeStr, false, + false); WideString wsChildValue = GetPlainTextFromRichText(child); if (!wsChildValue.IsEmpty()) - pXFAChild->JSNode()->SetCData(XFA_Attribute::Value, wsChildValue, - false, false); + pXFAChild->JSObject()->SetCData(XFA_Attribute::Value, wsChildValue, + false, false); pXFANode->InsertChild(pXFAChild, nullptr); pXFAChild->SetXMLMappingNode(pXMLChild); @@ -513,16 +513,16 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( return nullptr; m_pRootNode = pXFARootNode; - pXFARootNode->JSNode()->SetCData(XFA_Attribute::Name, L"xfa", false, false); + pXFARootNode->JSObject()->SetCData(XFA_Attribute::Name, L"xfa", false, false); CFX_XMLElement* pElement = static_cast<CFX_XMLElement*>(pXMLDocumentNode); for (auto it : pElement->GetAttributes()) { if (it.first == L"uuid") - pXFARootNode->JSNode()->SetCData(XFA_Attribute::Uuid, it.second, false, - false); + pXFARootNode->JSObject()->SetCData(XFA_Attribute::Uuid, it.second, false, + false); else if (it.first == L"timeStamp") - pXFARootNode->JSNode()->SetCData(XFA_Attribute::TimeStamp, it.second, - false, false); + pXFARootNode->JSObject()->SetCData(XFA_Attribute::TimeStamp, it.second, + false, false); } CFX_XMLNode* pXMLConfigDOMRoot = nullptr; @@ -637,7 +637,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config( if (!pNode) return nullptr; - pNode->JSNode()->SetCData(XFA_Attribute::Name, packet->name, false, false); + pNode->JSObject()->SetCData(XFA_Attribute::Name, packet->name, false, false); if (!NormalLoader(pNode, pXMLDocumentNode, XFA_PacketType::Config, true)) return nullptr; @@ -658,7 +658,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Template( if (!pNode) return nullptr; - pNode->JSNode()->SetCData(XFA_Attribute::Name, packet->name, false, false); + pNode->JSObject()->SetCData(XFA_Attribute::Name, packet->name, false, false); if (m_bDocumentParser) { CFX_XMLElement* pXMLDocumentElement = static_cast<CFX_XMLElement*>(pXMLDocumentNode); @@ -706,9 +706,9 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Form( if (!pNode) return nullptr; - pNode->JSNode()->SetCData(XFA_Attribute::Name, packet->name, false, false); - pNode->JSNode()->SetAttribute(XFA_Attribute::Checksum, - wsChecksum.AsStringView(), false); + pNode->JSObject()->SetCData(XFA_Attribute::Name, packet->name, false, false); + pNode->JSObject()->SetAttribute(XFA_Attribute::Checksum, + wsChecksum.AsStringView(), false); CXFA_Node* pTemplateRoot = m_pRootNode->GetFirstChildByClass(XFA_Element::Template); CXFA_Node* pTemplateChosen = @@ -716,7 +716,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Form( : nullptr; bool bUseAttribute = true; if (pTemplateChosen && - pTemplateChosen->JSNode()->GetEnum(XFA_Attribute::RestoreState) != + pTemplateChosen->JSObject()->GetEnum(XFA_Attribute::RestoreState) != XFA_AttributeEnum::Auto) { bUseAttribute = false; } @@ -738,7 +738,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( if (!pNode) return nullptr; - pNode->JSNode()->SetCData(XFA_Attribute::Name, packet->name, false, false); + pNode->JSObject()->SetCData(XFA_Attribute::Name, packet->name, false, + false); if (!DataLoader(pNode, pDatasetsXMLNode, false)) return nullptr; @@ -777,7 +778,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( } WideString wsLocalName = static_cast<CFX_XMLElement*>(pDataXMLNode)->GetLocalTagName(); - pNode->JSNode()->SetCData(XFA_Attribute::Name, wsLocalName, false, false); + pNode->JSObject()->SetCData(XFA_Attribute::Name, wsLocalName, false, false); if (!DataLoader(pNode, pDataXMLNode, true)) return nullptr; @@ -803,7 +804,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet( if (!pNode) return nullptr; - pNode->JSNode()->SetCData(XFA_Attribute::Name, packet->name, false, false); + pNode->JSObject()->SetCData(XFA_Attribute::Name, packet->name, false, false); if (!NormalLoader(pNode, pXMLDocumentNode, packet_type, true)) return nullptr; @@ -823,7 +824,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc( if (!pNode) return nullptr; - pNode->JSNode()->SetCData(XFA_Attribute::Name, packet->name, false, false); + pNode->JSObject()->SetCData(XFA_Attribute::Name, packet->name, false, false); pNode->SetXMLMappingNode(pXMLDocumentNode); return pNode; } @@ -837,7 +838,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User( WideString wsName = static_cast<CFX_XMLElement*>(pXMLDocumentNode)->GetLocalTagName(); - pNode->JSNode()->SetCData(XFA_Attribute::Name, wsName, false, false); + pNode->JSObject()->SetCData(XFA_Attribute::Name, wsName, false, false); if (!UserPacketLoader(pNode, pXMLDocumentNode)) return nullptr; @@ -885,8 +886,8 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, if (!pXFAChild) return nullptr; if (ePacketID == XFA_PacketType::Config) { - pXFAChild->JSNode()->SetAttribute(XFA_Attribute::Name, - wsTagName.AsStringView(), false); + pXFAChild->JSObject()->SetAttribute(XFA_Attribute::Name, + wsTagName.AsStringView(), false); } bool IsNeedValue = true; @@ -905,8 +906,8 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, attr != XFA_Attribute::Save) { continue; } - pXFAChild->JSNode()->SetAttribute(attr, it.second.AsStringView(), - false); + pXFAChild->JSObject()->SetAttribute(attr, it.second.AsStringView(), + false); } pXFANode->InsertChild(pXFAChild, nullptr); if (eType == XFA_Element::Validate || eType == XFA_Element::Locale) { @@ -947,7 +948,7 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, XFA_Element element = XFA_Element::Sharptext; if (pXFANode->GetElementType() == XFA_Element::ExData) { WideString wsContentType = - pXFANode->JSNode()->GetCData(XFA_Attribute::ContentType); + pXFANode->JSObject()->GetCData(XFA_Attribute::ContentType); if (wsContentType == L"text/html") element = XFA_Element::SharpxHTML; else if (wsContentType == L"text/xml") @@ -989,11 +990,12 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode, CXFA_Node* pContentRawDataNode = m_pFactory->CreateNode(ePacketID, element); ASSERT(pContentRawDataNode); - pContentRawDataNode->JSNode()->SetCData(XFA_Attribute::Value, wsValue, - false, false); + pContentRawDataNode->JSObject()->SetCData(XFA_Attribute::Value, wsValue, + false, false); pXFANode->InsertChild(pContentRawDataNode, nullptr); } else { - pXFANode->JSNode()->SetCData(XFA_Attribute::Value, wsValue, false, false); + pXFANode->JSObject()->SetCData(XFA_Attribute::Value, wsValue, false, + false); } } } @@ -1059,7 +1061,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, if (!pXFAChild) return; - pXFAChild->JSNode()->SetCData( + pXFAChild->JSObject()->SetCData( XFA_Attribute::Name, pXMLElement->GetLocalTagName(), false, false); bool bNeedValue = true; @@ -1084,14 +1086,14 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, if (!pXFAMetaData) return; - pXFAMetaData->JSNode()->SetCData(XFA_Attribute::Name, wsName, false, - false); - pXFAMetaData->JSNode()->SetCData(XFA_Attribute::QualifiedName, - it.first, false, false); - pXFAMetaData->JSNode()->SetCData(XFA_Attribute::Value, it.second, - false, false); - pXFAMetaData->JSNode()->SetEnum(XFA_Attribute::Contains, - XFA_AttributeEnum::MetaData, false); + pXFAMetaData->JSObject()->SetCData(XFA_Attribute::Name, wsName, false, + false); + pXFAMetaData->JSObject()->SetCData(XFA_Attribute::QualifiedName, + it.first, false, false); + pXFAMetaData->JSObject()->SetCData(XFA_Attribute::Value, it.second, + false, false); + pXFAMetaData->JSObject()->SetEnum(XFA_Attribute::Contains, + XFA_AttributeEnum::MetaData, false); pXFAChild->InsertChild(pXFAMetaData, nullptr); pXFAMetaData->SetXMLMappingNode(pXMLElement); pXFAMetaData->SetFlag(XFA_NodeFlag_Initialized, false); @@ -1123,8 +1125,8 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, if (!pXFAChild) return; - pXFAChild->JSNode()->SetCData(XFA_Attribute::Value, wsText, false, - false); + pXFAChild->JSObject()->SetCData(XFA_Attribute::Value, wsText, false, + false); pXFANode->InsertChild(pXFAChild, nullptr); pXFAChild->SetXMLMappingNode(pXMLText); pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); @@ -1173,9 +1175,10 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, if (!pXFAChild) return; - pXFAChild->JSNode()->SetCData(XFA_Attribute::Name, L"", false, false); - pXFAChild->JSNode()->SetCData(XFA_Attribute::Value, wsCurValue, false, - false); + pXFAChild->JSObject()->SetCData(XFA_Attribute::Name, L"", false, + false); + pXFAChild->JSObject()->SetCData(XFA_Attribute::Value, wsCurValue, + false, false); pXFANode->InsertChild(pXFAChild, nullptr); pXFAChild->SetXMLMappingNode(pXMLCurValueNode); pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); @@ -1191,14 +1194,14 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, WideString wsNodeStr = static_cast<CFX_XMLElement*>(pXMLChild)->GetLocalTagName(); - pXFAChild->JSNode()->SetCData(XFA_Attribute::Name, wsNodeStr, false, - false); + pXFAChild->JSObject()->SetCData(XFA_Attribute::Name, wsNodeStr, false, + false); ParseDataValue(pXFAChild, pXMLChild, ePacketID); pXFANode->InsertChild(pXFAChild, nullptr); pXFAChild->SetXMLMappingNode(pXMLChild); pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); WideString wsCurValue = - pXFAChild->JSNode()->GetCData(XFA_Attribute::Value); + pXFAChild->JSObject()->GetCData(XFA_Attribute::Value); wsValueTextBuf << wsCurValue; } } @@ -1211,9 +1214,9 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, if (!pXFAChild) return; - pXFAChild->JSNode()->SetCData(XFA_Attribute::Name, L"", false, false); - pXFAChild->JSNode()->SetCData(XFA_Attribute::Value, wsCurValue, false, - false); + pXFAChild->JSObject()->SetCData(XFA_Attribute::Name, L"", false, false); + pXFAChild->JSObject()->SetCData(XFA_Attribute::Value, wsCurValue, false, + false); pXFANode->InsertChild(pXFAChild, nullptr); pXFAChild->SetXMLMappingNode(pXMLCurValueNode); pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false); @@ -1224,7 +1227,8 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, pXMLCurValueNode = nullptr; } WideString wsNodeValue = wsValueTextBuf.MakeString(); - pXFANode->JSNode()->SetCData(XFA_Attribute::Value, wsNodeValue, false, false); + pXFANode->JSObject()->SetCData(XFA_Attribute::Value, wsNodeValue, false, + false); } void CXFA_SimpleParser::ParseInstruction(CXFA_Node* pXFANode, diff --git a/xfa/fxfa/parser/cxfa_strokedata.cpp b/xfa/fxfa/parser/cxfa_strokedata.cpp index a0e80cdd5a..96d2866c37 100644 --- a/xfa/fxfa/parser/cxfa_strokedata.cpp +++ b/xfa/fxfa/parser/cxfa_strokedata.cpp @@ -14,7 +14,7 @@ bool CXFA_StrokeData::IsVisible() const { if (!m_pNode) return false; - XFA_AttributeEnum presence = m_pNode->JSNode() + XFA_AttributeEnum presence = m_pNode->JSObject() ->TryEnum(XFA_Attribute::Presence, true) .value_or(XFA_AttributeEnum::Visible); return presence == XFA_AttributeEnum::Visible; @@ -23,11 +23,11 @@ bool CXFA_StrokeData::IsVisible() const { XFA_AttributeEnum CXFA_StrokeData::GetCapType() const { if (!m_pNode) return XFA_AttributeEnum::Square; - return m_pNode->JSNode()->GetEnum(XFA_Attribute::Cap); + return m_pNode->JSObject()->GetEnum(XFA_Attribute::Cap); } XFA_AttributeEnum CXFA_StrokeData::GetStrokeType() const { - return m_pNode ? m_pNode->JSNode()->GetEnum(XFA_Attribute::Stroke) + return m_pNode ? m_pNode->JSObject()->GetEnum(XFA_Attribute::Stroke) : XFA_AttributeEnum::Solid; } @@ -36,7 +36,7 @@ float CXFA_StrokeData::GetThickness() const { } CXFA_Measurement CXFA_StrokeData::GetMSThickness() const { - return m_pNode ? m_pNode->JSNode()->GetMeasure(XFA_Attribute::Thickness) + return m_pNode ? m_pNode->JSObject()->GetMeasure(XFA_Attribute::Thickness) : CXFA_Measurement(0.5, XFA_Unit::Pt); } @@ -44,7 +44,7 @@ void CXFA_StrokeData::SetMSThickness(CXFA_Measurement msThinkness) { if (!m_pNode) return; - m_pNode->JSNode()->SetMeasure(XFA_Attribute::Thickness, msThinkness, false); + m_pNode->JSObject()->SetMeasure(XFA_Attribute::Thickness, msThinkness, false); } FX_ARGB CXFA_StrokeData::GetColor() const { @@ -56,7 +56,7 @@ FX_ARGB CXFA_StrokeData::GetColor() const { return 0xFF000000; return CXFA_DataData::ToColor( - pNode->JSNode()->GetCData(XFA_Attribute::Value).AsStringView()); + pNode->JSObject()->GetCData(XFA_Attribute::Value).AsStringView()); } void CXFA_StrokeData::SetColor(FX_ARGB argb) { @@ -64,29 +64,29 @@ void CXFA_StrokeData::SetColor(FX_ARGB argb) { return; CXFA_Node* pNode = - m_pNode->JSNode()->GetProperty(0, XFA_Element::Color, true); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Color, true); int a; int r; int g; int b; std::tie(a, r, g, b) = ArgbDecode(argb); - pNode->JSNode()->SetCData(XFA_Attribute::Value, - WideString::Format(L"%d,%d,%d", r, g, b), false, - false); + pNode->JSObject()->SetCData(XFA_Attribute::Value, + WideString::Format(L"%d,%d,%d", r, g, b), false, + false); } XFA_AttributeEnum CXFA_StrokeData::GetJoinType() const { - return m_pNode ? m_pNode->JSNode()->GetEnum(XFA_Attribute::Join) + return m_pNode ? m_pNode->JSObject()->GetEnum(XFA_Attribute::Join) : XFA_AttributeEnum::Square; } bool CXFA_StrokeData::IsInverted() const { - return m_pNode ? m_pNode->JSNode()->GetBoolean(XFA_Attribute::Inverted) + return m_pNode ? m_pNode->JSObject()->GetBoolean(XFA_Attribute::Inverted) : false; } float CXFA_StrokeData::GetRadius() const { - return m_pNode ? m_pNode->JSNode() + return m_pNode ? m_pNode->JSObject() ->TryMeasure(XFA_Attribute::Radius, true) .value_or(CXFA_Measurement(0, XFA_Unit::In)) .ToUnit(XFA_Unit::Pt) diff --git a/xfa/fxfa/parser/cxfa_submitdata.cpp b/xfa/fxfa/parser/cxfa_submitdata.cpp index 91c88dd39c..20dce38652 100644 --- a/xfa/fxfa/parser/cxfa_submitdata.cpp +++ b/xfa/fxfa/parser/cxfa_submitdata.cpp @@ -11,17 +11,17 @@ CXFA_SubmitData::CXFA_SubmitData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} bool CXFA_SubmitData::IsSubmitEmbedPDF() const { - return m_pNode->JSNode()->GetBoolean(XFA_Attribute::EmbedPDF); + return m_pNode->JSObject()->GetBoolean(XFA_Attribute::EmbedPDF); } XFA_AttributeEnum CXFA_SubmitData::GetSubmitFormat() const { - return m_pNode->JSNode()->GetEnum(XFA_Attribute::Format); + return m_pNode->JSObject()->GetEnum(XFA_Attribute::Format); } WideString CXFA_SubmitData::GetSubmitTarget() const { - return m_pNode->JSNode()->GetCData(XFA_Attribute::Target); + return m_pNode->JSObject()->GetCData(XFA_Attribute::Target); } WideString CXFA_SubmitData::GetSubmitXDPContent() const { - return m_pNode->JSNode()->GetCData(XFA_Attribute::XdpContent); + return m_pNode->JSObject()->GetCData(XFA_Attribute::XdpContent); } diff --git a/xfa/fxfa/parser/cxfa_textdata.cpp b/xfa/fxfa/parser/cxfa_textdata.cpp index a042853c6e..2ce6c0368e 100644 --- a/xfa/fxfa/parser/cxfa_textdata.cpp +++ b/xfa/fxfa/parser/cxfa_textdata.cpp @@ -11,5 +11,5 @@ CXFA_TextData::CXFA_TextData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} WideString CXFA_TextData::GetContent() const { - return m_pNode->JSNode()->GetContent(false); + return m_pNode->JSObject()->GetContent(false); } diff --git a/xfa/fxfa/parser/cxfa_treelist.h b/xfa/fxfa/parser/cxfa_treelist.h index 890fc89507..3c65ca5963 100644 --- a/xfa/fxfa/parser/cxfa_treelist.h +++ b/xfa/fxfa/parser/cxfa_treelist.h @@ -18,8 +18,6 @@ class CXFA_TreeList : public CXFA_List { explicit CXFA_TreeList(CXFA_Document* pDocument); ~CXFA_TreeList() override; - CJX_TreeList* JSNodeList() { return static_cast<CJX_TreeList*>(JSObject()); } - CXFA_Node* NamedItem(const WideStringView& wsName); }; diff --git a/xfa/fxfa/parser/cxfa_validatedata.cpp b/xfa/fxfa/parser/cxfa_validatedata.cpp index 3f7ce1705a..934edba764 100644 --- a/xfa/fxfa/parser/cxfa_validatedata.cpp +++ b/xfa/fxfa/parser/cxfa_validatedata.cpp @@ -20,28 +20,29 @@ constexpr wchar_t kScriptTest[] = L"scriptTest"; CXFA_ValidateData::CXFA_ValidateData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} XFA_AttributeEnum CXFA_ValidateData::GetFormatTest() const { - return m_pNode->JSNode()->GetEnum(XFA_Attribute::FormatTest); + return m_pNode->JSObject()->GetEnum(XFA_Attribute::FormatTest); } void CXFA_ValidateData::SetNullTest(const WideString& wsValue) { pdfium::Optional<XFA_AttributeEnum> item = CXFA_Node::NameToAttributeEnum(wsValue.AsStringView()); - m_pNode->JSNode()->SetEnum(XFA_Attribute::NullTest, - item ? *item : XFA_AttributeEnum::Disabled, false); + m_pNode->JSObject()->SetEnum(XFA_Attribute::NullTest, + item ? *item : XFA_AttributeEnum::Disabled, + false); } XFA_AttributeEnum CXFA_ValidateData::GetNullTest() const { - return m_pNode->JSNode()->GetEnum(XFA_Attribute::NullTest); + return m_pNode->JSObject()->GetEnum(XFA_Attribute::NullTest); } XFA_AttributeEnum CXFA_ValidateData::GetScriptTest() const { - return m_pNode->JSNode()->GetEnum(XFA_Attribute::ScriptTest); + return m_pNode->JSObject()->GetEnum(XFA_Attribute::ScriptTest); } WideString CXFA_ValidateData::GetMessageText( const WideString& wsMessageType) const { CXFA_Node* pNode = - m_pNode->JSNode()->GetProperty(0, XFA_Element::Message, false); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Message, false); if (!pNode) return L""; @@ -51,9 +52,9 @@ WideString CXFA_ValidateData::GetMessageText( if (pItemNode->GetElementType() != XFA_Element::Text) continue; - WideString wsName = pItemNode->JSNode()->GetCData(XFA_Attribute::Name); + WideString wsName = pItemNode->JSObject()->GetCData(XFA_Attribute::Name); if (wsName.IsEmpty() || wsName == wsMessageType) - return pItemNode->JSNode()->GetContent(false); + return pItemNode->JSObject()->GetContent(false); } return L""; } @@ -85,7 +86,7 @@ void CXFA_ValidateData::SetScriptMessageText(const WideString& wsMessage) { void CXFA_ValidateData::SetMessageText(const WideString& wsMessageType, const WideString& wsMessage) { CXFA_Node* pNode = - m_pNode->JSNode()->GetProperty(0, XFA_Element::Message, true); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Message, true); if (!pNode) return; @@ -95,24 +96,25 @@ void CXFA_ValidateData::SetMessageText(const WideString& wsMessageType, if (pItemNode->GetElementType() != XFA_Element::Text) continue; - WideString wsName = pItemNode->JSNode()->GetCData(XFA_Attribute::Name); + WideString wsName = pItemNode->JSObject()->GetCData(XFA_Attribute::Name); if (wsName.IsEmpty() || wsName == wsMessageType) { - pItemNode->JSNode()->SetContent(wsMessage, wsMessage, false, false, true); + pItemNode->JSObject()->SetContent(wsMessage, wsMessage, false, false, + true); return; } } CXFA_Node* pTextNode = pNode->CreateSamePacketNode(XFA_Element::Text); pNode->InsertChild(pTextNode, nullptr); - pTextNode->JSNode()->SetCData(XFA_Attribute::Name, wsMessageType, false, - false); - pTextNode->JSNode()->SetContent(wsMessage, wsMessage, false, false, true); + pTextNode->JSObject()->SetCData(XFA_Attribute::Name, wsMessageType, false, + false); + pTextNode->JSObject()->SetContent(wsMessage, wsMessage, false, false, true); } WideString CXFA_ValidateData::GetPicture() const { CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Picture, false); if (pNode) - return pNode->JSNode()->GetContent(false); + return pNode->JSObject()->GetContent(false); return L""; } diff --git a/xfa/fxfa/parser/cxfa_valuedata.cpp b/xfa/fxfa/parser/cxfa_valuedata.cpp index d0f86a8b23..c88af7a422 100644 --- a/xfa/fxfa/parser/cxfa_valuedata.cpp +++ b/xfa/fxfa/parser/cxfa_valuedata.cpp @@ -24,7 +24,7 @@ WideString CXFA_ValueData::GetChildValueContent() const { if (!pNode) return L""; - return pNode->JSNode()->TryContent(false, true).value_or(L""); + return pNode->JSObject()->TryContent(false, true).value_or(L""); } CXFA_ArcData CXFA_ValueData::GetArcData() const { diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index d147bd97ef..4ba6b418de 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -69,7 +69,7 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { eWidgetType = XFA_Element::Unknown; XFA_Element eUIType = XFA_Element::Unknown; CXFA_ValueData defValueData( - pNode->JSNode()->GetProperty(0, XFA_Element::Value, true)); + pNode->JSObject()->GetProperty(0, XFA_Element::Value, true)); XFA_Element eValueType = defValueData.GetChildValueClassID(); switch (eValueType) { case XFA_Element::Boolean: @@ -105,7 +105,7 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { } CXFA_Node* pUIChild = nullptr; - CXFA_Node* pUI = pNode->JSNode()->GetProperty(0, XFA_Element::Ui, true); + CXFA_Node* pUI = pNode->JSObject()->GetProperty(0, XFA_Element::Ui, true); CXFA_Node* pChild = pUI->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { XFA_Element eChildType = pChild->GetElementType(); @@ -151,9 +151,10 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { if (!pUIChild) { if (eUIType == XFA_Element::Unknown) { eUIType = XFA_Element::TextEdit; - defValueData.GetNode()->JSNode()->GetProperty(0, XFA_Element::Text, true); + defValueData.GetNode()->JSObject()->GetProperty(0, XFA_Element::Text, + true); } - return pUI->JSNode()->GetProperty(0, eUIType, true); + return pUI->JSObject()->GetProperty(0, eUIType, true); } if (eUIType != XFA_Element::Unknown) @@ -178,7 +179,7 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { eValueType = XFA_Element::Float; break; case XFA_Element::ChoiceList: { - eValueType = (pUIChild->JSNode()->GetEnum(XFA_Attribute::Open) == + eValueType = (pUIChild->JSObject()->GetEnum(XFA_Attribute::Open) == XFA_AttributeEnum::MultiSelect) ? XFA_Element::ExData : XFA_Element::Text; @@ -193,7 +194,7 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { eValueType = XFA_Element::Text; break; } - defValueData.GetNode()->JSNode()->GetProperty(0, eValueType, true); + defValueData.GetNode()->JSObject()->GetProperty(0, eValueType, true); return pUIChild; } @@ -220,14 +221,14 @@ XFA_Element CXFA_WidgetData::GetUIType() { } WideString CXFA_WidgetData::GetRawValue() const { - return m_pNode->JSNode()->GetContent(false); + return m_pNode->JSObject()->GetContent(false); } bool CXFA_WidgetData::IsOpenAccess() const { for (CXFA_Node* pNode = m_pNode; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode)) { - XFA_AttributeEnum iAcc = pNode->JSNode()->GetEnum(XFA_Attribute::Access); + XFA_AttributeEnum iAcc = pNode->JSObject()->GetEnum(XFA_Attribute::Access); if (iAcc != XFA_AttributeEnum::Open) return false; } @@ -236,33 +237,33 @@ bool CXFA_WidgetData::IsOpenAccess() const { int32_t CXFA_WidgetData::GetRotate() const { pdfium::Optional<int32_t> degrees = - m_pNode->JSNode()->TryInteger(XFA_Attribute::Rotate, false); + m_pNode->JSObject()->TryInteger(XFA_Attribute::Rotate, false); return degrees ? XFA_MapRotation(*degrees) / 90 * 90 : 0; } CXFA_BorderData CXFA_WidgetData::GetBorderData(bool bModified) { return CXFA_BorderData( - m_pNode->JSNode()->GetProperty(0, XFA_Element::Border, bModified)); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Border, bModified)); } CXFA_CaptionData CXFA_WidgetData::GetCaptionData() { return CXFA_CaptionData( - m_pNode->JSNode()->GetProperty(0, XFA_Element::Caption, false)); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Caption, false)); } CXFA_FontData CXFA_WidgetData::GetFontData(bool bModified) { return CXFA_FontData( - m_pNode->JSNode()->GetProperty(0, XFA_Element::Font, bModified)); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Font, bModified)); } CXFA_MarginData CXFA_WidgetData::GetMarginData() { return CXFA_MarginData( - m_pNode->JSNode()->GetProperty(0, XFA_Element::Margin, false)); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Margin, false)); } CXFA_ParaData CXFA_WidgetData::GetParaData() { return CXFA_ParaData( - m_pNode->JSNode()->GetProperty(0, XFA_Element::Para, false)); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Para, false)); } std::vector<CXFA_Node*> CXFA_WidgetData::GetEventList() { @@ -296,28 +297,28 @@ std::vector<CXFA_Node*> CXFA_WidgetData::GetEventByActivity( CXFA_ValueData CXFA_WidgetData::GetDefaultValueData() { CXFA_Node* pTemNode = m_pNode->GetTemplateNode(); return CXFA_ValueData( - pTemNode ? pTemNode->JSNode()->GetProperty(0, XFA_Element::Value, false) + pTemNode ? pTemNode->JSObject()->GetProperty(0, XFA_Element::Value, false) : nullptr); } CXFA_ValueData CXFA_WidgetData::GetFormValueData() { return CXFA_ValueData( - m_pNode->JSNode()->GetProperty(0, XFA_Element::Value, false)); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Value, false)); } CXFA_CalculateData CXFA_WidgetData::GetCalculateData() { return CXFA_CalculateData( - m_pNode->JSNode()->GetProperty(0, XFA_Element::Calculate, false)); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Calculate, false)); } CXFA_ValidateData CXFA_WidgetData::GetValidateData(bool bModified) { return CXFA_ValidateData( - m_pNode->JSNode()->GetProperty(0, XFA_Element::Validate, bModified)); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Validate, bModified)); } CXFA_BindData CXFA_WidgetData::GetBindData() { return CXFA_BindData( - m_pNode->JSNode()->GetProperty(0, XFA_Element::Bind, false)); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Bind, false)); } pdfium::Optional<float> CXFA_WidgetData::TryWidth() { @@ -346,16 +347,17 @@ pdfium::Optional<float> CXFA_WidgetData::TryMaxHeight() { CXFA_BorderData CXFA_WidgetData::GetUIBorderData() { CXFA_Node* pUIChild = GetUIChild(); - return CXFA_BorderData( - pUIChild ? pUIChild->JSNode()->GetProperty(0, XFA_Element::Border, false) - : nullptr); + return CXFA_BorderData(pUIChild ? pUIChild->JSObject()->GetProperty( + 0, XFA_Element::Border, false) + : nullptr); } CFX_RectF CXFA_WidgetData::GetUIMargin() { CXFA_Node* pUIChild = GetUIChild(); - CXFA_MarginData mgUI = CXFA_MarginData( - pUIChild ? pUIChild->JSNode()->GetProperty(0, XFA_Element::Margin, false) - : nullptr); + CXFA_MarginData mgUI = + CXFA_MarginData(pUIChild ? pUIChild->JSObject()->GetProperty( + 0, XFA_Element::Margin, false) + : nullptr); if (!mgUI.HasValidNode()) return CFX_RectF(); @@ -394,7 +396,7 @@ CFX_RectF CXFA_WidgetData::GetUIMargin() { XFA_AttributeEnum CXFA_WidgetData::GetButtonHighlight() { CXFA_Node* pUIChild = GetUIChild(); if (pUIChild) - return pUIChild->JSNode()->GetEnum(XFA_Attribute::Highlight); + return pUIChild->JSObject()->GetEnum(XFA_Attribute::Highlight); return XFA_AttributeEnum::Inverted; } @@ -405,8 +407,8 @@ bool CXFA_WidgetData::HasButtonRollover() const { for (CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); pText; pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pText->JSNode()->GetCData(XFA_Attribute::Name) == L"rollover") - return !pText->JSNode()->GetContent(false).IsEmpty(); + if (pText->JSObject()->GetCData(XFA_Attribute::Name) == L"rollover") + return !pText->JSObject()->GetContent(false).IsEmpty(); } return false; } @@ -418,8 +420,8 @@ bool CXFA_WidgetData::HasButtonDown() const { for (CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); pText; pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pText->JSNode()->GetCData(XFA_Attribute::Name) == L"down") - return !pText->JSNode()->GetContent(false).IsEmpty(); + if (pText->JSObject()->GetCData(XFA_Attribute::Name) == L"down") + return !pText->JSObject()->GetContent(false).IsEmpty(); } return false; } @@ -427,7 +429,7 @@ bool CXFA_WidgetData::HasButtonDown() const { bool CXFA_WidgetData::IsCheckButtonRound() { CXFA_Node* pUIChild = GetUIChild(); if (pUIChild) - return pUIChild->JSNode()->GetEnum(XFA_Attribute::Shape) == + return pUIChild->JSObject()->GetEnum(XFA_Attribute::Shape) == XFA_AttributeEnum::Round; return false; } @@ -435,7 +437,7 @@ bool CXFA_WidgetData::IsCheckButtonRound() { XFA_AttributeEnum CXFA_WidgetData::GetCheckButtonMark() { CXFA_Node* pUIChild = GetUIChild(); if (pUIChild) - return pUIChild->JSNode()->GetEnum(XFA_Attribute::Mark); + return pUIChild->JSObject()->GetEnum(XFA_Attribute::Mark); return XFA_AttributeEnum::Default; } @@ -447,7 +449,7 @@ bool CXFA_WidgetData::IsRadioButton() { float CXFA_WidgetData::GetCheckButtonSize() { CXFA_Node* pUIChild = GetUIChild(); if (pUIChild) { - return pUIChild->JSNode() + return pUIChild->JSObject() ->GetMeasure(XFA_Attribute::Size) .ToUnit(XFA_Unit::Pt); } @@ -457,7 +459,7 @@ float CXFA_WidgetData::GetCheckButtonSize() { bool CXFA_WidgetData::IsAllowNeutral() { CXFA_Node* pUIChild = GetUIChild(); return pUIChild && - pUIChild->JSNode()->GetBoolean(XFA_Attribute::AllowNeutral); + pUIChild->JSObject()->GetBoolean(XFA_Attribute::AllowNeutral); } XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() { @@ -470,7 +472,7 @@ XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() { int32_t i = 0; while (pText) { pdfium::Optional<WideString> wsContent = - pText->JSNode()->TryContent(false, true); + pText->JSObject()->TryContent(false, true); if (wsContent && *wsContent == wsValue) return static_cast<XFA_CHECKSTATE>(i); @@ -489,7 +491,7 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { if (CXFA_Node* pItems = m_pNode->GetChild(0, XFA_Element::Items, false)) { CXFA_Node* pText = pItems->GetNodeItem(XFA_NODEITEM_FirstChild); if (pText) - wsValue = pText->JSNode()->GetContent(false); + wsValue = pText->JSObject()->GetContent(false); } } CXFA_Node* pChild = @@ -506,12 +508,12 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { if (!pItemchild) continue; - WideString text = pItemchild->JSNode()->GetContent(false); + WideString text = pItemchild->JSObject()->GetContent(false); WideString wsChildValue = text; if (wsValue != text) { pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling); if (pItemchild) - wsChildValue = pItemchild->JSNode()->GetContent(false); + wsChildValue = pItemchild->JSObject()->GetContent(false); else wsChildValue.clear(); } @@ -530,7 +532,7 @@ void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) { while (pText) { i++; if (i == eCheckState) { - wsContent = pText->JSNode()->GetContent(false); + wsContent = pText->JSObject()->GetContent(false); break; } pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); @@ -595,22 +597,22 @@ void CXFA_WidgetData::SetSelectedMemberByValue(const WideStringView& wsValue, if (!pItemchild) continue; - WideString wsChildValue = pItemchild->JSNode()->GetContent(false); + WideString wsChildValue = pItemchild->JSObject()->GetContent(false); if (wsValue != wsChildValue) { pItemchild = pItemchild->GetNodeItem(XFA_NODEITEM_NextSibling); if (pItemchild) - wsChildValue = pItemchild->JSNode()->GetContent(false); + wsChildValue = pItemchild->JSObject()->GetContent(false); else wsChildValue.clear(); } else { wsExclGroup = wsValue; } - pNode->JSNode()->SetContent(wsChildValue, wsChildValue, bNotify, - bScriptModify, false); + pNode->JSObject()->SetContent(wsChildValue, wsChildValue, bNotify, + bScriptModify, false); } if (m_pNode) { - m_pNode->JSNode()->SetContent(wsExclGroup, wsExclGroup, bNotify, - bScriptModify, bSyncData); + m_pNode->JSObject()->SetContent(wsExclGroup, wsExclGroup, bNotify, + bScriptModify, bSyncData); } } @@ -645,7 +647,7 @@ CXFA_Node* CXFA_WidgetData::GetExclGroupNextMember(CXFA_Node* pNode) { bool CXFA_WidgetData::IsChoiceListCommitOnSelect() { CXFA_Node* pUIChild = GetUIChild(); if (pUIChild) { - return pUIChild->JSNode()->GetEnum(XFA_Attribute::CommitOn) == + return pUIChild->JSObject()->GetEnum(XFA_Attribute::CommitOn) == XFA_AttributeEnum::Select; } return true; @@ -653,13 +655,13 @@ bool CXFA_WidgetData::IsChoiceListCommitOnSelect() { bool CXFA_WidgetData::IsChoiceListAllowTextEntry() { CXFA_Node* pUIChild = GetUIChild(); - return pUIChild && pUIChild->JSNode()->GetBoolean(XFA_Attribute::TextEntry); + return pUIChild && pUIChild->JSObject()->GetBoolean(XFA_Attribute::TextEntry); } bool CXFA_WidgetData::IsChoiceListMultiSelect() { CXFA_Node* pUIChild = GetUIChild(); if (pUIChild) { - return pUIChild->JSNode()->GetEnum(XFA_Attribute::Open) == + return pUIChild->JSObject()->GetEnum(XFA_Attribute::Open) == XFA_AttributeEnum::MultiSelect; } return false; @@ -670,7 +672,7 @@ bool CXFA_WidgetData::IsListBox() { if (!pUIChild) return false; - XFA_AttributeEnum attr = pUIChild->JSNode()->GetEnum(XFA_Attribute::Open); + XFA_AttributeEnum attr = pUIChild->JSObject()->GetEnum(XFA_Attribute::Open); return attr == XFA_AttributeEnum::Always || attr == XFA_AttributeEnum::MultiSelect; } @@ -692,8 +694,10 @@ int32_t CXFA_WidgetData::CountChoiceListItems(bool bSaveValue) { CXFA_Node* pItem = pItems[0]; if (iCount > 1) { - bool bItemOneHasSave = pItems[0]->JSNode()->GetBoolean(XFA_Attribute::Save); - bool bItemTwoHasSave = pItems[1]->JSNode()->GetBoolean(XFA_Attribute::Save); + bool bItemOneHasSave = + pItems[0]->JSObject()->GetBoolean(XFA_Attribute::Save); + bool bItemTwoHasSave = + pItems[1]->JSObject()->GetBoolean(XFA_Attribute::Save); if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave) pItem = pItems[1]; } @@ -721,9 +725,9 @@ pdfium::Optional<WideString> CXFA_WidgetData::GetChoiceListItem( CXFA_Node* pItems = pItemsArray[0]; if (iCount > 1) { bool bItemOneHasSave = - pItemsArray[0]->JSNode()->GetBoolean(XFA_Attribute::Save); + pItemsArray[0]->JSObject()->GetBoolean(XFA_Attribute::Save); bool bItemTwoHasSave = - pItemsArray[1]->JSNode()->GetBoolean(XFA_Attribute::Save); + pItemsArray[1]->JSObject()->GetBoolean(XFA_Attribute::Save); if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave) pItems = pItemsArray[1]; } @@ -732,7 +736,7 @@ pdfium::Optional<WideString> CXFA_WidgetData::GetChoiceListItem( CXFA_Node* pItem = pItems->GetChild(nIndex, XFA_Element::Unknown, false); if (pItem) - return {pItem->JSNode()->GetContent(false)}; + return {pItem->JSObject()->GetContent(false)}; return {}; } @@ -749,8 +753,10 @@ std::vector<WideString> CXFA_WidgetData::GetChoiceListItems(bool bSaveValue) { CXFA_Node* pItem = items.front(); if (items.size() > 1) { - bool bItemOneHasSave = items[0]->JSNode()->GetBoolean(XFA_Attribute::Save); - bool bItemTwoHasSave = items[1]->JSNode()->GetBoolean(XFA_Attribute::Save); + bool bItemOneHasSave = + items[0]->JSObject()->GetBoolean(XFA_Attribute::Save); + bool bItemTwoHasSave = + items[1]->JSObject()->GetBoolean(XFA_Attribute::Save); if (bItemOneHasSave != bItemTwoHasSave && bSaveValue == bItemTwoHasSave) pItem = items[1]; } @@ -758,7 +764,7 @@ std::vector<WideString> CXFA_WidgetData::GetChoiceListItems(bool bSaveValue) { std::vector<WideString> wsTextArray; for (CXFA_Node* pNode = pItem->GetNodeItem(XFA_NODEITEM_FirstChild); pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - wsTextArray.emplace_back(pNode->JSNode()->GetContent(false)); + wsTextArray.emplace_back(pNode->JSObject()->GetContent(false)); } return wsTextArray; } @@ -856,8 +862,8 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex, wsValue += L"\n"; } wsValue += wsSaveTextArray[nIndex]; - m_pNode->JSNode()->SetContent(wsValue, wsValue, bNotify, bScriptModify, - bSyncData); + m_pNode->JSObject()->SetContent(wsValue, wsValue, bNotify, + bScriptModify, bSyncData); } } else if (iSel >= 0) { std::vector<int32_t> iSelArray = GetSelectedItems(); @@ -870,13 +876,13 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex, if (bSelected) { if (iSel < 0) { WideString wsSaveText = wsSaveTextArray[nIndex]; - m_pNode->JSNode()->SetContent(wsSaveText, - GetFormatDataValue(wsSaveText), bNotify, - bScriptModify, bSyncData); + m_pNode->JSObject()->SetContent(wsSaveText, + GetFormatDataValue(wsSaveText), bNotify, + bScriptModify, bSyncData); } } else if (iSel >= 0) { - m_pNode->JSNode()->SetContent(WideString(), WideString(), bNotify, - bScriptModify, bSyncData); + m_pNode->JSObject()->SetContent(WideString(), WideString(), bNotify, + bScriptModify, bSyncData); } } } @@ -900,8 +906,8 @@ void CXFA_WidgetData::SetSelectedItems(const std::vector<int32_t>& iSelArray, if (!IsChoiceListMultiSelect()) wsFormat = GetFormatDataValue(wsValue); - m_pNode->JSNode()->SetContent(wsValue, wsFormat, bNotify, bScriptModify, - bSyncData); + m_pNode->JSObject()->SetContent(wsValue, wsFormat, bNotify, bScriptModify, + bSyncData); } void CXFA_WidgetData::ClearAllSelections() { @@ -935,12 +941,12 @@ void CXFA_WidgetData::InsertItem(const WideString& wsLabel, InsertListTextItem(pItems, wsLabel, nIndex); CXFA_Node* pSaveItems = m_pNode->CreateSamePacketNode(XFA_Element::Items); m_pNode->InsertChild(-1, pSaveItems); - pSaveItems->JSNode()->SetBoolean(XFA_Attribute::Save, true, false); + pSaveItems->JSObject()->SetBoolean(XFA_Attribute::Save, true, false); InsertListTextItem(pSaveItems, wsNewValue, nIndex); } else if (listitems.size() > 1) { for (int32_t i = 0; i < 2; i++) { CXFA_Node* pNode = listitems[i]; - bool bHasSave = pNode->JSNode()->GetBoolean(XFA_Attribute::Save); + bool bHasSave = pNode->JSObject()->GetBoolean(XFA_Attribute::Save); if (bHasSave) InsertListTextItem(pNode, wsNewValue, nIndex); else @@ -948,18 +954,19 @@ void CXFA_WidgetData::InsertItem(const WideString& wsLabel, } } else { CXFA_Node* pNode = listitems[0]; - pNode->JSNode()->SetBoolean(XFA_Attribute::Save, false, false); - pNode->JSNode()->SetEnum(XFA_Attribute::Presence, - XFA_AttributeEnum::Visible, false); + pNode->JSObject()->SetBoolean(XFA_Attribute::Save, false, false); + pNode->JSObject()->SetEnum(XFA_Attribute::Presence, + XFA_AttributeEnum::Visible, false); CXFA_Node* pSaveItems = m_pNode->CreateSamePacketNode(XFA_Element::Items); m_pNode->InsertChild(-1, pSaveItems); - pSaveItems->JSNode()->SetBoolean(XFA_Attribute::Save, true, false); - pSaveItems->JSNode()->SetEnum(XFA_Attribute::Presence, - XFA_AttributeEnum::Hidden, false); + pSaveItems->JSObject()->SetBoolean(XFA_Attribute::Save, true, false); + pSaveItems->JSObject()->SetEnum(XFA_Attribute::Presence, + XFA_AttributeEnum::Hidden, false); CXFA_Node* pListNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); int32_t i = 0; while (pListNode) { - InsertListTextItem(pSaveItems, pListNode->JSNode()->GetContent(false), i); + InsertListTextItem(pSaveItems, pListNode->JSObject()->GetContent(false), + i); ++i; pListNode = pListNode->GetNodeItem(XFA_NODEITEM_NextSibling); @@ -992,7 +999,7 @@ void CXFA_WidgetData::GetItemLabel(const WideStringView& wsValue, } CXFA_Node* pLabelItems = listitems[0]; - bool bSave = pLabelItems->JSNode()->GetBoolean(XFA_Attribute::Save); + bool bSave = pLabelItems->JSObject()->GetBoolean(XFA_Attribute::Save); CXFA_Node* pSaveItems = nullptr; if (bSave) { pSaveItems = pLabelItems; @@ -1006,7 +1013,7 @@ void CXFA_WidgetData::GetItemLabel(const WideStringView& wsValue, for (CXFA_Node* pChildItem = pSaveItems->GetNodeItem(XFA_NODEITEM_FirstChild); pChildItem; pChildItem = pChildItem->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pChildItem->JSNode()->GetContent(false) == wsValue) { + if (pChildItem->JSObject()->GetContent(false) == wsValue) { iSearch = iCount; break; } @@ -1018,7 +1025,7 @@ void CXFA_WidgetData::GetItemLabel(const WideStringView& wsValue, CXFA_Node* pText = pLabelItems->GetChild(iSearch, XFA_Element::Unknown, false); if (pText) - wsLabel = pText->JSNode()->GetContent(false); + wsLabel = pText->JSObject()->GetContent(false); } WideString CXFA_WidgetData::GetItemValue(const WideStringView& wsLabel) { @@ -1035,7 +1042,7 @@ WideString CXFA_WidgetData::GetItemValue(const WideStringView& wsLabel) { return WideString(wsLabel); CXFA_Node* pLabelItems = listitems[0]; - bool bSave = pLabelItems->JSNode()->GetBoolean(XFA_Attribute::Save); + bool bSave = pLabelItems->JSObject()->GetBoolean(XFA_Attribute::Save); CXFA_Node* pSaveItems = nullptr; if (bSave) { pSaveItems = pLabelItems; @@ -1050,7 +1057,7 @@ WideString CXFA_WidgetData::GetItemValue(const WideStringView& wsLabel) { CXFA_Node* pChildItem = pLabelItems->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pChildItem; pChildItem = pChildItem->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pChildItem->JSNode()->GetContent(false) == wsLabel) { + if (pChildItem->JSObject()->GetContent(false) == wsLabel) { iSearch = iCount; break; } @@ -1060,7 +1067,7 @@ WideString CXFA_WidgetData::GetItemValue(const WideStringView& wsLabel) { return L""; CXFA_Node* pText = pSaveItems->GetChild(iSearch, XFA_Element::Unknown, false); - return pText ? pText->JSNode()->GetContent(false) : L""; + return pText ? pText->JSObject()->GetContent(false) : L""; } bool CXFA_WidgetData::DeleteItem(int32_t nIndex, @@ -1077,7 +1084,7 @@ bool CXFA_WidgetData::DeleteItem(int32_t nIndex, pItems->RemoveChild(pNode, true); } } else { - if (!bSetValue && pItems->JSNode()->GetBoolean(XFA_Attribute::Save)) { + if (!bSetValue && pItems->JSObject()->GetBoolean(XFA_Attribute::Save)) { SetItemState(nIndex, false, true, bScriptModify, true); bSetValue = true; } @@ -1101,7 +1108,7 @@ bool CXFA_WidgetData::DeleteItem(int32_t nIndex, bool CXFA_WidgetData::IsHorizontalScrollPolicyOff() { CXFA_Node* pUIChild = GetUIChild(); if (pUIChild) { - return pUIChild->JSNode()->GetEnum(XFA_Attribute::HScrollPolicy) == + return pUIChild->JSObject()->GetEnum(XFA_Attribute::HScrollPolicy) == XFA_AttributeEnum::Off; } return false; @@ -1110,7 +1117,7 @@ bool CXFA_WidgetData::IsHorizontalScrollPolicyOff() { bool CXFA_WidgetData::IsVerticalScrollPolicyOff() { CXFA_Node* pUIChild = GetUIChild(); if (pUIChild) { - return pUIChild->JSNode()->GetEnum(XFA_Attribute::VScrollPolicy) == + return pUIChild->JSObject()->GetEnum(XFA_Attribute::VScrollPolicy) == XFA_AttributeEnum::Off; } return false; @@ -1121,21 +1128,21 @@ pdfium::Optional<int32_t> CXFA_WidgetData::GetNumberOfCells() { if (!pUIChild) return {}; if (CXFA_Node* pNode = pUIChild->GetChild(0, XFA_Element::Comb, false)) - return {pNode->JSNode()->GetInteger(XFA_Attribute::NumberOfCells)}; + return {pNode->JSObject()->GetInteger(XFA_Attribute::NumberOfCells)}; return {}; } WideString CXFA_WidgetData::GetBarcodeType() { CXFA_Node* pUIChild = GetUIChild(); return pUIChild - ? WideString(pUIChild->JSNode()->GetCData(XFA_Attribute::Type)) + ? WideString(pUIChild->JSObject()->GetCData(XFA_Attribute::Type)) : WideString(); } pdfium::Optional<BC_CHAR_ENCODING> CXFA_WidgetData::GetBarcodeAttribute_CharEncoding() { pdfium::Optional<WideString> wsCharEncoding = - GetUIChild()->JSNode()->TryCData(XFA_Attribute::CharEncoding, true); + GetUIChild()->JSObject()->TryCData(XFA_Attribute::CharEncoding, true); if (!wsCharEncoding) return {}; if (wsCharEncoding->CompareNoCase(L"UTF-16")) @@ -1147,7 +1154,7 @@ CXFA_WidgetData::GetBarcodeAttribute_CharEncoding() { pdfium::Optional<bool> CXFA_WidgetData::GetBarcodeAttribute_Checksum() { pdfium::Optional<XFA_AttributeEnum> checksum = - GetUIChild()->JSNode()->TryEnum(XFA_Attribute::Checksum, true); + GetUIChild()->JSObject()->TryEnum(XFA_Attribute::Checksum, true); if (!checksum) return {}; @@ -1167,7 +1174,7 @@ pdfium::Optional<bool> CXFA_WidgetData::GetBarcodeAttribute_Checksum() { pdfium::Optional<int32_t> CXFA_WidgetData::GetBarcodeAttribute_DataLength() { pdfium::Optional<WideString> wsDataLength = - GetUIChild()->JSNode()->TryCData(XFA_Attribute::DataLength, true); + GetUIChild()->JSObject()->TryCData(XFA_Attribute::DataLength, true); if (!wsDataLength) return {}; @@ -1176,7 +1183,7 @@ pdfium::Optional<int32_t> CXFA_WidgetData::GetBarcodeAttribute_DataLength() { pdfium::Optional<char> CXFA_WidgetData::GetBarcodeAttribute_StartChar() { pdfium::Optional<WideString> wsStartEndChar = - GetUIChild()->JSNode()->TryCData(XFA_Attribute::StartChar, true); + GetUIChild()->JSObject()->TryCData(XFA_Attribute::StartChar, true); if (!wsStartEndChar || wsStartEndChar->IsEmpty()) return {}; @@ -1185,7 +1192,7 @@ pdfium::Optional<char> CXFA_WidgetData::GetBarcodeAttribute_StartChar() { pdfium::Optional<char> CXFA_WidgetData::GetBarcodeAttribute_EndChar() { pdfium::Optional<WideString> wsStartEndChar = - GetUIChild()->JSNode()->TryCData(XFA_Attribute::EndChar, true); + GetUIChild()->JSObject()->TryCData(XFA_Attribute::EndChar, true); if (!wsStartEndChar || wsStartEndChar->IsEmpty()) return {}; @@ -1193,7 +1200,7 @@ pdfium::Optional<char> CXFA_WidgetData::GetBarcodeAttribute_EndChar() { } pdfium::Optional<int32_t> CXFA_WidgetData::GetBarcodeAttribute_ECLevel() { - pdfium::Optional<WideString> wsECLevel = GetUIChild()->JSNode()->TryCData( + pdfium::Optional<WideString> wsECLevel = GetUIChild()->JSObject()->TryCData( XFA_Attribute::ErrorCorrectionLevel, true); if (!wsECLevel) return {}; @@ -1202,7 +1209,7 @@ pdfium::Optional<int32_t> CXFA_WidgetData::GetBarcodeAttribute_ECLevel() { pdfium::Optional<int32_t> CXFA_WidgetData::GetBarcodeAttribute_ModuleWidth() { pdfium::Optional<CXFA_Measurement> moduleWidthHeight = - GetUIChild()->JSNode()->TryMeasure(XFA_Attribute::ModuleWidth, true); + GetUIChild()->JSObject()->TryMeasure(XFA_Attribute::ModuleWidth, true); if (!moduleWidthHeight) return {}; @@ -1211,7 +1218,7 @@ pdfium::Optional<int32_t> CXFA_WidgetData::GetBarcodeAttribute_ModuleWidth() { pdfium::Optional<int32_t> CXFA_WidgetData::GetBarcodeAttribute_ModuleHeight() { pdfium::Optional<CXFA_Measurement> moduleWidthHeight = - GetUIChild()->JSNode()->TryMeasure(XFA_Attribute::ModuleHeight, true); + GetUIChild()->JSObject()->TryMeasure(XFA_Attribute::ModuleHeight, true); if (!moduleWidthHeight) return {}; @@ -1219,14 +1226,14 @@ pdfium::Optional<int32_t> CXFA_WidgetData::GetBarcodeAttribute_ModuleHeight() { } pdfium::Optional<bool> CXFA_WidgetData::GetBarcodeAttribute_PrintChecksum() { - return GetUIChild()->JSNode()->TryBoolean(XFA_Attribute::PrintCheckDigit, - true); + return GetUIChild()->JSObject()->TryBoolean(XFA_Attribute::PrintCheckDigit, + true); } pdfium::Optional<BC_TEXT_LOC> CXFA_WidgetData::GetBarcodeAttribute_TextLocation() { pdfium::Optional<XFA_AttributeEnum> textLocation = - GetUIChild()->JSNode()->TryEnum(XFA_Attribute::TextLocation, true); + GetUIChild()->JSObject()->TryEnum(XFA_Attribute::TextLocation, true); if (!textLocation) return {}; @@ -1248,13 +1255,13 @@ CXFA_WidgetData::GetBarcodeAttribute_TextLocation() { } pdfium::Optional<bool> CXFA_WidgetData::GetBarcodeAttribute_Truncate() { - return GetUIChild()->JSNode()->TryBoolean(XFA_Attribute::Truncate, true); + return GetUIChild()->JSObject()->TryBoolean(XFA_Attribute::Truncate, true); } pdfium::Optional<int8_t> CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio() { pdfium::Optional<WideString> wsWideNarrowRatio = - GetUIChild()->JSNode()->TryCData(XFA_Attribute::WideNarrowRatio, true); + GetUIChild()->JSObject()->TryCData(XFA_Attribute::WideNarrowRatio, true); if (!wsWideNarrowRatio) return {}; @@ -1275,13 +1282,13 @@ CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio() { WideString CXFA_WidgetData::GetPasswordChar() { CXFA_Node* pUIChild = GetUIChild(); - return pUIChild ? pUIChild->JSNode()->GetCData(XFA_Attribute::PasswordChar) + return pUIChild ? pUIChild->JSObject()->GetCData(XFA_Attribute::PasswordChar) : L"*"; } bool CXFA_WidgetData::IsMultiLine() { CXFA_Node* pUIChild = GetUIChild(); - return pUIChild && pUIChild->JSNode()->GetBoolean(XFA_Attribute::MultiLine); + return pUIChild && pUIChild->JSObject()->GetBoolean(XFA_Attribute::MultiLine); } std::pair<XFA_Element, int32_t> CXFA_WidgetData::GetMaxChars() { @@ -1290,9 +1297,10 @@ std::pair<XFA_Element, int32_t> CXFA_WidgetData::GetMaxChars() { switch (pChild->GetElementType()) { case XFA_Element::Text: return {XFA_Element::Text, - pChild->JSNode()->GetInteger(XFA_Attribute::MaxChars)}; + pChild->JSObject()->GetInteger(XFA_Attribute::MaxChars)}; case XFA_Element::ExData: { - int32_t iMax = pChild->JSNode()->GetInteger(XFA_Attribute::MaxLength); + int32_t iMax = + pChild->JSObject()->GetInteger(XFA_Attribute::MaxLength); return {XFA_Element::ExData, iMax < 0 ? 0 : iMax}; } default: @@ -1312,7 +1320,7 @@ int32_t CXFA_WidgetData::GetFracDigits() { if (!pChild) return -1; - return pChild->JSNode() + return pChild->JSObject() ->TryInteger(XFA_Attribute::FracDigits, true) .value_or(-1); } @@ -1326,7 +1334,7 @@ int32_t CXFA_WidgetData::GetLeadDigits() { if (!pChild) return -1; - return pChild->JSNode() + return pChild->JSObject() ->TryInteger(XFA_Attribute::LeadDigits, true) .value_or(-1); } @@ -1390,7 +1398,7 @@ WideString CXFA_WidgetData::GetPictureContent(XFA_VALUEPICTURE ePicture) { if (CXFA_Node* pPicture = pFormat->GetChild(0, XFA_Element::Picture, false)) { pdfium::Optional<WideString> picture = - pPicture->JSNode()->TryContent(false, true); + pPicture->JSObject()->TryContent(false, true); if (picture) return *picture; } @@ -1422,7 +1430,7 @@ WideString CXFA_WidgetData::GetPictureContent(XFA_VALUEPICTURE ePicture) { if (CXFA_Node* pPicture = pUI->GetChild(0, XFA_Element::Picture, false)) { pdfium::Optional<WideString> picture = - pPicture->JSNode()->TryContent(false, true); + pPicture->JSObject()->TryContent(false, true); if (picture) return *picture; } @@ -1471,7 +1479,7 @@ IFX_Locale* CXFA_WidgetData::GetLocale() { } WideString CXFA_WidgetData::GetValue(XFA_VALUEPICTURE eValueType) { - WideString wsValue = m_pNode->JSNode()->GetContent(false); + WideString wsValue = m_pNode->JSObject()->GetContent(false); if (eValueType == XFA_VALUEPICTURE_Display) GetItemLabel(wsValue.AsStringView(), wsValue); @@ -1701,7 +1709,7 @@ void CXFA_WidgetData::SyncValue(const WideString& wsValue, bool bNotify) { if (pContainerWidgetData) wsFormatValue = pContainerWidgetData->GetFormatDataValue(wsValue); - m_pNode->JSNode()->SetContent(wsValue, wsFormatValue, bNotify, false, true); + m_pNode->JSObject()->SetContent(wsValue, wsFormatValue, bNotify, false, true); } void CXFA_WidgetData::InsertListTextItem(CXFA_Node* pItems, @@ -1709,7 +1717,7 @@ void CXFA_WidgetData::InsertListTextItem(CXFA_Node* pItems, int32_t nIndex) { CXFA_Node* pText = pItems->CreateSamePacketNode(XFA_Element::Text); pItems->InsertChild(nIndex, pText); - pText->JSNode()->SetContent(wsText, wsText, false, false, false); + pText->JSObject()->SetContent(wsText, wsText, false, false, false); } WideString CXFA_WidgetData::NumericLimit(const WideString& wsValue, diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 405bb21ba3..66f4a2eb21 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -51,7 +51,7 @@ CXFA_Node* FormValueNode_CreateChild(CXFA_Node* pValueNode, XFA_Element iType) { if (!pChildNode) { if (iType == XFA_Element::Unknown) return nullptr; - pChildNode = pValueNode->JSNode()->GetProperty(0, iType, true); + pChildNode = pValueNode->JSObject()->GetProperty(0, iType, true); } return pChildNode; } @@ -81,8 +81,8 @@ bool FormValueNode_SetChildContent(CXFA_Node* pValueNode, XFA_Element element = XFA_Element::Sharptext; if (pChildNode->GetElementType() == XFA_Element::ExData) { pdfium::Optional<WideString> contentType = - pChildNode->JSNode()->TryAttribute(XFA_Attribute::ContentType, - false); + pChildNode->JSObject()->TryAttribute(XFA_Attribute::ContentType, + false); if (contentType) { if (*contentType == L"text/html") element = XFA_Element::SharpxHTML; @@ -93,15 +93,15 @@ bool FormValueNode_SetChildContent(CXFA_Node* pValueNode, pContentRawDataNode = pChildNode->CreateSamePacketNode(element); pChildNode->InsertChild(pContentRawDataNode, nullptr); } - pContentRawDataNode->JSNode()->SetCData(XFA_Attribute::Value, wsContent, - false, false); + pContentRawDataNode->JSObject()->SetCData(XFA_Attribute::Value, wsContent, + false, false); break; } case XFA_ObjectType::NodeC: case XFA_ObjectType::TextNode: case XFA_ObjectType::NodeV: { - pChildNode->JSNode()->SetCData(XFA_Attribute::Value, wsContent, false, - false); + pChildNode->JSObject()->SetCData(XFA_Attribute::Value, wsContent, false, + false); break; } default: @@ -124,7 +124,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, ASSERT(pWidgetData); XFA_Element eUIType = pWidgetData->GetUIType(); CXFA_ValueData defValueData( - pFormNode->JSNode()->GetProperty(0, XFA_Element::Value, true)); + pFormNode->JSObject()->GetProperty(0, XFA_Element::Value, true)); if (!bDataToForm) { WideString wsValue; switch (eUIType) { @@ -141,10 +141,10 @@ void CreateDataBinding(CXFA_Node* pFormNode, static_cast<CFX_XMLElement*>(pDataNode->GetXMLMappingNode()); ASSERT(pXMLDataElement); - pDataNode->JSNode()->SetAttributeValue( + pDataNode->JSObject()->SetAttributeValue( wsValue, pWidgetData->GetFormatDataValue(wsValue), false, false); - pDataNode->JSNode()->SetCData(XFA_Attribute::ContentType, wsContentType, - false, false); + pDataNode->JSObject()->SetCData(XFA_Attribute::ContentType, + wsContentType, false, false); if (!wsHref.IsEmpty()) pXMLDataElement->SetString(L"href", wsHref); @@ -159,12 +159,12 @@ void CreateDataBinding(CXFA_Node* pFormNode, for (const auto& text : wsSelTextArray) { CXFA_Node* pValue = pDataNode->CreateSamePacketNode(XFA_Element::DataValue); - pValue->JSNode()->SetCData(XFA_Attribute::Name, L"value", false, - false); + pValue->JSObject()->SetCData(XFA_Attribute::Name, L"value", false, + false); pValue->CreateXMLMappingNode(); pDataNode->InsertChild(pValue, nullptr); - pValue->JSNode()->SetCData(XFA_Attribute::Value, text, false, - false); + pValue->JSObject()->SetCData(XFA_Attribute::Value, text, false, + false); } } else { CFX_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); @@ -173,7 +173,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, L"dataGroup"); } } else if (!wsValue.IsEmpty()) { - pDataNode->JSNode()->SetAttributeValue( + pDataNode->JSObject()->SetAttributeValue( wsValue, pWidgetData->GetFormatDataValue(wsValue), false, false); } break; @@ -182,7 +182,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (wsValue.IsEmpty()) break; - pDataNode->JSNode()->SetAttributeValue( + pDataNode->JSObject()->SetAttributeValue( wsValue, pWidgetData->GetFormatDataValue(wsValue), false, false); break; case XFA_Element::ExclGroup: { @@ -208,13 +208,13 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (!pText) continue; - WideString wsContent = pText->JSNode()->GetContent(false); + WideString wsContent = pText->JSObject()->GetContent(false); if (wsContent == wsValue) { pChecked = pChild; - pDataNode->JSNode()->SetAttributeValue(wsValue, wsValue, false, - false); - pFormNode->JSNode()->SetCData(XFA_Attribute::Value, wsContent, - false, false); + pDataNode->JSObject()->SetAttributeValue(wsValue, wsValue, false, + false); + pFormNode->JSObject()->SetCData(XFA_Attribute::Value, wsContent, + false, false); break; } } @@ -229,7 +229,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, continue; CXFA_Node* pValue = - pChild->JSNode()->GetProperty(0, XFA_Element::Value, true); + pChild->JSObject()->GetProperty(0, XFA_Element::Value, true); CXFA_Node* pItems = pChild->GetChild(0, XFA_Element::Items, false); CXFA_Node* pText = pItems ? pItems->GetNodeItem(XFA_NODEITEM_FirstChild) : nullptr; @@ -238,7 +238,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, WideString wsContent; if (pText) - wsContent = pText->JSNode()->GetContent(false); + wsContent = pText->JSObject()->GetContent(false); FormValueNode_SetChildContent(pValue, wsContent, XFA_Element::Text); } @@ -250,10 +250,10 @@ void CreateDataBinding(CXFA_Node* pFormNode, break; wsValue = pWidgetData->NormalizeNumStr(wsValue); - pDataNode->JSNode()->SetAttributeValue( + pDataNode->JSObject()->SetAttributeValue( wsValue, pWidgetData->GetFormatDataValue(wsValue), false, false); CXFA_Node* pValue = - pFormNode->JSNode()->GetProperty(0, XFA_Element::Value, true); + pFormNode->JSObject()->GetProperty(0, XFA_Element::Value, true); FormValueNode_SetChildContent(pValue, wsValue, XFA_Element::Float); break; } @@ -262,18 +262,18 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (wsValue.IsEmpty()) break; - pDataNode->JSNode()->SetAttributeValue( + pDataNode->JSObject()->SetAttributeValue( wsValue, pWidgetData->GetFormatDataValue(wsValue), false, false); break; } return; } - WideString wsXMLValue = pDataNode->JSNode()->GetContent(false); + WideString wsXMLValue = pDataNode->JSObject()->GetContent(false); WideString wsNormalizeValue = pWidgetData->GetNormalizeDataValue(wsXMLValue); - pDataNode->JSNode()->SetAttributeValue(wsNormalizeValue, wsXMLValue, false, - false); + pDataNode->JSObject()->SetAttributeValue(wsNormalizeValue, wsXMLValue, false, + false); switch (eUIType) { case XFA_Element::ImageEdit: { FormValueNode_SetChildContent(defValueData.GetNode(), wsNormalizeValue, @@ -287,8 +287,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, WideString wsContentType = pXMLDataElement->GetString(L"xfa:contentType"); if (!wsContentType.IsEmpty()) { - pDataNode->JSNode()->SetCData(XFA_Attribute::ContentType, - wsContentType, false, false); + pDataNode->JSObject()->SetCData(XFA_Attribute::ContentType, + wsContentType, false, false); imageData.SetContentType(wsContentType); } @@ -308,7 +308,7 @@ void CreateDataBinding(CXFA_Node* pFormNode, wsNormalizeValue.clear(); for (CXFA_Node* pNode : items) { - WideString wsItem = pNode->JSNode()->GetContent(false); + WideString wsItem = pNode->JSObject()->GetContent(false); if (single) wsItem += L"\n"; @@ -501,7 +501,7 @@ CXFA_Node* CloneOrMergeInstanceManager(CXFA_Document* pDocument, CXFA_Node* pTemplateNode, std::vector<CXFA_Node*>* subforms) { WideString wsSubformName = - pTemplateNode->JSNode()->GetCData(XFA_Attribute::Name); + pTemplateNode->JSObject()->GetCData(XFA_Attribute::Name); WideString wsInstMgrNodeName = L"_" + wsSubformName; uint32_t dwInstNameHash = FX_HashCode_GetW(wsInstMgrNodeName.AsStringView(), false); @@ -539,9 +539,9 @@ CXFA_Node* CloneOrMergeInstanceManager(CXFA_Document* pDocument, CXFA_Node* pNewNode = pDocument->CreateNode(XFA_PacketType::Form, XFA_Element::InstanceManager); wsInstMgrNodeName = - L"_" + pTemplateNode->JSNode()->GetCData(XFA_Attribute::Name); - pNewNode->JSNode()->SetCData(XFA_Attribute::Name, wsInstMgrNodeName, false, - false); + L"_" + pTemplateNode->JSObject()->GetCData(XFA_Attribute::Name); + pNewNode->JSObject()->SetCData(XFA_Attribute::Name, wsInstMgrNodeName, false, + false); pFormParent->InsertChild(pNewNode, nullptr); pNewNode->SetTemplateNode(pTemplateNode); return pNewNode; @@ -598,7 +598,7 @@ CXFA_Node* FindMatchingDataNode( pCurTemplateNode->GetFirstChildByClass(XFA_Element::Bind); XFA_AttributeEnum eMatch = pTemplateNodeBind - ? pTemplateNodeBind->JSNode()->GetEnum(XFA_Attribute::Match) + ? pTemplateNodeBind->JSObject()->GetEnum(XFA_Attribute::Match) : XFA_AttributeEnum::Once; eBindMatch = eMatch; switch (eMatch) { @@ -616,7 +616,7 @@ CXFA_Node* FindMatchingDataNode( XFA_FieldIsMultiListBox(pTemplateNodeBind))) { CXFA_Node* pGlobalBindNode = FindGlobalDataNode( pDocument, - pCurTemplateNode->JSNode()->GetCData(XFA_Attribute::Name), + pCurTemplateNode->JSObject()->GetCData(XFA_Attribute::Name), pDataScope, eMatchNodeType); if (!pGlobalBindNode) { pCurTemplateNode = pIterator->MoveToNext(); @@ -629,7 +629,7 @@ CXFA_Node* FindMatchingDataNode( bAccessedDataDOM = true; CXFA_Node* pOnceBindNode = FindOnceDataNode( pDocument, - pCurTemplateNode->JSNode()->GetCData(XFA_Attribute::Name), + pCurTemplateNode->JSObject()->GetCData(XFA_Attribute::Name), pDataScope, eMatchNodeType); if (!pOnceBindNode) { pCurTemplateNode = pIterator->MoveToNext(); @@ -642,7 +642,7 @@ CXFA_Node* FindMatchingDataNode( bAccessedDataDOM = true; CXFA_Node* pDataRefBindNode = FindDataRefDataNode( pDocument, - pTemplateNodeBind->JSNode()->GetCData(XFA_Attribute::Ref), + pTemplateNodeBind->JSObject()->GetCData(XFA_Attribute::Ref), pDataScope, eMatchNodeType, pTemplateNode, bForceBind, bUpLevel); if (pDataRefBindNode && pDataRefBindNode->GetElementType() == eMatchNodeType) { @@ -743,7 +743,7 @@ CXFA_Node* CopyContainer_SubformSet(CXFA_Document* pDocument, XFA_AttributeEnum eRelation = eType == XFA_Element::SubformSet - ? pTemplateNode->JSNode()->GetEnum(XFA_Attribute::Relation) + ? pTemplateNode->JSObject()->GetEnum(XFA_Attribute::Relation) : XFA_AttributeEnum::Ordered; int32_t iCurRepeatIndex = 0; XFA_AttributeEnum eParentBindMatch = XFA_AttributeEnum::None; @@ -1025,7 +1025,7 @@ CXFA_Node* MaybeCreateDataNode(CXFA_Document* pDocument, if (!pParentDDNode) { CXFA_Node* pDataNode = pDocument->CreateNode(XFA_PacketType::Datasets, eNodeType); - pDataNode->JSNode()->SetCData(XFA_Attribute::Name, wsName, false, false); + pDataNode->JSObject()->SetCData(XFA_Attribute::Name, wsName, false, false); pDataNode->CreateXMLMappingNode(); pDataParent->InsertChild(pDataNode, nullptr); pDataNode->SetFlag(XFA_NodeFlag_Initialized, false); @@ -1040,7 +1040,8 @@ CXFA_Node* MaybeCreateDataNode(CXFA_Document* pDocument, if (pDDGroupNode->GetElementType() != XFA_Element::DataGroup) continue; - pdfium::Optional<WideString> ns = pDDGroupNode->JSNode()->TryNamespace(); + pdfium::Optional<WideString> ns = + pDDGroupNode->JSObject()->TryNamespace(); if (!ns || *ns != L"http://ns.adobe.com/data-description/") continue; } @@ -1054,13 +1055,13 @@ CXFA_Node* MaybeCreateDataNode(CXFA_Document* pDocument, CXFA_Node* pDataNode = pDocument->CreateNode(XFA_PacketType::Datasets, eNodeType); - pDataNode->JSNode()->SetCData(XFA_Attribute::Name, wsName, false, false); + pDataNode->JSObject()->SetCData(XFA_Attribute::Name, wsName, false, false); pDataNode->CreateXMLMappingNode(); if (eNodeType == XFA_Element::DataValue && - pDDNode->JSNode()->GetEnum(XFA_Attribute::Contains) == + pDDNode->JSObject()->GetEnum(XFA_Attribute::Contains) == XFA_AttributeEnum::MetaData) { - pDataNode->JSNode()->SetEnum(XFA_Attribute::Contains, - XFA_AttributeEnum::MetaData, false); + pDataNode->JSObject()->SetEnum(XFA_Attribute::Contains, + XFA_AttributeEnum::MetaData, false); } pDataParent->InsertChild(pDataNode, nullptr); pDataNode->SetDataDescriptionNode(pDDNode); @@ -1086,7 +1087,7 @@ void UpdateBindingRelations(CXFA_Document* pDocument, : nullptr; XFA_AttributeEnum eMatch = pTemplateNodeBind - ? pTemplateNodeBind->JSNode()->GetEnum(XFA_Attribute::Match) + ? pTemplateNodeBind->JSObject()->GetEnum(XFA_Attribute::Match) : XFA_AttributeEnum::Once; switch (eMatch) { case XFA_AttributeEnum::None: @@ -1097,7 +1098,7 @@ void UpdateBindingRelations(CXFA_Document* pDocument, if (!bDataRef || bParentDataRef) { if (!pDataNode) { if (pFormNode->GetNameHash() != 0 && - pFormNode->JSNode()->GetEnum(XFA_Attribute::Scope) != + pFormNode->JSObject()->GetEnum(XFA_Attribute::Scope) != XFA_AttributeEnum::None) { XFA_Element eDataNodeType = (eType == XFA_Element::Subform || XFA_FieldIsMultiListBox(pFormNode)) @@ -1106,7 +1107,7 @@ void UpdateBindingRelations(CXFA_Document* pDocument, pDataNode = MaybeCreateDataNode( pDocument, pDataScope, eDataNodeType, WideString( - pFormNode->JSNode()->GetCData(XFA_Attribute::Name))); + pFormNode->JSObject()->GetCData(XFA_Attribute::Name))); if (pDataNode) CreateDataBinding(pFormNode, pDataNode, false); } @@ -1139,7 +1140,7 @@ void UpdateBindingRelations(CXFA_Document* pDocument, pDataNode = MaybeCreateDataNode( pDocument, pRecordNode, eDataNodeType, WideString( - pFormNode->JSNode()->GetCData(XFA_Attribute::Name))); + pFormNode->JSObject()->GetCData(XFA_Attribute::Name))); if (pDataNode) { CreateDataBinding(pFormNode, pDataNode, false); RegisterGlobalBinding(pDocument, pFormNode->GetNameHash(), @@ -1158,7 +1159,7 @@ void UpdateBindingRelations(CXFA_Document* pDocument, bParentDataRef = true; if (!pDataNode && bDataRef) { WideString wsRef = - pTemplateNodeBind->JSNode()->GetCData(XFA_Attribute::Ref); + pTemplateNodeBind->JSObject()->GetCData(XFA_Attribute::Ref); uint32_t dFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_CreateNode; XFA_RESOLVENODE_RS rs; @@ -1219,7 +1220,7 @@ void UpdateDataRelation(CXFA_Node* pDataNode, CXFA_Node* pDataDescriptionNode) { continue; pdfium::Optional<WideString> ns = - pDDGroupNode->JSNode()->TryNamespace(); + pDDGroupNode->JSObject()->TryNamespace(); if (!ns || *ns != L"http://ns.adobe.com/data-description/") continue; } @@ -1379,15 +1380,15 @@ void CXFA_Document::DoDataMerge() { L"http://www.xfa.org/schema/xfa-data/1.0/"); pDatasetsRoot = CreateNode(XFA_PacketType::Datasets, XFA_Element::DataModel); - pDatasetsRoot->JSNode()->SetCData(XFA_Attribute::Name, L"datasets", false, - false); + pDatasetsRoot->JSObject()->SetCData(XFA_Attribute::Name, L"datasets", false, + false); m_pRootNode->GetXMLMappingNode()->InsertChildNode(pDatasetsXMLNode); m_pRootNode->InsertChild(pDatasetsRoot, nullptr); pDatasetsRoot->SetXMLMappingNode(pDatasetsXMLNode); } CXFA_Node *pDataRoot = nullptr, *pDDRoot = nullptr; WideString wsDatasetsURI = - pDatasetsRoot->JSNode()->TryNamespace().value_or(WideString()); + pDatasetsRoot->JSObject()->TryNamespace().value_or(WideString()); for (CXFA_Node* pChildNode = pDatasetsRoot->GetNodeItem(XFA_NODEITEM_FirstChild); pChildNode; @@ -1397,14 +1398,14 @@ void CXFA_Document::DoDataMerge() { if (!pDDRoot && pChildNode->GetNameHash() == XFA_HASHCODE_DataDescription) { pdfium::Optional<WideString> namespaceURI = - pChildNode->JSNode()->TryNamespace(); + pChildNode->JSObject()->TryNamespace(); if (!namespaceURI) continue; if (*namespaceURI == L"http://ns.adobe.com/data-description/") pDDRoot = pChildNode; } else if (!pDataRoot && pChildNode->GetNameHash() == XFA_HASHCODE_Data) { pdfium::Optional<WideString> namespaceURI = - pChildNode->JSNode()->TryNamespace(); + pChildNode->JSObject()->TryNamespace(); if (!namespaceURI) continue; if (*namespaceURI == wsDatasetsURI) @@ -1417,7 +1418,7 @@ void CXFA_Document::DoDataMerge() { if (!pDataRoot) { CFX_XMLElement* pDataRootXMLNode = new CFX_XMLElement(L"xfa:data"); pDataRoot = CreateNode(XFA_PacketType::Datasets, XFA_Element::DataGroup); - pDataRoot->JSNode()->SetCData(XFA_Attribute::Name, L"data", false, false); + pDataRoot->JSObject()->SetCData(XFA_Attribute::Name, L"data", false, false); pDataRoot->SetXMLMappingNode(pDataRootXMLNode); pDatasetsRoot->InsertChild(pDataRoot, nullptr); } @@ -1446,7 +1447,7 @@ void CXFA_Document::DoDataMerge() { bEmptyForm = true; pFormRoot = CreateNode(XFA_PacketType::Form, XFA_Element::Form); ASSERT(pFormRoot); - pFormRoot->JSNode()->SetCData(XFA_Attribute::Name, L"form", false, false); + pFormRoot->JSObject()->SetCData(XFA_Attribute::Name, L"form", false, false); m_pRootNode->InsertChild(pFormRoot, nullptr); } else { CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> @@ -1462,15 +1463,15 @@ void CXFA_Document::DoDataMerge() { ASSERT(pSubformSetNode); if (!pDataTopLevel) { WideString wsFormName = - pSubformSetNode->JSNode()->GetCData(XFA_Attribute::Name); + pSubformSetNode->JSObject()->GetCData(XFA_Attribute::Name); WideString wsDataTopLevelName(wsFormName.IsEmpty() ? L"form" : wsFormName); CFX_XMLElement* pDataTopLevelXMLNode = new CFX_XMLElement(wsDataTopLevelName); pDataTopLevel = CreateNode(XFA_PacketType::Datasets, XFA_Element::DataGroup); - pDataTopLevel->JSNode()->SetCData(XFA_Attribute::Name, wsDataTopLevelName, - false, false); + pDataTopLevel->JSObject()->SetCData(XFA_Attribute::Name, wsDataTopLevelName, + false, false); pDataTopLevel->SetXMLMappingNode(pDataTopLevelXMLNode); CXFA_Node* pBeforeNode = pDataRoot->GetNodeItem(XFA_NODEITEM_FirstChild); pDataRoot->InsertChild(pDataTopLevel, pBeforeNode); diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp index 4dbed96f25..6706bb64ee 100644 --- a/xfa/fxfa/parser/xfa_utils.cpp +++ b/xfa/fxfa/parser/xfa_utils.cpp @@ -127,7 +127,7 @@ bool AttributeSaveInDataModel(CXFA_Node* pNode, XFA_Attribute eAttribute) { bool ContentNodeNeedtoExport(CXFA_Node* pContentNode) { pdfium::Optional<WideString> wsContent = - pContentNode->JSNode()->TryContent(false, false); + pContentNode->JSObject()->TryContent(false, false); if (!wsContent) return false; @@ -154,11 +154,11 @@ void SaveAttribute(CXFA_Node* pNode, const WideString& wsName, bool bProto, WideString& wsOutput) { - if (!bProto && !pNode->JSNode()->HasAttribute(eName)) + if (!bProto && !pNode->JSObject()->HasAttribute(eName)) return; pdfium::Optional<WideString> value = - pNode->JSNode()->TryAttribute(eName, false); + pNode->JSObject()->TryAttribute(eName, false); if (!value) return; @@ -205,7 +205,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, break; pdfium::Optional<WideString> contentType = - pNode->JSNode()->TryAttribute(XFA_Attribute::ContentType, false); + pNode->JSObject()->TryAttribute(XFA_Attribute::ContentType, false); if (pRawValueNode->GetElementType() == XFA_Element::SharpxHTML && (contentType && *contentType == L"text/html")) { CFX_XMLNode* pExDataXML = pNode->GetXMLMappingNode(); @@ -228,7 +228,8 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, } else if (pRawValueNode->GetElementType() == XFA_Element::Sharpxml && (contentType && *contentType == L"text/xml")) { pdfium::Optional<WideString> rawValue = - pRawValueNode->JSNode()->TryAttribute(XFA_Attribute::Value, false); + pRawValueNode->JSObject()->TryAttribute(XFA_Attribute::Value, + false); if (!rawValue || rawValue->IsEmpty()) break; @@ -251,7 +252,8 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, pParentNode->GetNodeItem(XFA_NODEITEM_Parent); ASSERT(pGrandparentNode); WideString bodyTagName; - bodyTagName = pGrandparentNode->JSNode()->GetCData(XFA_Attribute::Name); + bodyTagName = + pGrandparentNode->JSObject()->GetCData(XFA_Attribute::Name); if (bodyTagName.IsEmpty()) bodyTagName = L"ListBox1"; @@ -271,7 +273,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, buf.Clear(); } else { WideString wsValue = - pRawValueNode->JSNode()->GetCData(XFA_Attribute::Value); + pRawValueNode->JSObject()->GetCData(XFA_Attribute::Value); wsChildren += ExportEncodeContent(wsValue); } break; @@ -279,7 +281,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, case XFA_ObjectType::TextNode: case XFA_ObjectType::NodeC: case XFA_ObjectType::NodeV: { - WideString wsValue = pNode->JSNode()->GetCData(XFA_Attribute::Value); + WideString wsValue = pNode->JSObject()->GetCData(XFA_Attribute::Value); wsChildren += ExportEncodeContent(wsValue); break; } @@ -316,7 +318,7 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode, } if (!wsChildren.IsEmpty() || !wsAttrs.IsEmpty() || - pNode->JSNode()->HasAttribute(XFA_Attribute::Name)) { + pNode->JSObject()->HasAttribute(XFA_Attribute::Name)) { WideStringView wsElement = pNode->GetClassName(); WideString wsName; SaveAttribute(pNode, XFA_Attribute::Name, L"name", true, wsName); @@ -396,7 +398,7 @@ void RecognizeXFAVersionNumber(CXFA_Node* pTemplateRoot, return; pdfium::Optional<WideString> templateNS = - pTemplateRoot->JSNode()->TryNamespace(); + pTemplateRoot->JSObject()->TryNamespace(); if (!templateNS) return; @@ -571,7 +573,7 @@ bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode) { CXFA_Node* pFirstChild = pUIChild->GetNodeItem(XFA_NODEITEM_FirstChild); if (pFirstChild && pFirstChild->GetElementType() == XFA_Element::ChoiceList) { - bRet = pFirstChild->JSNode()->GetEnum(XFA_Attribute::Open) == + bRet = pFirstChild->JSObject()->GetEnum(XFA_Attribute::Open) == XFA_AttributeEnum::MultiSelect; } } |