diff options
author | tsepez <tsepez@chromium.org> | 2016-09-13 16:08:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-13 16:08:49 -0700 |
commit | 63f545c485c063831ecb58fb492f96fe5f462fd1 (patch) | |
tree | 8c57386bc84f7173b780a7e8bf79a19ec7c3231e /fpdfsdk/formfiller/cffl_formfiller.cpp | |
parent | f86ca3884886506c999a3b521078151e7cda0bf9 (diff) | |
download | pdfium-63f545c485c063831ecb58fb492f96fe5f462fd1.tar.xz |
CFX_FloatPoint default constructor and equals operatorschromium/2860
Review-Url: https://codereview.chromium.org/2341453002
Diffstat (limited to 'fpdfsdk/formfiller/cffl_formfiller.cpp')
-rw-r--r-- | fpdfsdk/formfiller/cffl_formfiller.cpp | 68 |
1 files changed, 32 insertions, 36 deletions
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index 4b33c38b52..595f4121f3 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -24,8 +24,8 @@ CFFL_FormFiller::CFFL_FormFiller(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot) - : m_pApp(pApp), m_pAnnot(pAnnot), m_bValid(FALSE), m_ptOldPos(0, 0) { - m_pWidget = (CPDFSDK_Widget*)pAnnot; + : m_pApp(pApp), m_pAnnot(pAnnot), m_bValid(FALSE) { + m_pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); } CFFL_FormFiller::~CFFL_FormFiller() { @@ -145,42 +145,41 @@ FX_BOOL CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CFX_FloatPoint& point) { - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { - FX_RECT rcFFL = GetViewBBox(pPageView, pAnnot); - InvalidateRect(rcFFL.left, rcFFL.top, rcFFL.right, rcFFL.bottom); - pWnd->OnLButtonUp(WndtoPWL(pPageView, point), nFlags); - return TRUE; - } + CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE); + if (!pWnd) + return FALSE; - return FALSE; + FX_RECT rcFFL = GetViewBBox(pPageView, pAnnot); + InvalidateRect(rcFFL.left, rcFFL.top, rcFFL.right, rcFFL.bottom); + pWnd->OnLButtonUp(WndtoPWL(pPageView, point), nFlags); + return TRUE; } FX_BOOL CFFL_FormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CFX_FloatPoint& point) { - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { - pWnd->OnLButtonDblClk(WndtoPWL(pPageView, point), nFlags); - return TRUE; - } + CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE); + if (!pWnd) + return FALSE; - return FALSE; + pWnd->OnLButtonDblClk(WndtoPWL(pPageView, point), nFlags); + return TRUE; } FX_BOOL CFFL_FormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CFX_FloatPoint& point) { - if ((m_ptOldPos.x != point.x) || (m_ptOldPos.y != point.y)) { + if (m_ptOldPos != point) m_ptOldPos = point; - } - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { - pWnd->OnMouseMove(WndtoPWL(pPageView, point), nFlags); - return TRUE; - } + CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE); + if (!pWnd) + return FALSE; - return FALSE; + pWnd->OnMouseMove(WndtoPWL(pPageView, point), nFlags); + return TRUE; } FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, @@ -191,35 +190,32 @@ FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, if (!IsValid()) return FALSE; - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) { - return pWnd->OnMouseWheel(zDelta, WndtoPWL(pPageView, point), nFlags); - } - - return FALSE; + CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE); + return pWnd && pWnd->OnMouseWheel(zDelta, WndtoPWL(pPageView, point), nFlags); } FX_BOOL CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CFX_FloatPoint& point) { - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) { - pWnd->OnRButtonDown(WndtoPWL(pPageView, point), nFlags); - return TRUE; - } + CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE); + if (!pWnd) + return FALSE; - return FALSE; + pWnd->OnRButtonDown(WndtoPWL(pPageView, point), nFlags); + return TRUE; } FX_BOOL CFFL_FormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CFX_FloatPoint& point) { - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { - pWnd->OnRButtonUp(WndtoPWL(pPageView, point), nFlags); - return TRUE; - } + CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE); + if (!pWnd) + return FALSE; - return FALSE; + pWnd->OnRButtonUp(WndtoPWL(pPageView, point), nFlags); + return TRUE; } FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, |