summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_scrollbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fwl/cfwl_scrollbar.cpp')
-rw-r--r--xfa/fwl/cfwl_scrollbar.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/xfa/fwl/cfwl_scrollbar.cpp b/xfa/fwl/cfwl_scrollbar.cpp
index abe99dacce..72797ed315 100644
--- a/xfa/fwl/cfwl_scrollbar.cpp
+++ b/xfa/fwl/cfwl_scrollbar.cpp
@@ -11,6 +11,7 @@
#include <utility>
#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fwl/cfwl_messagemouse.h"
#include "xfa/fwl/cfwl_messagemousewheel.h"
#include "xfa/fwl/cfwl_notedriver.h"
@@ -219,7 +220,7 @@ CFX_RectF CFWL_ScrollBar::CalcThumbButtonRect(const CFX_RectF& rtThumb) {
fThumbSize = std::max(fThumbSize, kMinThumbSize);
float fDiff = std::max(fLength - fThumbSize, 0.0f);
- float fTrackPos = std::max(std::min(m_fTrackPos, m_fRangeMax), m_fRangeMin);
+ float fTrackPos = pdfium::clamp(m_fTrackPos, m_fRangeMin, m_fRangeMax);
if (!fRange)
return rect;
@@ -287,7 +288,7 @@ float CFWL_ScrollBar::GetTrackPointPos(const CFX_PointF& point) {
}
fPos += m_fLastTrackPos;
- return std::min(std::max(fPos, m_fRangeMin), m_fRangeMax);
+ return pdfium::clamp(fPos, m_fRangeMin, m_fRangeMax);
}
bool CFWL_ScrollBar::SendEvent() {