diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-01-08 15:53:54 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-08 21:10:54 +0000 |
commit | 64204f591bc27976a7123ec5a88558542486bb3f (patch) | |
tree | 3f62e83d718287b0be4d9a0999ddd8371027f192 /xfa | |
parent | 88c8e2fe2076fa4b5088b912dd92c3b2a56bb3ec (diff) | |
download | pdfium-64204f591bc27976a7123ec5a88558542486bb3f.tar.xz |
Convert XFA_GetLocaleValue to accept a CXFA_Node
This CL changes XFA_GetLocaleValue to accept a CXFA_Node instead of a
CXFA_WidgetAcc.
Change-Id: Id304fd8dafcc6e644058230289e497525702fa79
Reviewed-on: https://pdfium-review.googlesource.com/22470
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fxfa/cxfa_ffdatetimeedit.cpp | 5 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffnumericedit.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.cpp | 10 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_utils.cpp | 11 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_utils.h | 2 |
5 files changed, 14 insertions, 16 deletions
diff --git a/xfa/fxfa/cxfa_ffdatetimeedit.cpp b/xfa/fxfa/cxfa_ffdatetimeedit.cpp index 05d20b203d..c064e0f475 100644 --- a/xfa/fxfa/cxfa_ffdatetimeedit.cpp +++ b/xfa/fxfa/cxfa_ffdatetimeedit.cpp @@ -58,8 +58,7 @@ bool CXFA_FFDateTimeEdit::LoadWidget() { switch (value->GetChildValueClassID()) { case XFA_Element::Date: { if (!wsText.IsEmpty()) { - CXFA_LocaleValue lcValue = - XFA_GetLocaleValue(m_pNode->GetWidgetAcc()); + CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pNode.Get()); CFX_DateTime date = lcValue.GetDate(); if (date.IsSet()) pWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay()); @@ -160,7 +159,7 @@ bool CXFA_FFDateTimeEdit::UpdateFWLData() { auto* normalWidget = static_cast<CFWL_DateTimePicker*>(m_pNormalWidget.get()); normalWidget->SetEditText(wsText); if (IsFocused() && !wsText.IsEmpty()) { - CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pNode->GetWidgetAcc()); + CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pNode.Get()); CFX_DateTime date = lcValue.GetDate(); if (lcValue.IsValid()) { if (date.IsSet()) diff --git a/xfa/fxfa/cxfa_ffnumericedit.cpp b/xfa/fxfa/cxfa_ffnumericedit.cpp index 666f3c0c9b..b437bc2b2a 100644 --- a/xfa/fxfa/cxfa_ffnumericedit.cpp +++ b/xfa/fxfa/cxfa_ffnumericedit.cpp @@ -82,7 +82,7 @@ bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget, WideString& wsText) { return true; WideString wsFormat; - CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pNode->GetWidgetAcc()); + CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(m_pNode.Get()); widgetValue.GetNumericFormat(wsFormat, m_pNode->GetWidgetAcc()->GetLeadDigits(), m_pNode->GetWidgetAcc()->GetFracDigits()); diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index f3caea44f2..da552e1a19 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -580,7 +580,7 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_FFDocView* docView, if (!pLocale) return XFA_EVENTERROR_NotExist; - CXFA_LocaleValue lcValue = XFA_GetLocaleValue(this); + CXFA_LocaleValue lcValue = XFA_GetLocaleValue(GetNode()); if (!lcValue.ValidateValue(lcValue.GetValue(), wsPicture, pLocale, nullptr)) { IXFA_AppProvider* pAppProvider = @@ -2745,7 +2745,7 @@ bool CXFA_WidgetAcc::SetValue(XFA_VALUEPICTURE eValueType, if (!wsPicture.IsEmpty()) { CXFA_LocaleMgr* pLocalMgr = m_pNode->GetDocument()->GetLocalMgr(); IFX_Locale* pLocale = GetLocale(); - CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(this); + CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(GetNode()); bValidate = widgetValue.ValidateValue(wsValue, wsPicture, pLocale, &wsPicture); if (bValidate) { @@ -2777,7 +2777,7 @@ WideString CXFA_WidgetAcc::GetPictureContent(XFA_VALUEPICTURE ePicture) { if (ePicture == XFA_VALUEPICTURE_Raw) return L""; - CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(this); + CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(GetNode()); switch (ePicture) { case XFA_VALUEPICTURE_Display: { if (CXFA_Format* pFormat = @@ -2892,7 +2892,7 @@ WideString CXFA_WidgetAcc::GetValue(XFA_VALUEPICTURE eValueType) { return wsValue; if (IFX_Locale* pLocale = GetLocale()) { - CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(this); + CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(GetNode()); CXFA_LocaleMgr* pLocalMgr = m_pNode->GetDocument()->GetLocalMgr(); switch (widgetValue.GetType()) { case XFA_VT_DATE: { @@ -2932,7 +2932,7 @@ WideString CXFA_WidgetAcc::GetNormalizeDataValue(const WideString& wsValue) { ASSERT(GetNode()); CXFA_LocaleMgr* pLocalMgr = GetNode()->GetDocument()->GetLocalMgr(); IFX_Locale* pLocale = GetLocale(); - CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(this); + CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(GetNode()); if (widgetValue.ValidateValue(wsValue, wsPicture, pLocale, &wsPicture)) { widgetValue = CXFA_LocaleValue(widgetValue.GetType(), wsValue, wsPicture, pLocale, pLocalMgr); diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp index 3342776adb..bc181b5947 100644 --- a/xfa/fxfa/parser/xfa_utils.cpp +++ b/xfa/fxfa/parser/xfa_utils.cpp @@ -144,8 +144,7 @@ bool ContentNodeNeedtoExport(CXFA_Node* pContentNode) { if (pGrandParentNode->GetBindData()) return false; - CXFA_WidgetAcc* pWidgetAcc = pGrandParentNode->GetWidgetAcc(); - XFA_Element eUIType = pWidgetAcc->GetUIType(); + XFA_Element eUIType = pGrandParentNode->GetWidgetAcc()->GetUIType(); if (eUIType == XFA_Element::PasswordEdit) return false; return true; @@ -417,9 +416,9 @@ int XFA_GetMaxFractionalScale() { return FX_ArraySize(fraction_scales); } -CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetAcc* pWidgetAcc) { +CXFA_LocaleValue XFA_GetLocaleValue(CXFA_Node* pNode) { CXFA_Value* pNodeValue = - pWidgetAcc->GetNode()->GetChild<CXFA_Value>(0, XFA_Element::Value, false); + pNode->GetChild<CXFA_Value>(0, XFA_Element::Value, false); if (!pNodeValue) return CXFA_LocaleValue(); @@ -457,8 +456,8 @@ CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetAcc* pWidgetAcc) { iVTType = XFA_VT_NULL; break; } - return CXFA_LocaleValue(iVTType, pWidgetAcc->GetNode()->GetRawValue(), - pWidgetAcc->GetNode()->GetDocument()->GetLocalMgr()); + return CXFA_LocaleValue(iVTType, pNode->GetRawValue(), + pNode->GetDocument()->GetLocalMgr()); } bool XFA_FDEExtension_ResolveNamespaceQualifier(CFX_XMLElement* pNode, diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h index 9317a783c4..9308157b1f 100644 --- a/xfa/fxfa/parser/xfa_utils.h +++ b/xfa/fxfa/parser/xfa_utils.h @@ -23,7 +23,7 @@ bool XFA_FDEExtension_ResolveNamespaceQualifier(CFX_XMLElement* pNode, const WideString& wsQualifier, WideString* wsNamespaceURI); -CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetAcc* pWidgetAcc); +CXFA_LocaleValue XFA_GetLocaleValue(CXFA_Node* pNode); int32_t XFA_MapRotation(int32_t nRotation); bool XFA_RecognizeRichText(CFX_XMLElement* pRichTextXMLNode); |