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

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: 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/ScrollbarThemeOverlay.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp
index f679b981c5ccc06f252f86652bdf520094a09980..a5a12bb6c5e853ee301455486704641a8d9955b3 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollbarThemeOverlay.cpp
@@ -33,6 +33,7 @@
#include "public/platform/Platform.h"
#include "public/platform/WebRect.h"
#include "public/platform/WebThemeEngine.h"
+#include "wtf/MathExtras.h"
#include <algorithm>
@@ -91,7 +92,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