diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-10-25 23:25:58 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-25 23:25:58 +0000 |
commit | 6fe32f898af3eea875fd01a6d18f719d17dd72f3 (patch) | |
tree | f63a1a03d3fffc3e4e765442df9805b526660765 /fpdfsdk/formfiller/cffl_interactiveformfiller.h | |
parent | ed7da31f67e93c8923669ad496126aa005a8d3a2 (diff) | |
download | pdfium-6fe32f898af3eea875fd01a6d18f719d17dd72f3.tar.xz |
Make CPWL_Wnd own its pAttachedData.
This requires moving it out of CreateParams, since that must be
a copyable struct, and implies that currently there is some
questionable sharing going on. To resolve this, introduce a
Clone() method so that each window gets its own copy.
Make GetAttachedData() return a const pointer, so that callers
can't free it behind our back.
Tidy initializations along the way.
Change-Id: Iadc97688b4692bf4fafefe8cff88af88672f7110
Reviewed-on: https://pdfium-review.googlesource.com/c/44590
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/formfiller/cffl_interactiveformfiller.h')
-rw-r--r-- | fpdfsdk/formfiller/cffl_interactiveformfiller.h | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index bf9fa3c09c..f4c24e3f56 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h @@ -131,26 +131,28 @@ class CFFL_InteractiveFormFiller final : public IPWL_Filler_Notify { std::map<CPDFSDK_Annot*, std::unique_ptr<CFFL_FormFiller>>; // IPWL_Filler_Notify: - void QueryWherePopup(CPWL_Wnd::PrivateData* pAttached, + void QueryWherePopup(const CPWL_Wnd::PrivateData* pAttached, float fPopupMin, float fPopupMax, bool* bBottom, float* fPopupRet) override; // Returns {bRC, bExit}. - std::pair<bool, bool> OnBeforeKeyStroke(CPWL_Wnd::PrivateData* pAttached, - WideString& strChange, - const WideString& strChangeEx, - int nSelStart, - int nSelEnd, - bool bKeyDown, - uint32_t nFlag) override; + std::pair<bool, bool> OnBeforeKeyStroke( + const CPWL_Wnd::PrivateData* pAttached, + WideString& strChange, + const WideString& strChangeEx, + int nSelStart, + int nSelEnd, + bool bKeyDown, + uint32_t nFlag) override; #ifdef PDF_ENABLE_XFA - bool OnPopupPreOpen(CPWL_Wnd::PrivateData* pAttached, + bool OnPopupPreOpen(const CPWL_Wnd::PrivateData* pAttached, uint32_t nFlag) override; - bool OnPopupPostOpen(CPWL_Wnd::PrivateData* pAttached, + bool OnPopupPostOpen(const CPWL_Wnd::PrivateData* pAttached, uint32_t nFlag) override; void SetFocusAnnotTab(CPDFSDK_Annot* pWidget, bool bSameField, bool bNext); #endif // PDF_ENABLE_XFA + void UnRegisterFormFiller(CPDFSDK_Annot* pAnnot); UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv; @@ -160,10 +162,17 @@ class CFFL_InteractiveFormFiller final : public IPWL_Filler_Notify { class CFFL_PrivateData final : public CPWL_Wnd::PrivateData { public: - CPDFSDK_Widget* pWidget; - CPDFSDK_PageView* pPageView; - uint32_t nWidgetAppearanceAge; - uint32_t nWidgetValueAge; + CFFL_PrivateData(); + CFFL_PrivateData(const CFFL_PrivateData& that); + ~CFFL_PrivateData() override; + + // CPWL_Wnd::PrivateData: + std::unique_ptr<CPWL_Wnd::PrivateData> Clone() const override; + + CPDFSDK_Widget* pWidget = nullptr; + CPDFSDK_PageView* pPageView = nullptr; + uint32_t nWidgetAppearanceAge = 0; + uint32_t nWidgetValueAge = 0; }; #endif // FPDFSDK_FORMFILLER_CFFL_INTERACTIVEFORMFILLER_H_ |