Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp

Issue 1530723004: Use clampTo instead of chaining std::max(std::min(...)) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp
index 2858a072c4188cbca4f18427bb4028cde18952a4..ce86e06d66f7a30a0aa006d9a638a42e91b32838 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollAnimatorBase.cpp
@@ -33,8 +33,8 @@
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/geometry/FloatPoint.h"
#include "platform/scroll/ScrollableArea.h"
+#include "wtf/MathExtras.h"
#include "wtf/PassOwnPtr.h"
-#include <algorithm>
namespace blink {
@@ -98,7 +98,7 @@ float ScrollAnimatorBase::clampScrollPosition(ScrollbarOrientation orientation,
{
float maxScrollPos = m_scrollableArea->maximumScrollPosition(orientation);
float minScrollPos = m_scrollableArea->minimumScrollPosition(orientation);
- return std::max(std::min(pos, maxScrollPos), minScrollPos);
+ return clampTo(pos, minScrollPos, maxScrollPos);
}
DEFINE_TRACE(ScrollAnimatorBase)

Powered by Google App Engine
This is Rietveld 408576698