| Index: third_party/WebKit/Source/core/html/forms/StepRange.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/forms/StepRange.cpp b/third_party/WebKit/Source/core/html/forms/StepRange.cpp
|
| index 252ff6083e264bb9a7912b0e2ae5a45681bb170f..b1769b3ab5607f634185a40da82dd5d07c50b9ff 100644
|
| --- a/third_party/WebKit/Source/core/html/forms/StepRange.cpp
|
| +++ b/third_party/WebKit/Source/core/html/forms/StepRange.cpp
|
| @@ -168,4 +168,19 @@ bool StepRange::stepMismatch(const Decimal& valueForCheck) const
|
| return computedAcceptableError < remainder && remainder < (m_step - computedAcceptableError);
|
| }
|
|
|
| +Decimal StepRange::stepSnappedMaximum() const
|
| +{
|
| + Decimal base = stepBase();
|
| + Decimal step = this->step();
|
| + if (base - step == base || !(base / step).isFinite())
|
| + return Decimal::nan();
|
| + Decimal alignedMaximum = base + ((maximum() - base) / step).floor() * step;
|
| + if (alignedMaximum > maximum())
|
| + alignedMaximum -= step;
|
| + DCHECK_LE(alignedMaximum, maximum());
|
| + if (alignedMaximum < minimum())
|
| + return Decimal::nan();
|
| + return alignedMaximum;
|
| +}
|
| +
|
| } // namespace blink
|
|
|