From 0fdd1aea658bc65e4d136c58818451b9ddad00e0 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 5 Jul 2017 16:00:48 -0400 Subject: Cleanup IOn* methods and CPWL_CBEdit This CL removes various IOn* methods and consolidates code where possible. The CPWL_CBEdit class is also removed as it was a subclass of CPWL_Edit which added no extra functionality. Change-Id: Ifac579ab252b7ca64f8c9b3caeac443683a39c58 Reviewed-on: https://pdfium-review.googlesource.com/7279 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- fpdfsdk/fxedit/fxet_edit.cpp | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) (limited to 'fpdfsdk/fxedit') diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index 863486bdea..82f82477d8 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -30,6 +30,7 @@ #include "fpdfsdk/fxedit/fx_edit.h" #include "fpdfsdk/pdfwindow/cpwl_edit.h" #include "fpdfsdk/pdfwindow/cpwl_edit_ctrl.h" +#include "fpdfsdk/pdfwindow/cpwl_scroll_bar.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" @@ -1226,18 +1227,24 @@ CFX_FloatRect CFX_Edit::VTToEdit(const CFX_FloatRect& rect) const { } void CFX_Edit::SetScrollInfo() { - if (m_pNotify) { - CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); - CFX_FloatRect rcContent = m_pVT->GetContentRect(); + if (!m_pNotify) + return; - if (!m_bNotifyFlag) { - CFX_AutoRestorer restorer(&m_bNotifyFlag); - m_bNotifyFlag = true; - m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, - rcContent.bottom, rcContent.top, - rcPlate.Height() / 3, rcPlate.Height()); - } - } + CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); + CFX_FloatRect rcContent = m_pVT->GetContentRect(); + if (m_bNotifyFlag) + return; + + CFX_AutoRestorer restorer(&m_bNotifyFlag); + m_bNotifyFlag = true; + + PWL_SCROLL_INFO Info; + Info.fPlateWidth = rcPlate.top - rcPlate.bottom; + Info.fContentMin = rcContent.bottom; + Info.fContentMax = rcContent.top; + Info.fSmallStep = rcPlate.Height() / 3; + Info.fBigStep = rcPlate.Height(); + m_pNotify->SetScrollInfo(Info); } void CFX_Edit::SetScrollPosX(float fx) { @@ -1265,7 +1272,7 @@ void CFX_Edit::SetScrollPosY(float fy) { if (!m_bNotifyFlag) { CFX_AutoRestorer restorer(&m_bNotifyFlag); m_bNotifyFlag = true; - m_pNotify->IOnSetScrollPosY(fy); + m_pNotify->SetScrollPosition(fy); } } } @@ -1377,7 +1384,7 @@ void CFX_Edit::Refresh() { m_bNotifyFlag = true; if (const CFX_Edit_RectArray* pRects = m_Refresh.GetRefreshRects()) { for (int32_t i = 0, sz = pRects->GetSize(); i < sz; i++) - m_pNotify->IOnInvalidateRect(pRects->GetAt(i)); + m_pNotify->InvalidateRect(pRects->GetAt(i)); } } } @@ -1445,7 +1452,7 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) { CFX_AutoRestorer restorer(&m_bNotifyFlag); m_bNotifyFlag = true; CFX_FloatRect rcRefresh = VTToEdit(rcWord); - m_pNotify->IOnInvalidateRect(&rcRefresh); + m_pNotify->InvalidateRect(&rcRefresh); } } } else { @@ -1459,7 +1466,7 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) { CFX_AutoRestorer restorer(&m_bNotifyFlag); m_bNotifyFlag = true; CFX_FloatRect rcRefresh = VTToEdit(rcLine); - m_pNotify->IOnInvalidateRect(&rcRefresh); + m_pNotify->InvalidateRect(&rcRefresh); } } @@ -1497,8 +1504,8 @@ void CFX_Edit::SetCaretInfo() { CFX_AutoRestorer restorer(&m_bNotifyFlag); m_bNotifyFlag = true; - m_pNotify->IOnSetCaret(m_SelState.IsEmpty(), VTToEdit(ptHead), - VTToEdit(ptFoot), m_wpCaret); + m_pNotify->SetCaret(m_SelState.IsEmpty(), VTToEdit(ptHead), + VTToEdit(ptFoot)); } } } -- cgit v1.2.3