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

Unified Diff: Source/core/html/forms/StepRange.cpp

Issue 152753002: Update input[type=range]'s step base handling to match spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 months 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: Source/core/html/forms/StepRange.cpp
diff --git a/Source/core/html/forms/StepRange.cpp b/Source/core/html/forms/StepRange.cpp
index 0e10a5f162f1de87d0f3012ca2d040f24a418750..2a89534b0f4f9466978ff3bd87e8781a6793503f 100644
--- a/Source/core/html/forms/StepRange.cpp
+++ b/Source/core/html/forms/StepRange.cpp
@@ -87,9 +87,9 @@ Decimal StepRange::clampValue(const Decimal& value) const
const Decimal inRangeValue = max(m_minimum, min(value, m_maximum));
if (!m_hasStep)
return inRangeValue;
- // Rounds inRangeValue to minimum + N * step.
- const Decimal roundedValue = roundByStep(inRangeValue, m_minimum);
- const Decimal clampedValue = roundedValue > m_maximum ? roundedValue - m_step : roundedValue;
+ // Rounds inRangeValue to stepBase + N * step.
+ const Decimal roundedValue = roundByStep(inRangeValue, m_stepBase);
+ const Decimal clampedValue = roundedValue > m_maximum ? roundedValue - m_step : (roundedValue < m_minimum ? roundedValue + m_step : roundedValue);
ASSERT(clampedValue >= m_minimum);
ASSERT(clampedValue <= m_maximum);
return clampedValue;
« Source/core/html/forms/RangeInputType.cpp ('K') | « Source/core/html/forms/RangeInputType.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698