summaryrefslogtreecommitdiff
path: root/fpdfsdk/fxedit
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-07-05 16:00:48 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-05 21:24:34 +0000
commit0fdd1aea658bc65e4d136c58818451b9ddad00e0 (patch)
tree7b435514a01e74198159de880f65408e1b77ab2e /fpdfsdk/fxedit
parentd32623b507c7e78221eb9f5f62641e3113501a5c (diff)
downloadpdfium-0fdd1aea658bc65e4d136c58818451b9ddad00e0.tar.xz
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 <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/fxedit')
-rw-r--r--fpdfsdk/fxedit/fxet_edit.cpp41
1 files changed, 24 insertions, 17 deletions
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<bool> 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<bool> 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<bool> 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<bool> 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<bool> 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<bool> 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));
}
}
}