OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } | 121 } |
122 | 122 |
123 StepRange RangeInputType::createStepRange(AnyStepHandling anyStepHandling) const | 123 StepRange RangeInputType::createStepRange(AnyStepHandling anyStepHandling) const |
124 { | 124 { |
125 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (rang
eDefaultStep, rangeDefaultStepBase, rangeStepScaleFactor)); | 125 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (rang
eDefaultStep, rangeDefaultStepBase, rangeStepScaleFactor)); |
126 | 126 |
127 const Decimal stepBase = findStepBase(rangeDefaultStepBase); | 127 const Decimal stepBase = findStepBase(rangeDefaultStepBase); |
128 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), r
angeDefaultMinimum); | 128 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), r
angeDefaultMinimum); |
129 const Decimal maximum = ensureMaximum(parseToNumber(element().fastGetAttribu
te(maxAttr), rangeDefaultMaximum), minimum, rangeDefaultMaximum); | 129 const Decimal maximum = ensureMaximum(parseToNumber(element().fastGetAttribu
te(maxAttr), rangeDefaultMaximum), minimum, rangeDefaultMaximum); |
130 | 130 |
131 const AtomicString& precisionValue = element().fastGetAttribute(precisionAtt
r); | |
132 if (!precisionValue.isNull()) { | |
133 const Decimal step = equalIgnoringCase(precisionValue, "float") ? Decima
l::nan() : 1; | |
134 return StepRange(stepBase, minimum, maximum, step, stepDescription); | |
135 } | |
136 | |
137 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription,
element().fastGetAttribute(stepAttr)); | 131 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription,
element().fastGetAttribute(stepAttr)); |
138 return StepRange(stepBase, minimum, maximum, step, stepDescription); | 132 return StepRange(stepBase, minimum, maximum, step, stepDescription); |
139 } | 133 } |
140 | 134 |
141 bool RangeInputType::isSteppable() const | 135 bool RangeInputType::isSteppable() const |
142 { | 136 { |
143 return true; | 137 return true; |
144 } | 138 } |
145 | 139 |
146 void RangeInputType::handleMouseDownEvent(MouseEvent* event) | 140 void RangeInputType::handleMouseDownEvent(MouseEvent* event) |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 right = middle; | 388 right = middle; |
395 } | 389 } |
396 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal:
:infinity(Decimal::Negative); | 390 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal:
:infinity(Decimal::Negative); |
397 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV
alues[middle] : Decimal::infinity(Decimal::Positive); | 391 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV
alues[middle] : Decimal::infinity(Decimal::Positive); |
398 if (closestRight - value < value - closestLeft) | 392 if (closestRight - value < value - closestLeft) |
399 return closestRight; | 393 return closestRight; |
400 return closestLeft; | 394 return closestLeft; |
401 } | 395 } |
402 | 396 |
403 } // namespace WebCore | 397 } // namespace WebCore |
OLD | NEW |