From 1b4670cab5be6a5938621a25f050da7351c507b2 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 5 Jul 2017 14:11:23 -0400 Subject: Remove PNM_SETCARETINFO and call SetCaret directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PNM_SETCARETINFO message is only sent inside CPWL_EditCtrl and is only handled in that class. This CL removes the message from OnNotify and calls SetCaret directly. Change-Id: I7d48f4b9fcd9fe8e828163c957e7d46f369edb06 Reviewed-on: https://pdfium-review.googlesource.com/7254 Reviewed-by: Nicolás Peña Commit-Queue: dsinclair --- fpdfsdk/pdfwindow/cpwl_caret.cpp | 2 -- fpdfsdk/pdfwindow/cpwl_caret.h | 9 --------- fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp | 22 +--------------------- fpdfsdk/pdfwindow/cpwl_edit_ctrl.h | 4 ---- fpdfsdk/pdfwindow/cpwl_wnd.h | 1 - 5 files changed, 1 insertion(+), 37 deletions(-) diff --git a/fpdfsdk/pdfwindow/cpwl_caret.cpp b/fpdfsdk/pdfwindow/cpwl_caret.cpp index a6a165f9a0..0d63622852 100644 --- a/fpdfsdk/pdfwindow/cpwl_caret.cpp +++ b/fpdfsdk/pdfwindow/cpwl_caret.cpp @@ -16,8 +16,6 @@ #define PWL_CARET_FLASHINTERVAL 500 -PWL_CARET_INFO::PWL_CARET_INFO() : bVisible(false) {} - CPWL_Caret::CPWL_Caret() : m_bFlash(false), m_fWidth(0.4f), m_nDelay(0) {} CPWL_Caret::~CPWL_Caret() {} diff --git a/fpdfsdk/pdfwindow/cpwl_caret.h b/fpdfsdk/pdfwindow/cpwl_caret.h index 7c723b96b3..0d9c1cdfd1 100644 --- a/fpdfsdk/pdfwindow/cpwl_caret.h +++ b/fpdfsdk/pdfwindow/cpwl_caret.h @@ -9,15 +9,6 @@ #include "fpdfsdk/pdfwindow/cpwl_wnd.h" -struct PWL_CARET_INFO { - public: - PWL_CARET_INFO(); - - bool bVisible; - CFX_PointF ptHead; - CFX_PointF ptFoot; -}; - class CPWL_Caret : public CPWL_Wnd { public: CPWL_Caret(); diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp index 2c005a4335..59879bb274 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp +++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp @@ -78,21 +78,6 @@ void CPWL_EditCtrl::ScrollWindowVertically(float pos) { m_pEdit->SetScrollPos(CFX_PointF(m_pEdit->GetScrollPos().x, pos)); } -void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd, - uint32_t msg, - intptr_t wParam, - intptr_t lParam) { - CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); - - switch (msg) { - case PNM_SETCARETINFO: { - if (PWL_CARET_INFO* pCaretInfo = (PWL_CARET_INFO*)wParam) { - SetCaret(pCaretInfo->bVisible, pCaretInfo->ptHead, pCaretInfo->ptFoot); - } - } break; - } -} - void CPWL_EditCtrl::CreateChildWnd(const PWL_CREATEPARAM& cp) { if (!IsReadOnly()) CreateEditCaret(cp); @@ -452,12 +437,7 @@ void CPWL_EditCtrl::IOnSetCaret(bool bVisible, const CFX_PointF& ptHead, const CFX_PointF& ptFoot, const CPVT_WordPlace& place) { - PWL_CARET_INFO cInfo; - cInfo.bVisible = bVisible; - cInfo.ptHead = ptHead; - cInfo.ptFoot = ptFoot; - - OnNotify(this, PNM_SETCARETINFO, (intptr_t)&cInfo, (intptr_t) nullptr); + SetCaret(bVisible, ptHead, ptFoot); } void CPWL_EditCtrl::IOnInvalidateRect(CFX_FloatRect* pRect) { diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h index f72a7b2043..f81def6464 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h +++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h @@ -52,10 +52,6 @@ class CPWL_EditCtrl : public CPWL_Wnd { bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag) override; - void OnNotify(CPWL_Wnd* pWnd, - uint32_t msg, - intptr_t wParam = 0, - intptr_t lParam = 0) override; void SetScrollInfo(const PWL_SCROLL_INFO& info) override; void SetScrollPosition(float pos) override; void ScrollWindowVertically(float pos) override; diff --git a/fpdfsdk/pdfwindow/cpwl_wnd.h b/fpdfsdk/pdfwindow/cpwl_wnd.h index ab4cf7ae77..4f378a419b 100644 --- a/fpdfsdk/pdfwindow/cpwl_wnd.h +++ b/fpdfsdk/pdfwindow/cpwl_wnd.h @@ -77,7 +77,6 @@ struct PWL_SCROLL_INFO; #define PNM_LBUTTONDOWN 5 #define PNM_LBUTTONUP 6 #define PNM_MOUSEMOVE 7 -#define PNM_SETCARETINFO 8 #define PWL_CLASSNAME_EDIT "CPWL_Edit" -- cgit v1.2.3