From e4f2f4a3f4fd3e9f372912f4151d7c7843f9556f Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 15 Oct 2018 18:51:11 +0000 Subject: Use more UnownedPtr in CPDF_FormControl. To make this work, remove an UnownedPtr vector in CPDF_FormField and make CPDF_InteractiveForm manage it instead. Also simplify some code within CPDF_FormControl and CPDF_InteractiveForm. Change-Id: Ifc3a979dcdb992376a48db7a40840d2e76078500 Reviewed-on: https://pdfium-review.googlesource.com/c/43938 Commit-Queue: Lei Zhang Reviewed-by: Tom Sepez --- core/fpdfdoc/cpdf_formfield.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'core/fpdfdoc/cpdf_formfield.h') diff --git a/core/fpdfdoc/cpdf_formfield.h b/core/fpdfdoc/cpdf_formfield.h index ce12169a71..2c525cbdea 100644 --- a/core/fpdfdoc/cpdf_formfield.h +++ b/core/fpdfdoc/cpdf_formfield.h @@ -111,9 +111,7 @@ class CPDF_FormField { int CountControls() const; - CPDF_FormControl* GetControl(int index) const { - return m_ControlList[index].Get(); - } + CPDF_FormControl* GetControl(int index) const; int GetControlIndex(const CPDF_FormControl* pControl) const; FormFieldType GetFieldType() const; @@ -172,10 +170,6 @@ class CPDF_FormField { WideString GetCheckValue(bool bDefault) const; - void AddFormControl(CPDF_FormControl* pFormControl) { - m_ControlList.emplace_back(pFormControl); - } - void SetOpt(std::unique_ptr pOpt); private: @@ -197,6 +191,8 @@ class CPDF_FormField { bool NotifyListOrComboBoxBeforeChange(const WideString& value); void NotifyListOrComboBoxAfterChange(); + const std::vector>& GetControls() const; + CPDF_FormField::Type m_Type = kUnknown; uint32_t m_Flags = 0; bool m_bReadOnly = false; @@ -205,8 +201,6 @@ class CPDF_FormField { UnownedPtr const m_pForm; UnownedPtr const m_pDict; - // Owned by InteractiveForm parent. - std::vector> m_ControlList; float m_FontSize = 0; UnownedPtr m_pFont; }; -- cgit v1.2.3