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

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.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: Handling that minimumThumbLength > trackLen. 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/ScrollbarThemeOverlay.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp
index 0e1bfd3670f80d7246edb053f7fc2df2b7a2debd..2a670b145513a54c1c085068e95db7036ab5dece 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp
@@ -34,6 +34,7 @@
#include "public/platform/Platform.h"
#include "public/platform/WebRect.h"
#include "public/platform/WebThemeEngine.h"
+#include "wtf/MathExtras.h"
#include <algorithm>
@@ -92,7 +93,8 @@ int ScrollbarThemeOverlay::thumbLength(const ScrollbarThemeClient& scrollbar)
float proportion = static_cast<float>(scrollbar.visibleSize()) / scrollbar.totalSize();
int length = round(proportion * trackLen);
- length = std::min(std::max(length, minimumThumbLength(scrollbar)), trackLen);
+ int minLen = std::min(minimumThumbLength(scrollbar), trackLen);
+ length = clampTo(length, minLen, trackLen);
return length;
}

Powered by Google App Engine
This is Rietveld 408576698