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

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: 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/graphics/GraphicsLayer.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
index 3c5753843f82ebda02dc4a9a9879fc936bcb1a3b..eefb444a3e4266e90ac22d2f0eddfb3bc9a75f52 100644
--- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
@@ -57,9 +57,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>
@@ -987,7 +990,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