summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_widgetacc.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-01 16:04:36 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-01 16:04:36 +0000
commite5434b5531f2c081c1d69f67125b6665070ea969 (patch)
tree1fa141f20597c62e9f2e2738d438bfaaecc772a3 /xfa/fxfa/cxfa_widgetacc.cpp
parent3fff90a670d860a7b0319aa0edf8628917d0a122 (diff)
downloadpdfium-e5434b5531f2c081c1d69f67125b6665070ea969.tar.xz
Split JS code out of CXFA_Node.
This CL moves JS code out of CXFA_Node and places it into fxjs/cjx_node. The CXFA_Node then has a CJX_Node as a member and, currently, proxies JS calls to the CJX_Node member. Change-Id: Ic5b95184c8fd2347f0bdcfbccfa89bb6b52835b6 Reviewed-on: https://pdfium-review.googlesource.com/17290 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_widgetacc.cpp')
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index ddada38722..e9946a57d9 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -162,7 +162,7 @@ CXFA_WidgetAcc::~CXFA_WidgetAcc() {}
bool CXFA_WidgetAcc::GetName(WideString& wsName, int32_t iNameType) {
if (iNameType == 0) {
- m_pNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
+ m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Name, wsName);
return !wsName.IsEmpty();
}
m_pNode->GetSOMExpression(wsName);
@@ -223,8 +223,11 @@ void CXFA_WidgetAcc::ResetData() {
continue;
WideString itemText;
- if (pItems->CountChildren(XFA_Element::Unknown) > 1)
- itemText = pItems->GetChild(1, XFA_Element::Unknown)->GetContent();
+ if (pItems->CountChildren(XFA_Element::Unknown) > 1) {
+ itemText = pItems->GetChild(1, XFA_Element::Unknown)
+ ->JSNode()
+ ->GetContent();
+ }
pAcc->SetValue(itemText, XFA_VALUEPICTURE_Raw);
}
@@ -254,16 +257,16 @@ void CXFA_WidgetAcc::SetImageEdit(const WideString& wsContentType,
}
WideString wsFormatValue(wsData);
GetFormatDataValue(wsData, wsFormatValue);
- m_pNode->SetContent(wsData, wsFormatValue, true);
+ m_pNode->JSNode()->SetContent(wsData, wsFormatValue, true);
CXFA_Node* pBind = GetDatasets();
if (!pBind) {
image.SetTransferEncoding(XFA_ATTRIBUTEENUM_Base64);
return;
}
- pBind->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
+ pBind->JSNode()->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType);
CXFA_Node* pHrefNode = pBind->GetNodeItem(XFA_NODEITEM_FirstChild);
if (pHrefNode) {
- pHrefNode->SetCData(XFA_ATTRIBUTE_Value, wsHref);
+ pHrefNode->JSNode()->SetCData(XFA_ATTRIBUTE_Value, wsHref);
} else {
CFX_XMLNode* pXMLNode = pBind->GetXMLMappingNode();
ASSERT(pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element);
@@ -656,12 +659,12 @@ int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script,
if (static_cast<CXFA_WidgetAcc*>(pRefNode->GetWidgetData()) == this)
continue;
- auto* pGlobalData =
- static_cast<CXFA_CalcData*>(pRefNode->GetUserData(XFA_CalcData));
+ auto* pGlobalData = static_cast<CXFA_CalcData*>(
+ pRefNode->JSNode()->GetUserData(XFA_CalcData));
if (!pGlobalData) {
pGlobalData = new CXFA_CalcData;
- pRefNode->SetUserData(XFA_CalcData, pGlobalData,
- &gs_XFADeleteCalcData);
+ pRefNode->JSNode()->SetUserData(XFA_CalcData, pGlobalData,
+ &gs_XFADeleteCalcData);
}
if (!pdfium::ContainsValue(pGlobalData->m_Globals, this))
pGlobalData->m_Globals.push_back(this);
@@ -1280,6 +1283,7 @@ bool CXFA_WidgetAcc::FindSplitPos(int32_t iBlockIndex, float& fCalcHeight) {
XFA_ATTRIBUTEENUM eLayoutMode;
GetNode()
->GetNodeItem(XFA_NODEITEM_Parent)
+ ->JSNode()
->TryEnum(XFA_ATTRIBUTE_Layout, eLayoutMode, true);
if ((eLayoutMode == XFA_ATTRIBUTEENUM_Position ||
eLayoutMode == XFA_ATTRIBUTEENUM_Tb ||