| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 const AtomicString& RangeInputType::formControlType() const | 98 const AtomicString& RangeInputType::formControlType() const |
| 99 { | 99 { |
| 100 return InputTypeNames::range; | 100 return InputTypeNames::range; |
| 101 } | 101 } |
| 102 | 102 |
| 103 double RangeInputType::valueAsDouble() const | 103 double RangeInputType::valueAsDouble() const |
| 104 { | 104 { |
| 105 return parseToDoubleForNumberType(element().value()); | 105 return parseToDoubleForNumberType(element().value()); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void RangeInputType::setValueAsDecimal(const Decimal& newValue, TextFieldEventBe
havior eventBehavior, ExceptionState&) const | 108 void RangeInputType::setValueAsDouble(double newValue, TextFieldEventBehavior ev
entBehavior, ExceptionState& exceptionState) const |
| 109 { | 109 { |
| 110 element().setValue(serialize(newValue), eventBehavior); | 110 setValueAsDecimal(Decimal::fromDouble(newValue), eventBehavior, exceptionSta
te); |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool RangeInputType::typeMismatchFor(const String& value) const | 113 bool RangeInputType::typeMismatchFor(const String& value) const |
| 114 { | 114 { |
| 115 return !value.isEmpty() && !std::isfinite(parseToDoubleForNumberType(value))
; | 115 return !value.isEmpty() && !std::isfinite(parseToDoubleForNumberType(value))
; |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool RangeInputType::supportsRequired() const | 118 bool RangeInputType::supportsRequired() const |
| 119 { | 119 { |
| 120 return false; | 120 return false; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 right = middle; | 393 right = middle; |
| 394 } | 394 } |
| 395 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal:
:infinity(Decimal::Negative); | 395 const Decimal closestLeft = middle ? m_tickMarkValues[middle - 1] : Decimal:
:infinity(Decimal::Negative); |
| 396 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV
alues[middle] : Decimal::infinity(Decimal::Positive); | 396 const Decimal closestRight = middle != m_tickMarkValues.size() ? m_tickMarkV
alues[middle] : Decimal::infinity(Decimal::Positive); |
| 397 if (closestRight - value < value - closestLeft) | 397 if (closestRight - value < value - closestLeft) |
| 398 return closestRight; | 398 return closestRight; |
| 399 return closestLeft; | 399 return closestLeft; |
| 400 } | 400 } |
| 401 | 401 |
| 402 } // namespace WebCore | 402 } // namespace WebCore |
| OLD | NEW |