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

Unified Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayer.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/graphics/GraphicsLayer.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
index 5a289ed77ab418cd32a61929cc3c3151ad213dfa..dc47455a141837efb88987e92cc35532f69047d3 100644
--- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
@@ -58,9 +58,12 @@
#include "wtf/CurrentTime.h"
#include "wtf/HashMap.h"
#include "wtf/HashSet.h"
+#include "wtf/MathExtras.h"
#include "wtf/text/StringUTF8Adaptor.h"
#include "wtf/text/WTFString.h"
#include <algorithm>
+#include <cmath>
+#include <utility>
#ifndef NDEBUG
#include <stdio.h>
@@ -981,7 +984,7 @@ void GraphicsLayer::setBackfaceVisibility(bool visible)
void GraphicsLayer::setOpacity(float opacity)
{
- float clampedOpacity = std::max(std::min(opacity, 1.0f), 0.0f);
+ float clampedOpacity = clampTo(opacity, 0.0f, 1.0f);
m_opacity = clampedOpacity;
platformLayer()->setOpacity(opacity);
}

Powered by Google App Engine
This is Rietveld 408576698