diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-14 18:34:43 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-14 18:34:43 +0000 |
commit | d1b1127cd452a173ec119587c3a6e137e27df6d7 (patch) | |
tree | 4fa719620920ad545ce2346904d253253659d4ab | |
parent | a5b0e63b66e8bc8744677f4e5b8de2fe2c1b1a7b (diff) | |
download | pdfium-d1b1127cd452a173ec119587c3a6e137e27df6d7.tar.xz |
Cleanup const refs and some enums
This CL cleans up some const refs and some enum values from the previous
rename CLs.
Change-Id: Ifaa990c9c45485bb059e0bda0026093d0a2c0944
Reviewed-on: https://pdfium-review.googlesource.com/18230
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
-rw-r--r-- | fxjs/cfxjse_engine.cpp | 16 | ||||
-rw-r--r-- | fxjs/cfxjse_engine.h | 6 | ||||
-rw-r--r-- | fxjs/cfxjse_resolveprocessor.cpp | 6 | ||||
-rw-r--r-- | fxjs/cjx_hostpseudomodel.cpp | 2 | ||||
-rw-r--r-- | testing/xfa_js_embedder_test.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffcheckbutton.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffcheckbutton.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fffield.cpp | 24 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fffield.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.cpp | 31 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.cpp | 9 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_boxdata.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_imagedata.cpp | 13 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_imagedata.h | 13 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_scriptdata.cpp | 17 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_scriptdata.h | 10 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_resolvenode_rs.h | 6 |
19 files changed, 86 insertions, 87 deletions
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp index 799c3bb032..633966173a 100644 --- a/fxjs/cfxjse_engine.cpp +++ b/fxjs/cfxjse_engine.cpp @@ -130,7 +130,7 @@ CFXJSE_Engine::CFXJSE_Engine(CXFA_Document* pDocument, v8::Isolate* pIsolate) pDocument->GetRoot())), m_pIsolate(pIsolate), m_pJsClass(nullptr), - m_eScriptType(XFA_SCRIPTLANGTYPE_Unkown), + m_eScriptType(XFA_ScriptDataType::Unknown), m_pScriptNodeArray(nullptr), m_ResolveProcessor(pdfium::MakeUnique<CFXJSE_ResolveProcessor>()), m_pThisObject(nullptr), @@ -150,14 +150,14 @@ CFXJSE_Engine::~CFXJSE_Engine() { delete ToThisProxy(pair.second->GetGlobalObject().get(), nullptr); } -bool CFXJSE_Engine::RunScript(XFA_SCRIPTLANGTYPE eScriptType, +bool CFXJSE_Engine::RunScript(XFA_ScriptDataType eScriptType, const WideStringView& wsScript, CFXJSE_Value* hRetValue, CXFA_Object* pThisObject) { ByteString btScript; - AutoRestorer<XFA_SCRIPTLANGTYPE> typeRestorer(&m_eScriptType); + AutoRestorer<XFA_ScriptDataType> typeRestorer(&m_eScriptType); m_eScriptType = eScriptType; - if (eScriptType == XFA_SCRIPTLANGTYPE_Formcalc) { + if (eScriptType == XFA_ScriptDataType::Formcalc) { if (!m_FM2JSContext) { m_FM2JSContext = pdfium::MakeUnique<CFXJSE_FormCalcContext>( m_pIsolate, m_JsContext.get(), m_pDocument.Get()); @@ -243,7 +243,7 @@ void CFXJSE_Engine::GlobalPropertyGetter(CFXJSE_Value* pObject, CFXJSE_Engine* lpScriptContext = pDoc->GetScriptContext(); CXFA_Object* lpCurNode = lpScriptContext->GetVariablesThis(pOriginalObject); WideString wsPropName = WideString::FromUTF8(szPropName); - if (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Formcalc) { + if (lpScriptContext->GetType() == XFA_ScriptDataType::Formcalc) { if (szPropName == kFormCalcRuntime) { lpScriptContext->m_FM2JSContext->GlobalPropertyGetter(pValue); return; @@ -319,7 +319,7 @@ void CFXJSE_Engine::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, return; if (pObject == lpScriptContext->GetThisObject() || - (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Javascript && + (lpScriptContext->GetType() == XFA_ScriptDataType::Javascript && !lpScriptContext->IsStrictScopeInJavaScript())) { dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; bRet = lpScriptContext->QueryNodeByFlag(ToNode(pObject), @@ -454,7 +454,7 @@ bool CFXJSE_Engine::IsStrictScopeInJavaScript() { return m_pDocument->HasFlag(XFA_DOCFLAG_StrictScoping); } -XFA_SCRIPTLANGTYPE CFXJSE_Engine::GetType() { +XFA_ScriptDataType CFXJSE_Engine::GetType() { return m_eScriptType; } @@ -573,7 +573,7 @@ int32_t CFXJSE_Engine::ResolveObjects(CXFA_Object* refObject, if (wsExpression.IsEmpty()) return 0; - if (m_eScriptType != XFA_SCRIPTLANGTYPE_Formcalc || + if (m_eScriptType != XFA_ScriptDataType::Formcalc || (dwStyles & (XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings))) { m_upObjectArray.clear(); } diff --git a/fxjs/cfxjse_engine.h b/fxjs/cfxjse_engine.h index bfc2cc1fd9..b049eecf56 100644 --- a/fxjs/cfxjse_engine.h +++ b/fxjs/cfxjse_engine.h @@ -28,7 +28,7 @@ class CFXJSE_Engine { void SetEventParam(CXFA_EventParam param) { m_eventParam = param; } CXFA_EventParam* GetEventParam() { return &m_eventParam; } - bool RunScript(XFA_SCRIPTLANGTYPE eScriptType, + bool RunScript(XFA_ScriptDataType eScriptType, const WideStringView& wsScript, CFXJSE_Value* pRetValue, CXFA_Object* pThisObject); @@ -89,7 +89,7 @@ class CFXJSE_Engine { bool RunVariablesScript(CXFA_Node* pScriptNode); CXFA_Object* GetVariablesThis(CXFA_Object* pObject, bool bScriptNode = false); bool IsStrictScopeInJavaScript(); - XFA_SCRIPTLANGTYPE GetType(); + XFA_ScriptDataType GetType(); std::vector<CXFA_Node*>* GetUpObjectArray() { return &m_upObjectArray; } CXFA_Document* GetDocument() const { return m_pDocument.Get(); } @@ -104,7 +104,7 @@ class CFXJSE_Engine { std::unique_ptr<CFXJSE_Context> m_JsContext; v8::Isolate* m_pIsolate; CFXJSE_Class* m_pJsClass; - XFA_SCRIPTLANGTYPE m_eScriptType; + XFA_ScriptDataType m_eScriptType; std::map<CXFA_Object*, std::unique_ptr<CFXJSE_Value>> m_mapObjectToValue; std::map<CXFA_Object*, std::unique_ptr<CFXJSE_Context>> m_mapVariableToContext; diff --git a/fxjs/cfxjse_resolveprocessor.cpp b/fxjs/cfxjse_resolveprocessor.cpp index 2ca3a44525..7802957c7c 100644 --- a/fxjs/cfxjse_resolveprocessor.cpp +++ b/fxjs/cfxjse_resolveprocessor.cpp @@ -663,11 +663,11 @@ void CFXJSE_ResolveProcessor::DoPredicateFilter(int32_t iCurIndex, CFXJSE_ResolveNodeData& rnd) { ASSERT(iFoundCount == pdfium::CollectionSize<int32_t>(rnd.m_Objects)); WideString wsExpression; - XFA_SCRIPTLANGTYPE eLangType = XFA_SCRIPTLANGTYPE_Unkown; + XFA_ScriptDataType eLangType = XFA_ScriptDataType::Unknown; if (wsCondition.Left(2) == L".[" && wsCondition.Last() == L']') { - eLangType = XFA_SCRIPTLANGTYPE_Formcalc; + eLangType = XFA_ScriptDataType::Formcalc; } else if (wsCondition.Left(2) == L".(" && wsCondition.Last() == L')') { - eLangType = XFA_SCRIPTLANGTYPE_Javascript; + eLangType = XFA_ScriptDataType::Javascript; } else { return; } diff --git a/fxjs/cjx_hostpseudomodel.cpp b/fxjs/cjx_hostpseudomodel.cpp index 0671f5ecf9..090f23f7cd 100644 --- a/fxjs/cjx_hostpseudomodel.cpp +++ b/fxjs/cjx_hostpseudomodel.cpp @@ -529,7 +529,7 @@ bool CJX_HostPseudoModel::ValidateArgsForMsg(CFXJSE_Arguments* pArguments, bool bIsJsType = false; if (GetDocument()->GetScriptContext()->GetType() == - XFA_SCRIPTLANGTYPE_Javascript) { + XFA_ScriptDataType::Javascript) { bIsJsType = true; } diff --git a/testing/xfa_js_embedder_test.cpp b/testing/xfa_js_embedder_test.cpp index 54ad15a892..68a0c109d4 100644 --- a/testing/xfa_js_embedder_test.cpp +++ b/testing/xfa_js_embedder_test.cpp @@ -74,7 +74,7 @@ bool XFAJSEmbedderTest::ExecuteSilenceFailure(const ByteStringView& input) { bool XFAJSEmbedderTest::ExecuteHelper(const ByteStringView& input) { value_ = pdfium::MakeUnique<CFXJSE_Value>(GetIsolate()); - return script_context_->RunScript(XFA_SCRIPTLANGTYPE_Formcalc, + return script_context_->RunScript(XFA_ScriptDataType::Formcalc, WideString::FromUTF8(input).AsStringView(), value_.get(), GetXFADocument()->GetRoot()); } diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp index ae73ba43fe..a9d47d17bb 100644 --- a/xfa/fxfa/cxfa_ffcheckbutton.cpp +++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp @@ -189,7 +189,7 @@ bool CXFA_FFCheckButton::PerformLayout() { } void CXFA_FFCheckButton::CapLeftRightPlacement( - CXFA_MarginData captionMarginData) { + const CXFA_MarginData& captionMarginData) { XFA_RectWidthoutMargin(m_rtCaption, captionMarginData); if (m_rtCaption.height < 0) m_rtCaption.top += m_rtCaption.height; diff --git a/xfa/fxfa/cxfa_ffcheckbutton.h b/xfa/fxfa/cxfa_ffcheckbutton.h index 4154852788..566e803ad3 100644 --- a/xfa/fxfa/cxfa_ffcheckbutton.h +++ b/xfa/fxfa/cxfa_ffcheckbutton.h @@ -35,7 +35,7 @@ class CXFA_FFCheckButton : public CXFA_FFField { private: bool CommitData() override; bool IsDataChanged() override; - void CapLeftRightPlacement(CXFA_MarginData captionMarginData); + void CapLeftRightPlacement(const CXFA_MarginData& captionMarginData); void AddUIMargin(int32_t iCapPlacement); XFA_CHECKSTATE FWLState2XFAState(); diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp index a58fd00cce..0ef6722d7f 100644 --- a/xfa/fxfa/cxfa_fffield.cpp +++ b/xfa/fxfa/cxfa_fffield.cpp @@ -233,14 +233,16 @@ void CXFA_FFField::CapPlacement() { switch (iCapPlacement) { case XFA_ATTRIBUTEENUM_Left: { m_rtCaption.width = fCapReserve; - CapLeftRightPlacement(captionData, rtWidget, iCapPlacement); + CapLeftRightPlacement(captionData.GetMarginData(), rtWidget, + iCapPlacement); m_rtUI.width -= fCapReserve; m_rtUI.left += fCapReserve; break; } case XFA_ATTRIBUTEENUM_Top: { m_rtCaption.height = fCapReserve; - CapTopBottomPlacement(captionData, rtWidget, iCapPlacement); + CapTopBottomPlacement(captionData.GetMarginData(), rtWidget, + iCapPlacement); m_rtUI.top += fCapReserve; m_rtUI.height -= fCapReserve; break; @@ -248,14 +250,16 @@ void CXFA_FFField::CapPlacement() { case XFA_ATTRIBUTEENUM_Right: { m_rtCaption.left = m_rtCaption.right() - fCapReserve; m_rtCaption.width = fCapReserve; - CapLeftRightPlacement(captionData, rtWidget, iCapPlacement); + CapLeftRightPlacement(captionData.GetMarginData(), rtWidget, + iCapPlacement); m_rtUI.width -= fCapReserve; break; } case XFA_ATTRIBUTEENUM_Bottom: { m_rtCaption.top = m_rtCaption.bottom() - fCapReserve; m_rtCaption.height = fCapReserve; - CapTopBottomPlacement(captionData, rtWidget, iCapPlacement); + CapTopBottomPlacement(captionData.GetMarginData(), rtWidget, + iCapPlacement); m_rtUI.height -= fCapReserve; break; } @@ -274,13 +278,13 @@ void CXFA_FFField::CapPlacement() { m_rtUI.Normalize(); } -void CXFA_FFField::CapTopBottomPlacement(CXFA_CaptionData captionData, +void CXFA_FFField::CapTopBottomPlacement(const CXFA_MarginData& marginData, const CFX_RectF& rtWidget, int32_t iCapPlacement) { CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin(); m_rtCaption.left += rtUIMargin.left; - if (CXFA_MarginData captionMarginData = captionData.GetMarginData()) { - XFA_RectWidthoutMargin(m_rtCaption, captionMarginData); + if (marginData) { + XFA_RectWidthoutMargin(m_rtCaption, marginData); if (m_rtCaption.height < 0) m_rtCaption.top += m_rtCaption.height; } @@ -300,14 +304,14 @@ void CXFA_FFField::CapTopBottomPlacement(CXFA_CaptionData captionData, } } -void CXFA_FFField::CapLeftRightPlacement(CXFA_CaptionData captionData, +void CXFA_FFField::CapLeftRightPlacement(const CXFA_MarginData& marginData, const CFX_RectF& rtWidget, int32_t iCapPlacement) { CFX_RectF rtUIMargin = m_pDataAcc->GetUIMargin(); m_rtCaption.top += rtUIMargin.top; m_rtCaption.height -= rtUIMargin.top; - if (CXFA_MarginData captionMarginData = captionData.GetMarginData()) { - XFA_RectWidthoutMargin(m_rtCaption, captionMarginData); + if (marginData) { + XFA_RectWidthoutMargin(m_rtCaption, marginData); if (m_rtCaption.height < 0) m_rtCaption.top += m_rtCaption.height; } diff --git a/xfa/fxfa/cxfa_fffield.h b/xfa/fxfa/cxfa_fffield.h index 7d4320717f..dc6e916d18 100644 --- a/xfa/fxfa/cxfa_fffield.h +++ b/xfa/fxfa/cxfa_fffield.h @@ -83,10 +83,10 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { void DrawFocus(CXFA_Graphics* pGS, CFX_Matrix* pMatrix); void TranslateFWLMessage(CFWL_Message* pMessage); void CapPlacement(); - void CapTopBottomPlacement(CXFA_CaptionData captionData, + void CapTopBottomPlacement(const CXFA_MarginData& marginData, const CFX_RectF& rtWidget, int32_t iCapPlacement); - void CapLeftRightPlacement(CXFA_CaptionData captionData, + void CapLeftRightPlacement(const CXFA_MarginData& marginData, const CFX_RectF& rtWidget, int32_t iCapPlacement); void SetEditScrollOffset(); diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 4f5c66ef7b..d3a6498c4e 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -39,7 +39,7 @@ namespace { -void XFA_BOX_GetPath_Arc(CXFA_BoxData boxData, +void XFA_BOX_GetPath_Arc(const CXFA_BoxData& boxData, CFX_RectF rtDraw, CXFA_Path& fillPath, uint32_t dwFlags) { @@ -234,7 +234,7 @@ void XFA_BOX_GetPath(const std::vector<CXFA_StrokeData>& strokes, } } -void XFA_BOX_GetFillPath(CXFA_BoxData boxData, +void XFA_BOX_GetFillPath(const CXFA_BoxData& boxData, const std::vector<CXFA_StrokeData>& strokes, CFX_RectF rtWidget, CXFA_Path& fillPath, @@ -384,12 +384,12 @@ void XFA_BOX_GetFillPath(CXFA_BoxData boxData, } } -void XFA_BOX_Fill_Radial(CXFA_BoxData boxData, +void XFA_BOX_Fill_Radial(const CXFA_BoxData& boxData, CXFA_Graphics* pGS, CXFA_Path& fillPath, CFX_RectF rtFill, const CFX_Matrix& matrix) { - CXFA_FillData fillData = boxData.GetFillData(); + CXFA_FillData fillData = boxData.GetFillData(false); FX_ARGB crStart, crEnd; crStart = fillData.GetColor(); int32_t iType = fillData.GetRadial(crEnd); @@ -407,12 +407,12 @@ void XFA_BOX_Fill_Radial(CXFA_BoxData boxData, pGS->FillPath(&fillPath, FXFILL_WINDING, &matrix); } -void XFA_BOX_Fill_Pattern(CXFA_BoxData boxData, +void XFA_BOX_Fill_Pattern(const CXFA_BoxData& boxData, CXFA_Graphics* pGS, CXFA_Path& fillPath, CFX_RectF rtFill, const CFX_Matrix& matrix) { - CXFA_FillData fillData = boxData.GetFillData(); + CXFA_FillData fillData = boxData.GetFillData(false); FX_ARGB crStart, crEnd; crStart = fillData.GetColor(); int32_t iType = fillData.GetPattern(crEnd); @@ -442,12 +442,12 @@ void XFA_BOX_Fill_Pattern(CXFA_BoxData boxData, pGS->FillPath(&fillPath, FXFILL_WINDING, &matrix); } -void XFA_BOX_Fill_Linear(CXFA_BoxData boxData, +void XFA_BOX_Fill_Linear(const CXFA_BoxData& boxData, CXFA_Graphics* pGS, CXFA_Path& fillPath, CFX_RectF rtFill, const CFX_Matrix& matrix) { - CXFA_FillData fillData = boxData.GetFillData(); + CXFA_FillData fillData = boxData.GetFillData(false); FX_ARGB crStart = fillData.GetColor(); FX_ARGB crEnd; int32_t iType = fillData.GetLinear(crEnd); @@ -478,13 +478,13 @@ void XFA_BOX_Fill_Linear(CXFA_BoxData boxData, pGS->FillPath(&fillPath, FXFILL_WINDING, &matrix); } -void XFA_BOX_Fill(CXFA_BoxData boxData, +void XFA_BOX_Fill(const CXFA_BoxData& boxData, const std::vector<CXFA_StrokeData>& strokes, CXFA_Graphics* pGS, const CFX_RectF& rtWidget, const CFX_Matrix& matrix, uint32_t dwFlags) { - CXFA_FillData fillData = boxData.GetFillData(); + CXFA_FillData fillData = boxData.GetFillData(false); if (!fillData || fillData.GetPresence() != XFA_ATTRIBUTEENUM_Visible) return; @@ -524,7 +524,7 @@ void XFA_BOX_Fill(CXFA_BoxData boxData, pGS->RestoreGraphState(); } -void XFA_BOX_StrokePath(CXFA_StrokeData strokeData, +void XFA_BOX_StrokePath(const CXFA_StrokeData& strokeData, CXFA_Path* pPath, CXFA_Graphics* pGS, const CFX_Matrix& matrix) { @@ -549,7 +549,7 @@ void XFA_BOX_StrokePath(CXFA_StrokeData strokeData, pGS->RestoreGraphState(); } -void XFA_BOX_StrokeArc(CXFA_BoxData boxData, +void XFA_BOX_StrokeArc(const CXFA_BoxData& boxData, CXFA_Graphics* pGS, CFX_RectF rtWidget, const CFX_Matrix& matrix, @@ -1008,14 +1008,14 @@ bool CXFA_FFWidget::UpdateFWLData() { void CXFA_FFWidget::UpdateWidgetProperty() {} void CXFA_FFWidget::DrawBorder(CXFA_Graphics* pGS, - CXFA_BoxData boxData, + const CXFA_BoxData& boxData, const CFX_RectF& rtBorder, const CFX_Matrix& matrix) { XFA_DrawBox(boxData, pGS, rtBorder, matrix, 0); } void CXFA_FFWidget::DrawBorderWithFlags(CXFA_Graphics* pGS, - CXFA_BoxData boxData, + const CXFA_BoxData& boxData, const CFX_RectF& rtBorder, const CFX_Matrix& matrix, uint32_t dwFlags) { @@ -1890,8 +1890,7 @@ RetainPtr<CFX_DIBitmap> XFA_LoadImageData(CXFA_FFDoc* pDoc, uint8_t* pImageBuffer = nullptr; RetainPtr<IFX_SeekableReadStream> pImageFileRead; if (wsImage.GetLength() > 0) { - XFA_ATTRIBUTEENUM iEncoding = - (XFA_ATTRIBUTEENUM)pImageData->GetTransferEncoding(); + XFA_ATTRIBUTEENUM iEncoding = pImageData->GetTransferEncoding(); if (iEncoding == XFA_ATTRIBUTEENUM_Base64) { ByteString bsData = wsImage.UTF8Encode(); int32_t iLength = bsData.GetLength(); diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h index b750a2db2b..7bc3d6b682 100644 --- a/xfa/fxfa/cxfa_ffwidget.h +++ b/xfa/fxfa/cxfa_ffwidget.h @@ -165,11 +165,11 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { virtual bool PtInActiveRect(const CFX_PointF& point); void DrawBorder(CXFA_Graphics* pGS, - CXFA_BoxData boxData, + const CXFA_BoxData& boxData, const CFX_RectF& rtBorder, const CFX_Matrix& matrix); void DrawBorderWithFlags(CXFA_Graphics* pGS, - CXFA_BoxData boxData, + const CXFA_BoxData& boxData, const CFX_RectF& rtBorder, const CFX_Matrix& matrix, uint32_t dwFlags); diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index cb43783bdc..7dab15926a 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -579,7 +579,7 @@ int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) { return iRet | iFormat; } -int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_ScriptData scriptData, +int32_t CXFA_WidgetAcc::ExecuteScript(const CXFA_ScriptData& scriptData, CXFA_EventParam* pEventParam) { bool bRet; int32_t iRet; @@ -605,8 +605,8 @@ std::pair<int32_t, bool> CXFA_WidgetAcc::ExecuteBoolScript( if (wsExpression.IsEmpty()) return {XFA_EVENTERROR_NotExist, false}; - XFA_SCRIPTTYPE eScriptType = scriptData.GetContentType(); - if (eScriptType == XFA_SCRIPTTYPE_Unkown) + XFA_ScriptDataType eScriptType = scriptData.GetContentType(); + if (eScriptType == XFA_ScriptDataType::Unknown) return {XFA_EVENTERROR_Success, false}; CXFA_FFDoc* pDoc = GetDoc(); @@ -622,8 +622,7 @@ std::pair<int32_t, bool> CXFA_WidgetAcc::ExecuteBoolScript( auto pTmpRetValue = pdfium::MakeUnique<CFXJSE_Value>(pContext->GetRuntime()); ++m_nRecursionDepth; - bool bRet = pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType, - wsExpression.AsStringView(), + bool bRet = pContext->RunScript(eScriptType, wsExpression.AsStringView(), pTmpRetValue.get(), m_pNode); --m_nRecursionDepth; int32_t iRet = XFA_EVENTERROR_Error; diff --git a/xfa/fxfa/cxfa_widgetacc.h b/xfa/fxfa/cxfa_widgetacc.h index 7c54f3d1d5..600cc1afed 100644 --- a/xfa/fxfa/cxfa_widgetacc.h +++ b/xfa/fxfa/cxfa_widgetacc.h @@ -49,7 +49,7 @@ class CXFA_WidgetAcc : public CXFA_WidgetData { CXFA_EventParam* pEventParam); int32_t ProcessCalculate(); int32_t ProcessValidate(int32_t iFlags); - int32_t ExecuteScript(CXFA_ScriptData scriptData, + int32_t ExecuteScript(const CXFA_ScriptData& scriptData, CXFA_EventParam* pEventParam); std::pair<int32_t, bool> ExecuteBoolScript(CXFA_ScriptData scriptData, CXFA_EventParam* pEventParam); diff --git a/xfa/fxfa/parser/cxfa_boxdata.h b/xfa/fxfa/parser/cxfa_boxdata.h index b4c348311c..ae946c4666 100644 --- a/xfa/fxfa/parser/cxfa_boxdata.h +++ b/xfa/fxfa/parser/cxfa_boxdata.h @@ -29,7 +29,7 @@ class CXFA_BoxData : public CXFA_Data { int32_t GetHand() const; int32_t GetPresence() const; int32_t CountEdges() const; - CXFA_EdgeData GetEdgeData(int32_t nIndex = 0) const; + CXFA_EdgeData GetEdgeData(int32_t nIndex) const; std::vector<CXFA_StrokeData> GetStrokes() const; bool IsCircular() const; bool GetStartAngle(float& fStartAngle) const; @@ -46,7 +46,7 @@ class CXFA_BoxData : public CXFA_Data { return fSweepAngle; } - CXFA_FillData GetFillData(bool bModified = false) const; + CXFA_FillData GetFillData(bool bModified) const; CXFA_MarginData GetMarginData() const; int32_t Get3DStyle(bool& bVisible, float& fThickness) const; }; diff --git a/xfa/fxfa/parser/cxfa_imagedata.cpp b/xfa/fxfa/parser/cxfa_imagedata.cpp index 3ae6e5df3e..fbe707a9d4 100644 --- a/xfa/fxfa/parser/cxfa_imagedata.cpp +++ b/xfa/fxfa/parser/cxfa_imagedata.cpp @@ -26,9 +26,11 @@ bool CXFA_ImageData::GetHref(WideString& wsHref) { return m_pNode->JSNode()->GetAttribute(L"href", wsHref, true); } -int32_t CXFA_ImageData::GetTransferEncoding() { - if (m_bDefValue) - return m_pNode->JSNode()->GetEnum(XFA_Attribute::TransferEncoding); +XFA_ATTRIBUTEENUM CXFA_ImageData::GetTransferEncoding() { + if (m_bDefValue) { + return static_cast<XFA_ATTRIBUTEENUM>( + m_pNode->JSNode()->GetEnum(XFA_Attribute::TransferEncoding)); + } return XFA_ATTRIBUTEENUM_Base64; } @@ -49,11 +51,10 @@ bool CXFA_ImageData::SetHref(const WideString& wsHref) { wsHref.AsStringView(), false); } -bool CXFA_ImageData::SetTransferEncoding(int32_t iTransferEncoding) { +bool CXFA_ImageData::SetTransferEncoding(XFA_ATTRIBUTEENUM iTransferEncoding) { if (m_bDefValue) { return m_pNode->JSNode()->SetEnum(XFA_Attribute::TransferEncoding, - (XFA_ATTRIBUTEENUM)iTransferEncoding, - false); + iTransferEncoding, false); } return true; } diff --git a/xfa/fxfa/parser/cxfa_imagedata.h b/xfa/fxfa/parser/cxfa_imagedata.h index e94615ae1d..8b3ae43b98 100644 --- a/xfa/fxfa/parser/cxfa_imagedata.h +++ b/xfa/fxfa/parser/cxfa_imagedata.h @@ -18,13 +18,16 @@ class CXFA_ImageData : public CXFA_Data { CXFA_ImageData(CXFA_Node* pNode, bool bDefValue); int32_t GetAspect(); - bool GetContentType(WideString& wsContentType); - bool GetHref(WideString& wsHref); - int32_t GetTransferEncoding(); bool GetContent(WideString& wsText); - bool SetContentType(const WideString& wsContentType); + + bool GetHref(WideString& wsHref); bool SetHref(const WideString& wsHref); - bool SetTransferEncoding(int32_t iTransferEncoding); + + XFA_ATTRIBUTEENUM GetTransferEncoding(); + bool SetTransferEncoding(XFA_ATTRIBUTEENUM iTransferEncoding); + + bool GetContentType(WideString& wsContentType); + bool SetContentType(const WideString& wsContentType); private: bool m_bDefValue; diff --git a/xfa/fxfa/parser/cxfa_scriptdata.cpp b/xfa/fxfa/parser/cxfa_scriptdata.cpp index 1831046352..619dcc14b6 100644 --- a/xfa/fxfa/parser/cxfa_scriptdata.cpp +++ b/xfa/fxfa/parser/cxfa_scriptdata.cpp @@ -10,16 +10,15 @@ CXFA_ScriptData::CXFA_ScriptData(CXFA_Node* pNode) : CXFA_Data(pNode) {} -XFA_SCRIPTTYPE CXFA_ScriptData::GetContentType() { +XFA_ScriptDataType CXFA_ScriptData::GetContentType() { WideStringView cData; - if (m_pNode->JSNode()->TryCData(XFA_Attribute::ContentType, cData, false)) { - if (cData == L"application/x-javascript") - return XFA_SCRIPTTYPE_Javascript; - if (cData == L"application/x-formcalc") - return XFA_SCRIPTTYPE_Formcalc; - return XFA_SCRIPTTYPE_Unkown; - } - return XFA_SCRIPTTYPE_Formcalc; + if (!m_pNode->JSNode()->TryCData(XFA_Attribute::ContentType, cData, false)) + return XFA_ScriptDataType::Formcalc; + if (cData == L"application/x-javascript") + return XFA_ScriptDataType::Javascript; + if (cData == L"application/x-formcalc") + return XFA_ScriptDataType::Formcalc; + return XFA_ScriptDataType::Unknown; } int32_t CXFA_ScriptData::GetRunAt() { diff --git a/xfa/fxfa/parser/cxfa_scriptdata.h b/xfa/fxfa/parser/cxfa_scriptdata.h index f7b8d741fc..36c9a31e7e 100644 --- a/xfa/fxfa/parser/cxfa_scriptdata.h +++ b/xfa/fxfa/parser/cxfa_scriptdata.h @@ -12,10 +12,10 @@ #include "core/fxcrt/fx_string.h" #include "xfa/fxfa/parser/cxfa_data.h" -enum XFA_SCRIPTTYPE { - XFA_SCRIPTTYPE_Formcalc = 0, - XFA_SCRIPTTYPE_Javascript, - XFA_SCRIPTTYPE_Unkown, +enum class XFA_ScriptDataType { + Formcalc = 0, + Javascript, + Unknown, }; class CXFA_Node; @@ -24,7 +24,7 @@ class CXFA_ScriptData : public CXFA_Data { public: explicit CXFA_ScriptData(CXFA_Node* pNode); - XFA_SCRIPTTYPE GetContentType(); + XFA_ScriptDataType GetContentType(); int32_t GetRunAt(); void GetExpression(WideString& wsExpression); }; diff --git a/xfa/fxfa/parser/xfa_resolvenode_rs.h b/xfa/fxfa/parser/xfa_resolvenode_rs.h index c1c8e6b4c7..c5cdeee06f 100644 --- a/xfa/fxfa/parser/xfa_resolvenode_rs.h +++ b/xfa/fxfa/parser/xfa_resolvenode_rs.h @@ -28,12 +28,6 @@ #define XFA_RESOLVENODE_Bind 0x0800 #define XFA_RESOLVENODE_BindNew 0x1000 -enum XFA_SCRIPTLANGTYPE { - XFA_SCRIPTLANGTYPE_Formcalc = XFA_SCRIPTTYPE_Formcalc, - XFA_SCRIPTLANGTYPE_Javascript = XFA_SCRIPTTYPE_Javascript, - XFA_SCRIPTLANGTYPE_Unkown = XFA_SCRIPTTYPE_Unkown, -}; - enum XFA_RESOLVENODE_RSTYPE { XFA_RESOLVENODE_RSTYPE_Nodes, XFA_RESOLVENODE_RSTYPE_Attribute, |