summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_ffwidgethandler.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_ffwidgethandler.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_ffwidgethandler.cpp')
-rw-r--r--xfa/fxfa/cxfa_ffwidgethandler.cpp48
1 files changed, 28 insertions, 20 deletions
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp
index 8f916d804b..0a4033d6c7 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp
@@ -313,25 +313,29 @@ CXFA_Node* CXFA_FFWidgetHandler::CreatePushButton(CXFA_Node* pParent,
CXFA_Node* pCaption = CreateCopyNode(XFA_Element::Caption, pField);
CXFA_Node* pValue = CreateCopyNode(XFA_Element::Value, pCaption);
CXFA_Node* pText = CreateCopyNode(XFA_Element::Text, pValue);
- pText->SetContent(L"Button", L"Button", false);
+ pText->JSNode()->SetContent(L"Button", L"Button", false);
CXFA_Node* pPara = CreateCopyNode(XFA_Element::Para, pCaption);
- pPara->SetEnum(XFA_ATTRIBUTE_VAlign, XFA_ATTRIBUTEENUM_Middle, false);
- pPara->SetEnum(XFA_ATTRIBUTE_HAlign, XFA_ATTRIBUTEENUM_Center, false);
+ pPara->JSNode()->SetEnum(XFA_ATTRIBUTE_VAlign, XFA_ATTRIBUTEENUM_Middle,
+ false);
+ pPara->JSNode()->SetEnum(XFA_ATTRIBUTE_HAlign, XFA_ATTRIBUTEENUM_Center,
+ false);
CreateFontNode(pCaption);
CXFA_Node* pBorder = CreateCopyNode(XFA_Element::Border, pField);
- pBorder->SetEnum(XFA_ATTRIBUTE_Hand, XFA_ATTRIBUTEENUM_Right, false);
+ pBorder->JSNode()->SetEnum(XFA_ATTRIBUTE_Hand, XFA_ATTRIBUTEENUM_Right,
+ false);
CXFA_Node* pEdge = CreateCopyNode(XFA_Element::Edge, pBorder);
- pEdge->SetEnum(XFA_ATTRIBUTE_Stroke, XFA_ATTRIBUTEENUM_Raised, false);
+ pEdge->JSNode()->SetEnum(XFA_ATTRIBUTE_Stroke, XFA_ATTRIBUTEENUM_Raised,
+ false);
CXFA_Node* pFill = CreateCopyNode(XFA_Element::Fill, pBorder);
CXFA_Node* pColor = CreateCopyNode(XFA_Element::Color, pFill);
- pColor->SetCData(XFA_ATTRIBUTE_Value, L"212, 208, 200", false);
+ pColor->JSNode()->SetCData(XFA_ATTRIBUTE_Value, L"212, 208, 200", false);
CXFA_Node* pBind = CreateCopyNode(XFA_Element::Bind, pField);
- pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None);
+ pBind->JSNode()->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None);
return pField;
}
@@ -351,7 +355,7 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateRadioButton(CXFA_Node* pParent,
CXFA_Node* pField = CreateField(XFA_Element::CheckButton, pParent, pBefore);
CXFA_Node* pUi = pField->GetFirstChildByClass(XFA_Element::Ui);
CXFA_Node* pWidget = pUi->GetFirstChildByClass(XFA_Element::CheckButton);
- pWidget->SetEnum(XFA_ATTRIBUTE_Shape, XFA_ATTRIBUTEENUM_Round);
+ pWidget->JSNode()->SetEnum(XFA_ATTRIBUTE_Shape, XFA_ATTRIBUTEENUM_Round);
return pField;
}
@@ -394,8 +398,8 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateListBox(CXFA_Node* pParent,
CXFA_Node* pField = CreateDropdownList(pParent, pBefore);
CXFA_Node* pUi = pField->GetNodeItem(XFA_NODEITEM_FirstChild);
CXFA_Node* pListBox = pUi->GetNodeItem(XFA_NODEITEM_FirstChild);
- pListBox->SetEnum(XFA_ATTRIBUTE_Open, XFA_ATTRIBUTEENUM_Always);
- pListBox->SetEnum(XFA_ATTRIBUTE_CommitOn, XFA_ATTRIBUTEENUM_Exit);
+ pListBox->JSNode()->SetEnum(XFA_ATTRIBUTE_Open, XFA_ATTRIBUTEENUM_Always);
+ pListBox->JSNode()->SetEnum(XFA_ATTRIBUTE_CommitOn, XFA_ATTRIBUTEENUM_Exit);
return pField;
}
@@ -408,7 +412,7 @@ CXFA_Node* CXFA_FFWidgetHandler::CreatePasswordEdit(CXFA_Node* pParent,
CXFA_Node* pBefore) const {
CXFA_Node* pField = CreateField(XFA_Element::PasswordEdit, pParent, pBefore);
CXFA_Node* pBind = CreateCopyNode(XFA_Element::Bind, pField);
- pBind->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None, false);
+ pBind->JSNode()->SetEnum(XFA_ATTRIBUTE_Match, XFA_ATTRIBUTEENUM_None, false);
return pField;
}
@@ -502,7 +506,7 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateTemplateNode(XFA_Element eElement,
CXFA_Node* CXFA_FFWidgetHandler::CreateFontNode(CXFA_Node* pParent) const {
CXFA_Node* pFont = CreateCopyNode(XFA_Element::Font, pParent);
- pFont->SetCData(XFA_ATTRIBUTE_Typeface, L"Myriad Pro", false);
+ pFont->JSNode()->SetCData(XFA_ATTRIBUTE_Typeface, L"Myriad Pro", false);
return pFont;
}
@@ -511,17 +515,21 @@ CXFA_Node* CXFA_FFWidgetHandler::CreateMarginNode(CXFA_Node* pParent,
float fInsets[4]) const {
CXFA_Node* pMargin = CreateCopyNode(XFA_Element::Margin, pParent);
if (dwFlags & 0x01)
- pMargin->SetMeasure(XFA_ATTRIBUTE_LeftInset,
- CXFA_Measurement(fInsets[0], XFA_UNIT_Pt), false);
+ pMargin->JSNode()->SetMeasure(XFA_ATTRIBUTE_LeftInset,
+ CXFA_Measurement(fInsets[0], XFA_UNIT_Pt),
+ false);
if (dwFlags & 0x02)
- pMargin->SetMeasure(XFA_ATTRIBUTE_TopInset,
- CXFA_Measurement(fInsets[1], XFA_UNIT_Pt), false);
+ pMargin->JSNode()->SetMeasure(XFA_ATTRIBUTE_TopInset,
+ CXFA_Measurement(fInsets[1], XFA_UNIT_Pt),
+ false);
if (dwFlags & 0x04)
- pMargin->SetMeasure(XFA_ATTRIBUTE_RightInset,
- CXFA_Measurement(fInsets[2], XFA_UNIT_Pt), false);
+ pMargin->JSNode()->SetMeasure(XFA_ATTRIBUTE_RightInset,
+ CXFA_Measurement(fInsets[2], XFA_UNIT_Pt),
+ false);
if (dwFlags & 0x08)
- pMargin->SetMeasure(XFA_ATTRIBUTE_BottomInset,
- CXFA_Measurement(fInsets[3], XFA_UNIT_Pt), false);
+ pMargin->JSNode()->SetMeasure(XFA_ATTRIBUTE_BottomInset,
+ CXFA_Measurement(fInsets[3], XFA_UNIT_Pt),
+ false);
return pMargin;
}