| 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 return visibleValue; | 301 return visibleValue; |
| 302 double parsedNumber = parseLocalizedNumber(visibleValue); | 302 double parsedNumber = parseLocalizedNumber(visibleValue); |
| 303 return isfinite(parsedNumber) ? serializeForNumberType(parsedNumber) : visib
leValue; | 303 return isfinite(parsedNumber) ? serializeForNumberType(parsedNumber) : visib
leValue; |
| 304 } | 304 } |
| 305 | 305 |
| 306 bool NumberInputType::isAcceptableValue(const String& proposedValue) | 306 bool NumberInputType::isAcceptableValue(const String& proposedValue) |
| 307 { | 307 { |
| 308 return proposedValue.isEmpty() || isfinite(parseLocalizedNumber(proposedValu
e)) || parseToDoubleForNumberType(proposedValue, 0); | 308 return proposedValue.isEmpty() || isfinite(parseLocalizedNumber(proposedValu
e)) || parseToDoubleForNumberType(proposedValue, 0); |
| 309 } | 309 } |
| 310 | 310 |
| 311 String NumberInputType::sanitizeValue(const String& proposedValue) | 311 String NumberInputType::sanitizeValue(const String& proposedValue) const |
| 312 { | 312 { |
| 313 if (proposedValue.isEmpty()) | 313 if (proposedValue.isEmpty()) |
| 314 return proposedValue; | 314 return proposedValue; |
| 315 return parseToDoubleForNumberType(proposedValue, 0) ? proposedValue : emptyA
tom.string(); | 315 return parseToDoubleForNumberType(proposedValue, 0) ? proposedValue : emptyA
tom.string(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 bool NumberInputType::hasUnacceptableValue() | 318 bool NumberInputType::hasUnacceptableValue() |
| 319 { | 319 { |
| 320 return element()->renderer() && !isAcceptableValue(element()->innerTextValue
()); | 320 return element()->renderer() && !isAcceptableValue(element()->innerTextValue
()); |
| 321 } | 321 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 345 | 345 |
| 346 void NumberInputType::stepAttributeChanged() | 346 void NumberInputType::stepAttributeChanged() |
| 347 { | 347 { |
| 348 InputType::stepAttributeChanged(); | 348 InputType::stepAttributeChanged(); |
| 349 | 349 |
| 350 if (element()->renderer()) | 350 if (element()->renderer()) |
| 351 element()->renderer()->setNeedsLayoutAndPrefWidthsRecalc(); | 351 element()->renderer()->setNeedsLayoutAndPrefWidthsRecalc(); |
| 352 } | 352 } |
| 353 | 353 |
| 354 } // namespace WebCore | 354 } // namespace WebCore |
| OLD | NEW |