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

Unified Diff: third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesisUtterance.h

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/speech/PlatformSpeechSynthesisUtterance.h
diff --git a/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesisUtterance.h b/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesisUtterance.h
index 50554444103f30168d538a326019fa5603a0b213..f59321dadf51f51a9f07f0005ef6429cacba6626 100644
--- a/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesisUtterance.h
+++ b/third_party/WebKit/Source/platform/speech/PlatformSpeechSynthesisUtterance.h
@@ -29,6 +29,7 @@
#include "platform/PlatformExport.h"
#include "platform/heap/Handle.h"
#include "platform/speech/PlatformSpeechSynthesisVoice.h"
+#include "wtf/MathExtras.h"
#include "wtf/text/WTFString.h"
namespace blink {
@@ -55,15 +56,15 @@ public:
// Range = [0, 1] where 1 is the default.
float volume() const { return m_volume; }
- void setVolume(float volume) { m_volume = std::max(std::min(1.0f, volume), 0.0f); }
+ void setVolume(float volume) { m_volume = clampTo(volume, 0.0f, 1.0f); }
// Range = [0.1, 10] where 1 is the default.
float rate() const { return m_rate; }
- void setRate(float rate) { m_rate = std::max(std::min(10.0f, rate), 0.1f); }
+ void setRate(float rate) { m_rate = clampTo(rate, 0.1f, 10.0f); }
// Range = [0, 2] where 1 is the default.
float pitch() const { return m_pitch; }
- void setPitch(float pitch) { m_pitch = std::max(std::min(2.0f, pitch), 0.0f); }
+ void setPitch(float pitch) { m_pitch = clampTo(pitch, 0.0f, 2.0f); }
double startTime() const { return m_startTime; }
void setStartTime(double startTime) { m_startTime = startTime; }

Powered by Google App Engine
This is Rietveld 408576698