From 2614250d4f11ed02033a7da095a1694ece12ab78 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 13 Dec 2017 18:29:02 +0000 Subject: Methods are on CJX_Object not CJX_Node now This CL converts all of the JSNode() to JSObject() calls as all of the original CJX_Node methods have been moved to CJX_Object. This fixes potential bad casts from things like CJX_Content which do not inhert from CJX_Node. Bug: pdfium:793372 Change-Id: I6c7f63a78f3d47bb6bad74faed3fd8c535bf095e Reviewed-on: https://pdfium-review.googlesource.com/21090 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- xfa/fxfa/cxfa_widgetacc.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'xfa/fxfa/cxfa_widgetacc.cpp') diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 86d1da5ed4..c43ab6560a 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -209,7 +209,7 @@ void CXFA_WidgetAcc::ResetData() { WideString itemText; if (pItems->CountChildren(XFA_Element::Unknown, false) > 1) { itemText = pItems->GetChild(1, XFA_Element::Unknown, false) - ->JSNode() + ->JSObject() ->GetContent(false); } pAcc->SetValue(XFA_VALUEPICTURE_Raw, itemText); @@ -241,19 +241,19 @@ void CXFA_WidgetAcc::SetImageEdit(const WideString& wsContentType, imageData.SetHref(wsHref); } - m_pNode->JSNode()->SetContent(wsData, GetFormatDataValue(wsData), true, false, - true); + m_pNode->JSObject()->SetContent(wsData, GetFormatDataValue(wsData), true, + false, true); CXFA_Node* pBind = GetDatasets(); if (!pBind) { imageData.SetTransferEncoding(XFA_AttributeEnum::Base64); return; } - pBind->JSNode()->SetCData(XFA_Attribute::ContentType, wsContentType, false, - false); + pBind->JSObject()->SetCData(XFA_Attribute::ContentType, wsContentType, false, + false); CXFA_Node* pHrefNode = pBind->GetNodeItem(XFA_NODEITEM_FirstChild); if (pHrefNode) { - pHrefNode->JSNode()->SetCData(XFA_Attribute::Value, wsHref, false, false); + pHrefNode->JSObject()->SetCData(XFA_Attribute::Value, wsHref, false, false); } else { CFX_XMLNode* pXMLNode = pBind->GetXMLMappingNode(); ASSERT(pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element); @@ -507,7 +507,7 @@ WideString CXFA_WidgetAcc::GetValidateCaptionName(bool bVersionFlag) { } if (!wsCaptionName.IsEmpty()) return wsCaptionName; - return m_pNode->JSNode()->GetCData(XFA_Attribute::Name); + return m_pNode->JSObject()->GetCData(XFA_Attribute::Name); } WideString CXFA_WidgetAcc::GetValidateMessage(bool bError, bool bVersionFlag) { @@ -636,10 +636,11 @@ std::pair CXFA_WidgetAcc::ExecuteBoolScript( if (static_cast(pRefNode->GetWidgetData()) == this) continue; - CXFA_CalcData* pGlobalData = pRefNode->JSNode()->GetCalcData(); + CXFA_CalcData* pGlobalData = pRefNode->JSObject()->GetCalcData(); if (!pGlobalData) { - pRefNode->JSNode()->SetCalcData(pdfium::MakeUnique()); - pGlobalData = pRefNode->JSNode()->GetCalcData(); + pRefNode->JSObject()->SetCalcData( + pdfium::MakeUnique()); + pGlobalData = pRefNode->JSObject()->GetCalcData(); } if (!pdfium::ContainsValue(pGlobalData->m_Globals, this)) pGlobalData->m_Globals.push_back(this); @@ -1260,7 +1261,7 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, float& fCalcHeight) { bool bCanSplitNoContent = false; XFA_AttributeEnum eLayoutMode = GetNode() ->GetNodeItem(XFA_NODEITEM_Parent) - ->JSNode() + ->JSObject() ->TryEnum(XFA_Attribute::Layout, true) .value_or(XFA_AttributeEnum::Position); if ((eLayoutMode == XFA_AttributeEnum::Position || -- cgit v1.2.3