OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 | 65 |
66 Decimal defaultValue() const | 66 Decimal defaultValue() const |
67 { | 67 { |
68 return defaultStep * stepScaleFactor; | 68 return defaultStep * stepScaleFactor; |
69 } | 69 } |
70 }; | 70 }; |
71 | 71 |
72 StepRange(); | 72 StepRange(); |
73 StepRange(const StepRange&); | 73 StepRange(const StepRange&); |
74 StepRange(const Decimal& stepBase, const Decimal& minimum, const Decimal& ma
ximum, const Decimal& step, const StepDescription&); | 74 StepRange(const Decimal& stepBase, const Decimal& minimum, const Decimal& ma
ximum, bool hasRangeLimitations, const Decimal& step, const StepDescription&); |
| 75 |
75 Decimal alignValueForStep(const Decimal& currentValue, const Decimal& newVal
ue) const; | 76 Decimal alignValueForStep(const Decimal& currentValue, const Decimal& newVal
ue) const; |
76 Decimal clampValue(const Decimal& value) const; | 77 Decimal clampValue(const Decimal& value) const; |
77 bool hasStep() const { return m_hasStep; } | 78 bool hasStep() const { return m_hasStep; } |
78 Decimal maximum() const { return m_maximum; } | 79 Decimal maximum() const { return m_maximum; } |
79 Decimal minimum() const { return m_minimum; } | 80 Decimal minimum() const { return m_minimum; } |
| 81 // https://html.spec.whatwg.org/multipage/forms.html#have-range-limitations |
| 82 bool hasRangeLimitations() const { return m_hasRangeLimitations; } |
80 static Decimal parseStep(AnyStepHandling, const StepDescription&, const Stri
ng&); | 83 static Decimal parseStep(AnyStepHandling, const StepDescription&, const Stri
ng&); |
81 Decimal step() const { return m_step; } | 84 Decimal step() const { return m_step; } |
82 Decimal stepBase() const { return m_stepBase; } | 85 Decimal stepBase() const { return m_stepBase; } |
83 bool stepMismatch(const Decimal&) const; | 86 bool stepMismatch(const Decimal&) const; |
84 | 87 |
85 // Clamp the middle value according to the step | 88 // Clamp the middle value according to the step |
86 Decimal defaultValue() const | 89 Decimal defaultValue() const |
87 { | 90 { |
88 return clampValue((m_minimum + m_maximum) / 2); | 91 return clampValue((m_minimum + m_maximum) / 2); |
89 } | 92 } |
(...skipping 17 matching lines...) Expand all Loading... |
107 StepRange& operator=(const StepRange&) = delete; | 110 StepRange& operator=(const StepRange&) = delete; |
108 Decimal acceptableError() const; | 111 Decimal acceptableError() const; |
109 Decimal roundByStep(const Decimal& value, const Decimal& base) const; | 112 Decimal roundByStep(const Decimal& value, const Decimal& base) const; |
110 | 113 |
111 const Decimal m_maximum; // maximum must be >= minimum. | 114 const Decimal m_maximum; // maximum must be >= minimum. |
112 const Decimal m_minimum; | 115 const Decimal m_minimum; |
113 const Decimal m_step; | 116 const Decimal m_step; |
114 const Decimal m_stepBase; | 117 const Decimal m_stepBase; |
115 const StepDescription m_stepDescription; | 118 const StepDescription m_stepDescription; |
116 const bool m_hasStep; | 119 const bool m_hasStep; |
| 120 const bool m_hasRangeLimitations; |
117 }; | 121 }; |
118 | 122 |
119 } // namespace blink | 123 } // namespace blink |
120 | 124 |
121 #endif // StepRange_h | 125 #endif // StepRange_h |
OLD | NEW |