summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-07-05 09:28:15 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-05 15:31:45 +0000
commitfb00ec2af390ccfe8f5e81f49b9113e044f5e5ad (patch)
tree9f1c89f504db465251d46d5de4cd9042e2d5c663 /fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
parente5e889eec8b362f5c65fc142660ad745a0d5cf21 (diff)
downloadpdfium-fb00ec2af390ccfe8f5e81f49b9113e044f5e5ad.tar.xz
Move PNM_SETSCROLLINFO out of OnNotify
This CL moves the SETSCROLLINFO from a OnNotify message to a method which is called directly. Change-Id: I5d793c1c7a54c0fa3bdadffac72aae934cb9da57 Reviewed-on: https://pdfium-review.googlesource.com/7251 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp b/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
index 33bdedbf2f..45814cff2f 100644
--- a/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
@@ -6,6 +6,7 @@
#include "fpdfsdk/pdfwindow/cpwl_scroll_bar.h"
+#include <algorithm>
#include <sstream>
#include "core/fxge/cfx_pathdata.h"
@@ -750,6 +751,17 @@ bool CPWL_ScrollBar::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) {
return true;
}
+void CPWL_ScrollBar::SetScrollInfo(const PWL_SCROLL_INFO& info) {
+ if (info == m_OriginInfo)
+ return;
+
+ m_OriginInfo = info;
+ float fMax =
+ std::max(0.0f, info.fContentMax - info.fContentMin - info.fPlateWidth);
+ SetScrollRange(0, fMax, info.fPlateWidth);
+ SetScrollStep(info.fBigStep, info.fSmallStep);
+}
+
void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd,
uint32_t msg,
intptr_t wParam,
@@ -796,17 +808,6 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd,
OnPosButtonMouseMove(*(CFX_PointF*)lParam);
}
break;
- case PNM_SETSCROLLINFO: {
- PWL_SCROLL_INFO* pInfo = reinterpret_cast<PWL_SCROLL_INFO*>(lParam);
- if (pInfo && *pInfo != m_OriginInfo) {
- m_OriginInfo = *pInfo;
- float fMax =
- pInfo->fContentMax - pInfo->fContentMin - pInfo->fPlateWidth;
- fMax = fMax > 0.0f ? fMax : 0.0f;
- SetScrollRange(0, fMax, pInfo->fPlateWidth);
- SetScrollStep(pInfo->fBigStep, pInfo->fSmallStep);
- }
- } break;
case PNM_SETSCROLLPOS: {
float fPos = *(float*)lParam;
switch (m_sbType) {