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; |