diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-07-05 09:39:50 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-05 18:05:50 +0000 |
commit | 7e0336e278d69f1d66967db7375c75322da55d69 (patch) | |
tree | 505496fa39ac02cbaf4f4fbb8cb9dd0a20cc9ea4 /fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp | |
parent | 3ff54008a163eea3158a7c107595daf79ccc7d44 (diff) | |
download | pdfium-7e0336e278d69f1d66967db7375c75322da55d69.tar.xz |
Move PNM_SETSCROLLPOS to custom method
This CL splits PNM_SETSCROLLPOS out of OnNotify and places into a
method which is called as needed.
Change-Id: Ic144bc30bca57869f0679bef40e07b6a130e944c
Reviewed-on: https://pdfium-review.googlesource.com/7252
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.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp b/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp index 45814cff2f..9b65cf1695 100644 --- a/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp +++ b/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp @@ -762,6 +762,18 @@ void CPWL_ScrollBar::SetScrollInfo(const PWL_SCROLL_INFO& info) { SetScrollStep(info.fBigStep, info.fSmallStep); } +void CPWL_ScrollBar::SetScrollPosition(float pos) { + switch (m_sbType) { + case SBT_HSCROLL: + pos = pos - m_OriginInfo.fContentMin; + break; + case SBT_VSCROLL: + pos = m_OriginInfo.fContentMax - pos; + break; + } + SetScrollPos(pos); +} + void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, uint32_t msg, intptr_t wParam, @@ -808,18 +820,6 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, OnPosButtonMouseMove(*(CFX_PointF*)lParam); } break; - case PNM_SETSCROLLPOS: { - float fPos = *(float*)lParam; - switch (m_sbType) { - case SBT_HSCROLL: - fPos = fPos - m_OriginInfo.fContentMin; - break; - case SBT_VSCROLL: - fPos = m_OriginInfo.fContentMax - fPos; - break; - } - SetScrollPos(fPos); - } break; } } @@ -874,9 +874,7 @@ void CPWL_ScrollBar::SetScrollRange(float fMin, void CPWL_ScrollBar::SetScrollPos(float fPos) { float fOldPos = m_sData.fScrollPos; - m_sData.SetPos(fPos); - if (!IsFloatEqual(m_sData.fScrollPos, fOldPos)) MovePosButton(true); } |