Remove CPDF_FormField::LoadDA().
CPDF_FormField::LoadDA() loads some font resources, but nobody uses them
afterwards.
Change-Id: I49e73ce38ec79dc4c6a1943b4c3e3585e90a97a6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/96054
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index 69eeb2b..26c1632 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -128,7 +128,6 @@
m_Type = kRichText;
else
m_Type = kText;
- LoadDA();
} else if (type_name == pdfium::form_fields::kCh) {
if (flags & pdfium::form_flags::kChoiceCombo) {
m_Type = kComboBox;
@@ -137,7 +136,6 @@
m_bIsMultiSelectListBox = flags & pdfium::form_flags::kChoiceMultiSelect;
}
m_bUseSelectedIndices = UseSelectedIndicesObject();
- LoadDA();
} else if (type_name == pdfium::form_fields::kSig) {
m_Type = kSign;
}
@@ -838,43 +836,6 @@
return pdfium::Contains(values, GetOptionValue(index));
}
-void CPDF_FormField::LoadDA() {
- RetainPtr<CPDF_Dictionary> pFormDict = m_pForm->GetMutableFormDict();
- if (!pFormDict)
- return;
-
- ByteString DA;
- if (const CPDF_Object* pObj = GetFieldAttr(m_pDict.Get(), "DA"))
- DA = pObj->GetString();
-
- if (DA.IsEmpty())
- DA = pFormDict->GetStringFor("DA");
-
- if (DA.IsEmpty())
- return;
-
- RetainPtr<CPDF_Dictionary> pDR = pFormDict->GetMutableDictFor("DR");
- if (!pDR)
- return;
-
- RetainPtr<CPDF_Dictionary> pFont = pDR->GetMutableDictFor("Font");
- if (!ValidateFontResourceDict(pFont.Get()))
- return;
-
- CPDF_DefaultAppearance appearance(DA);
- absl::optional<ByteString> font_name = appearance.GetFont(&m_FontSize);
- if (!font_name.has_value())
- return;
-
- RetainPtr<CPDF_Dictionary> pFontDict =
- pFont->GetMutableDictFor(font_name.value());
- if (!pFontDict)
- return;
-
- auto* pData = CPDF_DocPageData::FromDocument(m_pForm->GetDocument());
- m_pFont = pData->GetFont(std::move(pFontDict));
-}
-
bool CPDF_FormField::NotifyBeforeSelectionChange(const WideString& value) {
auto* pNotify = m_pForm->GetFormNotify();
return !pNotify || pNotify->BeforeSelectionChange(this, value);
diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h
index ddf5ed3..e222dc6 100644
--- a/core/fpdfdoc/cpdf_formfield.h
+++ b/core/fpdfdoc/cpdf_formfield.h
@@ -19,7 +19,6 @@
#include "core/fxcrt/unowned_ptr.h"
class CPDF_Dictionary;
-class CPDF_Font;
class CPDF_FormControl;
class CPDF_InteractiveForm;
class CPDF_Object;
@@ -140,9 +139,6 @@
// entries are consistent with the value (/V) object.
bool UseSelectedIndicesObject() const;
- float GetFontSize() const { return m_FontSize; }
- CPDF_Font* GetFont() const { return m_pFont.Get(); }
-
const CPDF_Dictionary* GetDict() const { return m_pDict.Get(); }
CPDF_InteractiveForm* GetForm() const { return m_pForm.Get(); }
@@ -188,10 +184,8 @@
bool m_bIsMultiSelectListBox = false;
bool m_bIsUnison = false;
bool m_bUseSelectedIndices = false;
- float m_FontSize = 0;
UnownedPtr<CPDF_InteractiveForm> const m_pForm;
RetainPtr<CPDF_Dictionary> const m_pDict;
- RetainPtr<CPDF_Font> m_pFont;
};
#endif // CORE_FPDFDOC_CPDF_FORMFIELD_H_