From 4f34c64914be17966f2d91591921dec635582061 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 2 Jun 2017 00:45:14 -0700 Subject: Clean up CFFL formfiller classes. - Consolidate assertions for m_pFormFillEnv. - Remove check for m_pFormFillEnv being NULL. - Pass in a CPDFSDK_Widget* instead of an Annot* and then casting. - Remove unused LoadPopupMenuString() method. Change-Id: Ic22e75c9e41eb54002be812945a3ee80debeca8b Reviewed-on: https://pdfium-review.googlesource.com/6232 Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- fpdfsdk/formfiller/cffl_formfiller.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'fpdfsdk/formfiller/cffl_formfiller.cpp') diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index b104d67b6d..f15efd2462 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -22,9 +22,9 @@ #define FFL_HINT_ELAPSE 800 CFFL_FormFiller::CFFL_FormFiller(CPDFSDK_FormFillEnvironment* pFormFillEnv, - CPDFSDK_Annot* pAnnot) - : m_pFormFillEnv(pFormFillEnv), m_pAnnot(pAnnot), m_bValid(false) { - m_pWidget = static_cast(pAnnot); + CPDFSDK_Widget* pWidget) + : m_pFormFillEnv(pFormFillEnv), m_pWidget(pWidget), m_bValid(false) { + ASSERT(m_pFormFillEnv); } CFFL_FormFiller::~CFFL_FormFiller() { @@ -282,8 +282,6 @@ bool CFFL_FormFiller::IsValid() const { } PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { - ASSERT(m_pFormFillEnv); - PWL_CREATEPARAM cp; cp.pParentWnd = nullptr; cp.pProvider.Reset(this); @@ -422,12 +420,6 @@ CFX_Matrix CFFL_FormFiller::GetCurMatrix() { return mt; } -CFX_WideString CFFL_FormFiller::LoadPopupMenuString(int nIndex) { - ASSERT(m_pFormFillEnv); - - return L""; -} - CFX_FloatRect CFFL_FormFiller::GetPDFWindowRect() const { CFX_FloatRect rectAnnot = m_pWidget->GetPDFAnnot()->GetRect(); @@ -440,8 +432,8 @@ CFX_FloatRect CFFL_FormFiller::GetPDFWindowRect() const { } CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView(bool renew) { - UnderlyingPageType* pPage = m_pAnnot->GetUnderlyingPage(); - return m_pFormFillEnv ? m_pFormFillEnv->GetPageView(pPage, renew) : nullptr; + UnderlyingPageType* pPage = m_pWidget->GetUnderlyingPage(); + return m_pFormFillEnv->GetPageView(pPage, renew); } CFX_FloatRect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) { @@ -585,7 +577,7 @@ void CFFL_FormFiller::InvalidateRect(const FX_RECT& rect) { } CFFL_Button::CFFL_Button(CPDFSDK_FormFillEnvironment* pApp, - CPDFSDK_Annot* pWidget) + CPDFSDK_Widget* pWidget) : CFFL_FormFiller(pApp, pWidget), m_bMouseIn(false), m_bMouseDown(false) {} CFFL_Button::~CFFL_Button() {} @@ -636,7 +628,6 @@ bool CFFL_Button::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, uint32_t nFlags, const CFX_PointF& point) { - ASSERT(m_pFormFillEnv); return true; } -- cgit v1.2.3