From 8eb2722e764fff0a39d0d1dc0c59473aa938b31f Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 14 Dec 2017 21:04:13 +0000 Subject: Add type information to CJX_Object::GetProperty This CL adds a type template to the CJX_Object::GetProperty method so we can have the correct types returned. Change-Id: Ieda8ec4bd31d26a1e71af30f08b48eb826f5993d Reviewed-on: https://pdfium-review.googlesource.com/21250 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- fxjs/cfxjse_engine.cpp | 2 +- fxjs/cfxjse_resolveprocessor.cpp | 7 +-- fxjs/xfa/cjx_node.cpp | 8 +-- fxjs/xfa/cjx_object.cpp | 12 +++-- fxjs/xfa/cjx_object.h | 21 ++++++-- xfa/fxfa/parser/cxfa_boxdata.cpp | 19 +++++--- xfa/fxfa/parser/cxfa_filldata.cpp | 28 +++++++---- xfa/fxfa/parser/cxfa_filldata.h | 12 +++-- xfa/fxfa/parser/cxfa_fontdata.cpp | 3 +- xfa/fxfa/parser/cxfa_layoutpagemgr.cpp | 4 +- xfa/fxfa/parser/cxfa_strokedata.cpp | 4 +- xfa/fxfa/parser/cxfa_validate.cpp | 7 ++- xfa/fxfa/parser/cxfa_widgetdata.cpp | 65 ++++++++++++++----------- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 14 +++--- 14 files changed, 127 insertions(+), 79 deletions(-) diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp index a1c70a7d16..3def7f250f 100644 --- a/fxjs/cfxjse_engine.cpp +++ b/fxjs/cfxjse_engine.cpp @@ -352,7 +352,7 @@ void CFXJSE_Engine::NormalPropertySetter(CFXJSE_Value* pOriginalValue, CXFA_Node* pPropOrChild = nullptr; XFA_Element eType = CXFA_Node::NameToElement(wsPropName); if (eType != XFA_Element::Unknown) - pPropOrChild = pNode->JSObject()->GetProperty(0, eType, true); + pPropOrChild = pNode->JSObject()->GetProperty(0, eType, true); else pPropOrChild = pNode->GetFirstChildByName(wsPropName.AsStringView()); diff --git a/fxjs/cfxjse_resolveprocessor.cpp b/fxjs/cfxjse_resolveprocessor.cpp index 75c5eea6b5..beb0541a49 100644 --- a/fxjs/cfxjse_resolveprocessor.cpp +++ b/fxjs/cfxjse_resolveprocessor.cpp @@ -19,6 +19,7 @@ #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_nodehelper.h" #include "xfa/fxfa/parser/cxfa_object.h" +#include "xfa/fxfa/parser/cxfa_occur.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" #include "xfa/fxfa/parser/xfa_utils.h" @@ -345,13 +346,13 @@ bool CFXJSE_ResolveProcessor::ResolveNormal(CFXJSE_ResolveNodeData& rnd) { CXFA_Node* pInstanceManager = curNode->AsNode()->GetInstanceMgrOfSubform(); if (pInstanceManager) { - pProp = pInstanceManager->JSObject()->GetProperty(0, XFA_Element::Occur, - true); + pProp = pInstanceManager->JSObject()->GetProperty( + 0, XFA_Element::Occur, true); } } else { XFA_Element eType = CXFA_Node::NameToElement(wsName); if (eType != XFA_Element::Unknown) { - pProp = curNode->AsNode()->JSObject()->GetProperty( + pProp = curNode->AsNode()->JSObject()->GetProperty( 0, eType, eType != XFA_Element::PageSet); } } diff --git a/fxjs/xfa/cjx_node.cpp b/fxjs/xfa/cjx_node.cpp index 1216177f02..e64f1fd5e7 100644 --- a/fxjs/xfa/cjx_node.cpp +++ b/fxjs/xfa/cjx_node.cpp @@ -163,8 +163,8 @@ CJS_Return CJX_Node::getElement( WideString expression = runtime->ToWideString(params[0]); int32_t iValue = params.size() >= 2 ? runtime->ToInt32(params[1]) : 0; - CXFA_Node* pNode = - GetProperty(iValue, CXFA_Node::NameToElement(expression), true); + CXFA_Node* pNode = GetProperty( + iValue, CXFA_Node::NameToElement(expression), true); CFXJSE_Value* value = GetDocument()->GetScriptContext()->GetJSValueFromMap(pNode); if (!value) @@ -186,12 +186,12 @@ CJS_Return CJX_Node::isPropertySpecified( bool bParent = params.size() < 2 || runtime->ToBoolean(params[1]); int32_t iIndex = params.size() == 3 ? runtime->ToInt32(params[2]) : 0; XFA_Element eType = CXFA_Node::NameToElement(expression); - bool bHas = !!GetProperty(iIndex, eType, true); + bool bHas = !!GetProperty(iIndex, eType, true); if (!bHas && bParent && GetXFANode()->GetParent()) { // Also check on the parent. auto* jsnode = GetXFANode()->GetParent()->JSObject(); bHas = jsnode->HasAttribute(attr) || - !!jsnode->GetProperty(iIndex, eType, true); + !!jsnode->GetProperty(iIndex, eType, true); } return CJS_Return(runtime->NewBoolean(bHas)); } diff --git a/fxjs/xfa/cjx_object.cpp b/fxjs/xfa/cjx_object.cpp index fcf77d434d..304b861dcf 100644 --- a/fxjs/xfa/cjx_object.cpp +++ b/fxjs/xfa/cjx_object.cpp @@ -619,7 +619,8 @@ bool CJX_Object::SetContent(const WideString& wsContent, switch (ToNode(GetXFAObject())->GetObjectType()) { case XFA_ObjectType::ContainerNode: { if (XFA_FieldIsMultiListBox(ToNode(GetXFAObject()))) { - CXFA_Node* pValue = GetProperty(0, XFA_Element::Value, true); + CXFA_Value* pValue = + GetProperty(0, XFA_Element::Value, true); if (!pValue) break; @@ -703,7 +704,8 @@ bool CJX_Object::SetContent(const WideString& wsContent, if (ToNode(GetXFAObject())->GetElementType() == XFA_Element::ExclGroup) { pNode = ToNode(GetXFAObject()); } else { - CXFA_Node* pValue = GetProperty(0, XFA_Element::Value, true); + CXFA_Value* pValue = + GetProperty(0, XFA_Element::Value, true); if (!pValue) break; @@ -898,9 +900,9 @@ pdfium::Optional CJX_Object::TryNamespace() { return {static_cast(pXMLNode)->GetNamespaceURI()}; } -CXFA_Node* CJX_Object::GetProperty(int32_t index, - XFA_Element eProperty, - bool bCreateProperty) { +CXFA_Node* CJX_Object::GetPropertyInternal(int32_t index, + XFA_Element eProperty, + bool bCreateProperty) { if (index < 0 || index >= ToNode(GetXFAObject())->PropertyOccuranceCount(eProperty)) { return nullptr; diff --git a/fxjs/xfa/cjx_object.h b/fxjs/xfa/cjx_object.h index cf2ede7abf..f6ce3ccfb8 100644 --- a/fxjs/xfa/cjx_object.h +++ b/fxjs/xfa/cjx_object.h @@ -101,9 +101,10 @@ class CJX_Object { bool bSyncData); WideString GetContent(bool bScriptModify); - CXFA_Node* GetProperty(int32_t index, - XFA_Element eType, - bool bCreateProperty); + template + T* GetProperty(int32_t index, XFA_Element eType, bool bCreateProperty) { + return static_cast(GetPropertyInternal(index, eType, bCreateProperty)); + } void SetAttributeValue(const WideString& wsValue, const WideString& wsXMLValue, @@ -222,6 +223,20 @@ class CJX_Object { void ThrowException(const wchar_t* str, ...) const; private: + void Script_Boolean_DefaultValue(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute); + void Script_Draw_DefaultValue(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute); + void Script_Field_DefaultValue(CFXJSE_Value* pValue, + bool bSetting, + XFA_Attribute eAttribute); + + CXFA_Node* GetPropertyInternal(int32_t index, + XFA_Element eType, + bool bCreateProperty); + void OnChanged(XFA_Attribute eAttr, bool bNotify, bool bScriptModify); void OnChanging(XFA_Attribute eAttr, bool bNotify); bool SetUserData(void* pKey, diff --git a/xfa/fxfa/parser/cxfa_boxdata.cpp b/xfa/fxfa/parser/cxfa_boxdata.cpp index 7ada3bf00b..6e27c71e56 100644 --- a/xfa/fxfa/parser/cxfa_boxdata.cpp +++ b/xfa/fxfa/parser/cxfa_boxdata.cpp @@ -6,7 +6,10 @@ #include "xfa/fxfa/parser/cxfa_boxdata.h" +#include "xfa/fxfa/parser/cxfa_corner.h" #include "xfa/fxfa/parser/cxfa_cornerdata.h" +#include "xfa/fxfa/parser/cxfa_edge.h" +#include "xfa/fxfa/parser/cxfa_fill.h" #include "xfa/fxfa/parser/cxfa_margin.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_node.h" @@ -21,8 +24,9 @@ std::vector GetStrokesInternal(CXFA_Node* pNode, bool bNull) { strokes.resize(8); int32_t i, j; for (i = 0, j = 0; i < 4; i++) { - CXFA_CornerData cornerData = CXFA_CornerData( - pNode->JSObject()->GetProperty(i, XFA_Element::Corner, i == 0)); + CXFA_CornerData cornerData = + CXFA_CornerData(pNode->JSObject()->GetProperty( + i, XFA_Element::Corner, i == 0)); if (cornerData.HasValidNode() || i == 0) { strokes[j] = cornerData; } else if (!bNull) { @@ -32,8 +36,9 @@ std::vector GetStrokesInternal(CXFA_Node* pNode, bool bNull) { strokes[j] = strokes[2]; } j++; - CXFA_EdgeData edgeData = CXFA_EdgeData( - pNode->JSObject()->GetProperty(i, XFA_Element::Edge, i == 0)); + CXFA_EdgeData edgeData = + CXFA_EdgeData(pNode->JSObject()->GetProperty( + i, XFA_Element::Edge, i == 0)); if (edgeData.HasValidNode() || i == 0) { strokes[j] = edgeData; } else if (!bNull) { @@ -98,7 +103,7 @@ int32_t CXFA_BoxData::CountEdges() const { } CXFA_EdgeData CXFA_BoxData::GetEdgeData(int32_t nIndex) const { - return CXFA_EdgeData(m_pNode ? m_pNode->JSObject()->GetProperty( + return CXFA_EdgeData(m_pNode ? m_pNode->JSObject()->GetProperty( nIndex, XFA_Element::Edge, nIndex == 0) : nullptr); } @@ -129,8 +134,8 @@ CXFA_FillData CXFA_BoxData::GetFillData(bool bModified) const { if (!m_pNode) return CXFA_FillData(nullptr); - CXFA_Node* pFillNode = - m_pNode->JSObject()->GetProperty(0, XFA_Element::Fill, bModified); + CXFA_Node* pFillNode = m_pNode->JSObject()->GetProperty( + 0, XFA_Element::Fill, bModified); return CXFA_FillData(pFillNode); } diff --git a/xfa/fxfa/parser/cxfa_filldata.cpp b/xfa/fxfa/parser/cxfa_filldata.cpp index 98df0aa3a4..067d75246c 100644 --- a/xfa/fxfa/parser/cxfa_filldata.cpp +++ b/xfa/fxfa/parser/cxfa_filldata.cpp @@ -7,7 +7,11 @@ #include "xfa/fxfa/parser/cxfa_filldata.h" #include "xfa/fxfa/parser/cxfa_color.h" +#include "xfa/fxfa/parser/cxfa_linear.h" #include "xfa/fxfa/parser/cxfa_node.h" +#include "xfa/fxfa/parser/cxfa_pattern.h" +#include "xfa/fxfa/parser/cxfa_radial.h" +#include "xfa/fxfa/parser/cxfa_stipple.h" CXFA_FillData::CXFA_FillData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} @@ -21,8 +25,8 @@ bool CXFA_FillData::IsVisible() const { } void CXFA_FillData::SetColor(FX_ARGB color) { - CXFA_Node* pNode = - m_pNode->JSObject()->GetProperty(0, XFA_Element::Color, true); + CXFA_Color* pNode = + m_pNode->JSObject()->GetProperty(0, XFA_Element::Color, true); int a; int r; int g; @@ -127,18 +131,22 @@ FX_ARGB CXFA_FillData::GetRadialColor() const { return 0xFF000000; } -CXFA_Node* CXFA_FillData::GetStipple() const { - return m_pNode->JSObject()->GetProperty(0, XFA_Element::Stipple, true); +CXFA_Stipple* CXFA_FillData::GetStipple() const { + return m_pNode->JSObject()->GetProperty(0, XFA_Element::Stipple, + true); } -CXFA_Node* CXFA_FillData::GetRadial() const { - return m_pNode->JSObject()->GetProperty(0, XFA_Element::Radial, true); +CXFA_Radial* CXFA_FillData::GetRadial() const { + return m_pNode->JSObject()->GetProperty(0, XFA_Element::Radial, + true); } -CXFA_Node* CXFA_FillData::GetLinear() const { - return m_pNode->JSObject()->GetProperty(0, XFA_Element::Linear, true); +CXFA_Linear* CXFA_FillData::GetLinear() const { + return m_pNode->JSObject()->GetProperty(0, XFA_Element::Linear, + true); } -CXFA_Node* CXFA_FillData::GetPattern() const { - return m_pNode->JSObject()->GetProperty(0, XFA_Element::Pattern, true); +CXFA_Pattern* CXFA_FillData::GetPattern() const { + return m_pNode->JSObject()->GetProperty(0, XFA_Element::Pattern, + true); } diff --git a/xfa/fxfa/parser/cxfa_filldata.h b/xfa/fxfa/parser/cxfa_filldata.h index 8331123404..94e840e230 100644 --- a/xfa/fxfa/parser/cxfa_filldata.h +++ b/xfa/fxfa/parser/cxfa_filldata.h @@ -11,7 +11,11 @@ #include "core/fxge/fx_dib.h" #include "xfa/fxfa/parser/cxfa_datadata.h" +class CXFA_Linear; class CXFA_Node; +class CXFA_Pattern; +class CXFA_Radial; +class CXFA_Stipple; class CXFA_FillData : public CXFA_DataData { public: @@ -38,10 +42,10 @@ class CXFA_FillData : public CXFA_DataData { FX_ARGB GetRadialColor() const; private: - CXFA_Node* GetStipple() const; - CXFA_Node* GetRadial() const; - CXFA_Node* GetLinear() const; - CXFA_Node* GetPattern() const; + CXFA_Stipple* GetStipple() const; + CXFA_Radial* GetRadial() const; + CXFA_Linear* GetLinear() const; + CXFA_Pattern* GetPattern() const; }; #endif // XFA_FXFA_PARSER_CXFA_FILLDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_fontdata.cpp b/xfa/fxfa/parser/cxfa_fontdata.cpp index 78ff2e89aa..88dc930dab 100644 --- a/xfa/fxfa/parser/cxfa_fontdata.cpp +++ b/xfa/fxfa/parser/cxfa_fontdata.cpp @@ -78,7 +78,8 @@ bool CXFA_FontData::IsItalic() const { } void CXFA_FontData::SetColor(FX_ARGB color) { - CXFA_FillData(m_pNode->JSObject()->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_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp index 5cd7b76ddc..b511cf8d3d 100644 --- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp +++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp @@ -287,8 +287,8 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) { if (!pTemplateNode) return false; - m_pTemplatePageSetRoot = - pTemplateNode->JSObject()->GetProperty(0, XFA_Element::PageSet, true); + m_pTemplatePageSetRoot = pTemplateNode->JSObject()->GetProperty( + 0, XFA_Element::PageSet, true); ASSERT(m_pTemplatePageSetRoot); if (m_pPageSetLayoutItemRoot) { m_pPageSetLayoutItemRoot->m_pParent = nullptr; diff --git a/xfa/fxfa/parser/cxfa_strokedata.cpp b/xfa/fxfa/parser/cxfa_strokedata.cpp index 4c4e810555..7886730d39 100644 --- a/xfa/fxfa/parser/cxfa_strokedata.cpp +++ b/xfa/fxfa/parser/cxfa_strokedata.cpp @@ -65,8 +65,8 @@ void CXFA_StrokeData::SetColor(FX_ARGB argb) { if (!m_pNode) return; - CXFA_Node* pNode = - m_pNode->JSObject()->GetProperty(0, XFA_Element::Color, true); + CXFA_Color* pNode = + m_pNode->JSObject()->GetProperty(0, XFA_Element::Color, true); int a; int r; int g; diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp index 49f7f1aeff..665c606632 100644 --- a/xfa/fxfa/parser/cxfa_validate.cpp +++ b/xfa/fxfa/parser/cxfa_validate.cpp @@ -8,6 +8,7 @@ #include "fxjs/xfa/cjx_validate.h" #include "third_party/base/ptr_util.h" +#include "xfa/fxfa/parser/cxfa_message.h" #include "xfa/fxfa/parser/cxfa_picture.h" #include "xfa/fxfa/parser/cxfa_script.h" @@ -73,7 +74,8 @@ XFA_AttributeEnum CXFA_Validate::GetScriptTest() { } WideString CXFA_Validate::GetMessageText(const WideString& wsMessageType) { - CXFA_Node* pNode = JSObject()->GetProperty(0, XFA_Element::Message, false); + CXFA_Message* pNode = + JSObject()->GetProperty(0, XFA_Element::Message, false); if (!pNode) return L""; @@ -116,7 +118,8 @@ void CXFA_Validate::SetScriptMessageText(const WideString& wsMessage) { void CXFA_Validate::SetMessageText(const WideString& wsMessageType, const WideString& wsMessage) { - CXFA_Node* pNode = JSObject()->GetProperty(0, XFA_Element::Message, true); + CXFA_Message* pNode = + JSObject()->GetProperty(0, XFA_Element::Message, true); if (!pNode) return; diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 38f85e715b..fd722ad464 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -10,15 +10,22 @@ #include "core/fxcrt/fx_extension.h" #include "third_party/base/stl_util.h" #include "xfa/fxfa/cxfa_ffnotify.h" +#include "xfa/fxfa/parser/cxfa_bind.h" +#include "xfa/fxfa/parser/cxfa_border.h" +#include "xfa/fxfa/parser/cxfa_calculate.h" +#include "xfa/fxfa/parser/cxfa_caption.h" #include "xfa/fxfa/parser/cxfa_comb.h" #include "xfa/fxfa/parser/cxfa_decimal.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_eventdata.h" +#include "xfa/fxfa/parser/cxfa_font.h" #include "xfa/fxfa/parser/cxfa_format.h" #include "xfa/fxfa/parser/cxfa_items.h" #include "xfa/fxfa/parser/cxfa_localevalue.h" +#include "xfa/fxfa/parser/cxfa_margin.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_node.h" +#include "xfa/fxfa/parser/cxfa_para.h" #include "xfa/fxfa/parser/cxfa_picture.h" #include "xfa/fxfa/parser/cxfa_ui.h" #include "xfa/fxfa/parser/cxfa_validate.h" @@ -76,8 +83,8 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { eWidgetType = XFA_Element::Unknown; XFA_Element eUIType = XFA_Element::Unknown; - auto* defValue = static_cast( - pNode->JSObject()->GetProperty(0, XFA_Element::Value, true)); + auto* defValue = + pNode->JSObject()->GetProperty(0, XFA_Element::Value, true); XFA_Element eValueType = defValue ? defValue->GetChildValueClassID() : XFA_Element::Unknown; switch (eValueType) { @@ -114,7 +121,8 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { } CXFA_Node* pUIChild = nullptr; - CXFA_Node* pUI = pNode->JSObject()->GetProperty(0, XFA_Element::Ui, true); + CXFA_Ui* 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(); @@ -160,9 +168,9 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { if (!pUIChild) { if (eUIType == XFA_Element::Unknown) { eUIType = XFA_Element::TextEdit; - defValue->JSObject()->GetProperty(0, XFA_Element::Text, true); + defValue->JSObject()->GetProperty(0, XFA_Element::Text, true); } - return pUI->JSObject()->GetProperty(0, eUIType, true); + return pUI->JSObject()->GetProperty(0, eUIType, true); } if (eUIType != XFA_Element::Unknown) @@ -205,7 +213,7 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { eValueType = XFA_Element::Text; break; } - defValue->JSObject()->GetProperty(0, eValueType, true); + defValue->JSObject()->GetProperty(0, eValueType, true); return pUIChild; } @@ -253,28 +261,28 @@ int32_t CXFA_WidgetData::GetRotate() const { } CXFA_BorderData CXFA_WidgetData::GetBorderData(bool bModified) { - return CXFA_BorderData( - m_pNode->JSObject()->GetProperty(0, XFA_Element::Border, bModified)); + return CXFA_BorderData(m_pNode->JSObject()->GetProperty( + 0, XFA_Element::Border, bModified)); } CXFA_CaptionData CXFA_WidgetData::GetCaptionData() { - return CXFA_CaptionData( - m_pNode->JSObject()->GetProperty(0, XFA_Element::Caption, false)); + return CXFA_CaptionData(m_pNode->JSObject()->GetProperty( + 0, XFA_Element::Caption, false)); } CXFA_FontData CXFA_WidgetData::GetFontData(bool bModified) { - return CXFA_FontData( - m_pNode->JSObject()->GetProperty(0, XFA_Element::Font, bModified)); + return CXFA_FontData(m_pNode->JSObject()->GetProperty( + 0, XFA_Element::Font, bModified)); } CXFA_MarginData CXFA_WidgetData::GetMarginData() { - return CXFA_MarginData( - m_pNode->JSObject()->GetProperty(0, XFA_Element::Margin, false)); + return CXFA_MarginData(m_pNode->JSObject()->GetProperty( + 0, XFA_Element::Margin, false)); } CXFA_ParaData CXFA_WidgetData::GetParaData() { return CXFA_ParaData( - m_pNode->JSObject()->GetProperty(0, XFA_Element::Para, false)); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Para, false)); } std::vector CXFA_WidgetData::GetEventList() { @@ -307,28 +315,28 @@ std::vector CXFA_WidgetData::GetEventByActivity( CXFA_Value* CXFA_WidgetData::GetDefaultValue() { CXFA_Node* pTemNode = m_pNode->GetTemplateNode(); - return static_cast( - pTemNode->JSObject()->GetProperty(0, XFA_Element::Value, false)); + return pTemNode->JSObject()->GetProperty(0, XFA_Element::Value, + false); } CXFA_Value* CXFA_WidgetData::GetFormValue() { - return static_cast( - m_pNode->JSObject()->GetProperty(0, XFA_Element::Value, false)); + return m_pNode->JSObject()->GetProperty(0, XFA_Element::Value, + false); } CXFA_CalculateData CXFA_WidgetData::GetCalculateData() { - return CXFA_CalculateData( - m_pNode->JSObject()->GetProperty(0, XFA_Element::Calculate, false)); + return CXFA_CalculateData(m_pNode->JSObject()->GetProperty( + 0, XFA_Element::Calculate, false)); } CXFA_Validate* CXFA_WidgetData::GetValidate(bool bModified) { - return static_cast( - m_pNode->JSObject()->GetProperty(0, XFA_Element::Validate, bModified)); + return m_pNode->JSObject()->GetProperty( + 0, XFA_Element::Validate, bModified); } CXFA_BindData CXFA_WidgetData::GetBindData() { return CXFA_BindData( - m_pNode->JSObject()->GetProperty(0, XFA_Element::Bind, false)); + m_pNode->JSObject()->GetProperty(0, XFA_Element::Bind, false)); } pdfium::Optional CXFA_WidgetData::TryWidth() { @@ -357,15 +365,16 @@ pdfium::Optional CXFA_WidgetData::TryMaxHeight() { CXFA_BorderData CXFA_WidgetData::GetUIBorderData() { CXFA_Node* pUIChild = GetUIChild(); - return CXFA_BorderData(pUIChild ? pUIChild->JSObject()->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->JSObject()->GetProperty( + CXFA_MarginData(pUIChild ? pUIChild->JSObject()->GetProperty( 0, XFA_Element::Margin, false) : nullptr); diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 6b7488c4a7..551f9df3fa 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -60,7 +60,7 @@ CXFA_Node* FormValueNode_CreateChild(CXFA_Node* pValueNode, XFA_Element iType) { if (!pChildNode) { if (iType == XFA_Element::Unknown) return nullptr; - pChildNode = pValueNode->JSObject()->GetProperty(0, iType, true); + pChildNode = pValueNode->JSObject()->GetProperty(0, iType, true); } return pChildNode; } @@ -132,8 +132,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, CXFA_WidgetData* pWidgetData = pFormNode->GetWidgetData(); ASSERT(pWidgetData); XFA_Element eUIType = pWidgetData->GetUIType(); - auto* defValue = static_cast( - pFormNode->JSObject()->GetProperty(0, XFA_Element::Value, true)); + auto* defValue = pFormNode->JSObject()->GetProperty( + 0, XFA_Element::Value, true); if (!bDataToForm) { WideString wsValue; switch (eUIType) { @@ -240,8 +240,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (pChild->GetElementType() != XFA_Element::Field) continue; - CXFA_Node* pValue = - pChild->JSObject()->GetProperty(0, XFA_Element::Value, true); + CXFA_Value* pValue = pChild->JSObject()->GetProperty( + 0, XFA_Element::Value, true); CXFA_Items* pItems = pChild->GetChild(0, XFA_Element::Items, false); CXFA_Node* pText = @@ -265,8 +265,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, wsValue = pWidgetData->NormalizeNumStr(wsValue); pDataNode->JSObject()->SetAttributeValue( wsValue, pWidgetData->GetFormatDataValue(wsValue), false, false); - CXFA_Node* pValue = - pFormNode->JSObject()->GetProperty(0, XFA_Element::Value, true); + CXFA_Value* pValue = pFormNode->JSObject()->GetProperty( + 0, XFA_Element::Value, true); FormValueNode_SetChildContent(pValue, wsValue, XFA_Element::Float); break; } -- cgit v1.2.3