| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 StepRange RangeInputType::createStepRange(AnyStepHandling anyStepHandling) const | 134 StepRange RangeInputType::createStepRange(AnyStepHandling anyStepHandling) const |
| 135 { | 135 { |
| 136 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (rang
eDefaultStep, rangeDefaultStepBase, rangeStepScaleFactor)); | 136 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (rang
eDefaultStep, rangeDefaultStepBase, rangeStepScaleFactor)); |
| 137 | 137 |
| 138 const Decimal stepBase = findStepBase(rangeDefaultStepBase); | 138 const Decimal stepBase = findStepBase(rangeDefaultStepBase); |
| 139 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), r
angeDefaultMinimum); | 139 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), r
angeDefaultMinimum); |
| 140 const Decimal maximum = ensureMaximum(parseToNumber(element().fastGetAttribu
te(maxAttr), rangeDefaultMaximum), minimum, rangeDefaultMaximum); | 140 const Decimal maximum = ensureMaximum(parseToNumber(element().fastGetAttribu
te(maxAttr), rangeDefaultMaximum), minimum, rangeDefaultMaximum); |
| 141 | 141 |
| 142 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription,
element().fastGetAttribute(stepAttr)); | 142 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription,
element().fastGetAttribute(stepAttr)); |
| 143 return StepRange(stepBase, minimum, maximum, step, stepDescription); | 143 // Range type always has range limitations because it has default |
| 144 // minimum/maximum. |
| 145 // https://html.spec.whatwg.org/multipage/forms.html#range-state-(type=range
):concept-input-min-default |
| 146 const bool hasRangeLimitations = true; |
| 147 return StepRange(stepBase, minimum, maximum, hasRangeLimitations, step, step
Description); |
| 144 } | 148 } |
| 145 | 149 |
| 146 bool RangeInputType::isSteppable() const | 150 bool RangeInputType::isSteppable() const |
| 147 { | 151 { |
| 148 return true; | 152 return true; |
| 149 } | 153 } |
| 150 | 154 |
| 151 void RangeInputType::handleMouseDownEvent(MouseEvent* event) | 155 void RangeInputType::handleMouseDownEvent(MouseEvent* event) |
| 152 { | 156 { |
| 153 if (element().isDisabledOrReadOnly()) | 157 if (element().isDisabledOrReadOnly()) |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 right = middle; | 416 right = middle; |
| 413 } | 417 } |
| 414 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal:
:infinity(Decimal::Negative); | 418 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal:
:infinity(Decimal::Negative); |
| 415 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV
alues[middle] : Decimal::infinity(Decimal::Positive); | 419 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV
alues[middle] : Decimal::infinity(Decimal::Positive); |
| 416 if (closestRight - value < value - closestLeft) | 420 if (closestRight - value < value - closestLeft) |
| 417 return closestRight; | 421 return closestRight; |
| 418 return closestLeft; | 422 return closestLeft; |
| 419 } | 423 } |
| 420 | 424 |
| 421 } // namespace blink | 425 } // namespace blink |
| OLD | NEW |