From 2d7cb9267899902ce455165303e2373ac38c867d Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 27 Jun 2018 16:14:51 +0000 Subject: Use unowned ptr for IFWL_ delegates Change-Id: I1e9059242dad254394b73c6fddb010b182e969f0 Reviewed-on: https://pdfium-review.googlesource.com/36230 Commit-Queue: dsinclair Reviewed-by: dsinclair --- xfa/fxfa/cxfa_ffcheckbutton.h | 2 +- xfa/fxfa/cxfa_ffcombobox.h | 6 +++--- xfa/fxfa/cxfa_ffimageedit.h | 3 ++- xfa/fxfa/cxfa_fflistbox.h | 3 ++- xfa/fxfa/cxfa_ffpushbutton.cpp | 1 + xfa/fxfa/cxfa_ffpushbutton.h | 2 +- xfa/fxfa/cxfa_fftextedit.h | 3 ++- 7 files changed, 12 insertions(+), 8 deletions(-) diff --git a/xfa/fxfa/cxfa_ffcheckbutton.h b/xfa/fxfa/cxfa_ffcheckbutton.h index 12519a9543..0bbec75ee5 100644 --- a/xfa/fxfa/cxfa_ffcheckbutton.h +++ b/xfa/fxfa/cxfa_ffcheckbutton.h @@ -44,7 +44,7 @@ class CXFA_FFCheckButton : public CXFA_FFField { void AddUIMargin(XFA_AttributeEnum iCapPlacement); XFA_CHECKSTATE FWLState2XFAState(); - IFWL_WidgetDelegate* m_pOldDelegate = nullptr; + UnownedPtr m_pOldDelegate; CFX_RectF m_rtCheckBox; UnownedPtr button_; }; diff --git a/xfa/fxfa/cxfa_ffcombobox.h b/xfa/fxfa/cxfa_ffcombobox.h index 66f92b2557..d1c710bcc9 100644 --- a/xfa/fxfa/cxfa_ffcombobox.h +++ b/xfa/fxfa/cxfa_ffcombobox.h @@ -7,6 +7,7 @@ #ifndef XFA_FXFA_CXFA_FFCOMBOBOX_H_ #define XFA_FXFA_CXFA_FFCOMBOBOX_H_ +#include "core/fxcrt/unowned_ptr.h" #include "xfa/fxfa/cxfa_ffdropdown.h" class CXFA_EventParam; @@ -59,7 +60,7 @@ class CXFA_FFComboBox : public CXFA_FFDropDown { void SetItemState(int32_t nIndex, bool bSelected); private: - // CXFA_FFField + // CXFA_FFField: bool PtInActiveRect(const CFX_PointF& point) override; bool CommitData() override; bool UpdateFWLData() override; @@ -67,11 +68,10 @@ class CXFA_FFComboBox : public CXFA_FFDropDown { uint32_t GetAlignment(); void FWLEventSelChange(CXFA_EventParam* pParam); - WideString GetCurrentText() const; WideString m_wsNewValue; - IFWL_WidgetDelegate* m_pOldDelegate; + UnownedPtr m_pOldDelegate; }; #endif // XFA_FXFA_CXFA_FFCOMBOBOX_H_ diff --git a/xfa/fxfa/cxfa_ffimageedit.h b/xfa/fxfa/cxfa_ffimageedit.h index 2b84c54360..3359696b42 100644 --- a/xfa/fxfa/cxfa_ffimageedit.h +++ b/xfa/fxfa/cxfa_ffimageedit.h @@ -7,6 +7,7 @@ #ifndef XFA_FXFA_CXFA_FFIMAGEEDIT_H_ #define XFA_FXFA_CXFA_FFIMAGEEDIT_H_ +#include "core/fxcrt/unowned_ptr.h" #include "xfa/fxfa/cxfa_fffield.h" class CXFA_FFImageEdit : public CXFA_FFField { @@ -35,7 +36,7 @@ class CXFA_FFImageEdit : public CXFA_FFField { bool UpdateFWLData() override; bool CommitData() override; - IFWL_WidgetDelegate* m_pOldDelegate; + UnownedPtr m_pOldDelegate; }; #endif // XFA_FXFA_CXFA_FFIMAGEEDIT_H_ diff --git a/xfa/fxfa/cxfa_fflistbox.h b/xfa/fxfa/cxfa_fflistbox.h index feff0b7cbb..4b12b5924d 100644 --- a/xfa/fxfa/cxfa_fflistbox.h +++ b/xfa/fxfa/cxfa_fflistbox.h @@ -7,6 +7,7 @@ #ifndef XFA_FXFA_CXFA_FFLISTBOX_H_ #define XFA_FXFA_CXFA_FFLISTBOX_H_ +#include "core/fxcrt/unowned_ptr.h" #include "xfa/fxfa/cxfa_ffdropdown.h" class CXFA_FFListBox : public CXFA_FFDropDown { @@ -37,7 +38,7 @@ class CXFA_FFListBox : public CXFA_FFDropDown { uint32_t GetAlignment(); - IFWL_WidgetDelegate* m_pOldDelegate; + UnownedPtr m_pOldDelegate; }; #endif // XFA_FXFA_CXFA_FFLISTBOX_H_ diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp index 648a2298a3..295422dcf3 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.cpp +++ b/xfa/fxfa/cxfa_ffpushbutton.cpp @@ -93,6 +93,7 @@ void CXFA_FFPushButton::UnloadWidget() { m_pDownTextLayout.reset(); m_pRollProvider.reset(); m_pDownProvider.reset(); + m_pOldDelegate = nullptr; CXFA_FFField::UnloadWidget(); } diff --git a/xfa/fxfa/cxfa_ffpushbutton.h b/xfa/fxfa/cxfa_ffpushbutton.h index e247ee5e39..73308c0c8f 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.h +++ b/xfa/fxfa/cxfa_ffpushbutton.h @@ -51,7 +51,7 @@ class CXFA_FFPushButton : public CXFA_FFField { std::unique_ptr m_pDownTextLayout; std::unique_ptr m_pRollProvider; std::unique_ptr m_pDownProvider; - IFWL_WidgetDelegate* m_pOldDelegate = nullptr; + UnownedPtr m_pOldDelegate; UnownedPtr button_; }; diff --git a/xfa/fxfa/cxfa_fftextedit.h b/xfa/fxfa/cxfa_fftextedit.h index 9b61373df9..37604c14ba 100644 --- a/xfa/fxfa/cxfa_fftextedit.h +++ b/xfa/fxfa/cxfa_fftextedit.h @@ -9,6 +9,7 @@ #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_string.h" +#include "core/fxcrt/unowned_ptr.h" #include "xfa/fxfa/cxfa_fffield.h" class CFWL_Event; @@ -63,7 +64,7 @@ class CXFA_FFTextEdit : public CXFA_FFField { protected: uint32_t GetAlignment(); - IFWL_WidgetDelegate* m_pOldDelegate; + UnownedPtr m_pOldDelegate; private: bool CommitData() override; -- cgit v1.2.3