| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 bool NumberInputType::typeMismatch() const | 151 bool NumberInputType::typeMismatch() const |
| 152 { | 152 { |
| 153 ASSERT(!typeMismatchFor(element().value())); | 153 ASSERT(!typeMismatchFor(element().value())); |
| 154 return false; | 154 return false; |
| 155 } | 155 } |
| 156 | 156 |
| 157 StepRange NumberInputType::createStepRange(AnyStepHandling anyStepHandling) cons
t | 157 StepRange NumberInputType::createStepRange(AnyStepHandling anyStepHandling) cons
t |
| 158 { | 158 { |
| 159 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (numb
erDefaultStep, numberDefaultStepBase, numberStepScaleFactor)); | 159 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (numb
erDefaultStep, numberDefaultStepBase, numberStepScaleFactor)); |
| 160 const Decimal stepBase = findStepBase(numberDefaultStepBase); | 160 |
| 161 // FIXME: We should use numeric_limits<double>::max for number input type. | 161 // FIXME: We should use numeric_limits<double>::max for number input type. |
| 162 const Decimal floatMax = Decimal::fromDouble(numeric_limits<float>::max()); | 162 const Decimal floatMax = Decimal::fromDouble(numeric_limits<float>::max()); |
| 163 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), -
floatMax); | 163 return InputType::createStepRange(anyStepHandling, numberDefaultStepBase, -f
loatMax, floatMax, stepDescription); |
| 164 const Decimal maximum = parseToNumber(element().fastGetAttribute(maxAttr), f
loatMax); | |
| 165 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription,
element().fastGetAttribute(stepAttr)); | |
| 166 return StepRange(stepBase, minimum, maximum, step, stepDescription); | |
| 167 } | 164 } |
| 168 | 165 |
| 169 bool NumberInputType::sizeShouldIncludeDecoration(int defaultSize, int& preferre
dSize) const | 166 bool NumberInputType::sizeShouldIncludeDecoration(int defaultSize, int& preferre
dSize) const |
| 170 { | 167 { |
| 171 preferredSize = defaultSize; | 168 preferredSize = defaultSize; |
| 172 | 169 |
| 173 const String stepString = element().fastGetAttribute(stepAttr); | 170 const String stepString = element().fastGetAttribute(stepAttr); |
| 174 if (equalIgnoringCase(stepString, "any")) | 171 if (equalIgnoringCase(stepString, "any")) |
| 175 return false; | 172 return false; |
| 176 | 173 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 296 |
| 300 void NumberInputType::stepAttributeChanged() | 297 void NumberInputType::stepAttributeChanged() |
| 301 { | 298 { |
| 302 InputType::stepAttributeChanged(); | 299 InputType::stepAttributeChanged(); |
| 303 | 300 |
| 304 if (element().renderer()) | 301 if (element().renderer()) |
| 305 element().renderer()->setNeedsLayoutAndPrefWidthsRecalc(); | 302 element().renderer()->setNeedsLayoutAndPrefWidthsRecalc(); |
| 306 } | 303 } |
| 307 | 304 |
| 308 } // namespace WebCore | 305 } // namespace WebCore |
| OLD | NEW |