| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "core/rendering/RenderTextControl.h" | 42 #include "core/rendering/RenderTextControl.h" |
| 43 #include "platform/text/PlatformLocale.h" | 43 #include "platform/text/PlatformLocale.h" |
| 44 #include "wtf/MathExtras.h" | 44 #include "wtf/MathExtras.h" |
| 45 #include "wtf/PassOwnPtr.h" | 45 #include "wtf/PassOwnPtr.h" |
| 46 #include <limits> | 46 #include <limits> |
| 47 | 47 |
| 48 namespace WebCore { | 48 namespace WebCore { |
| 49 | 49 |
| 50 using blink::WebLocalizedString; | 50 using blink::WebLocalizedString; |
| 51 using namespace HTMLNames; | 51 using namespace HTMLNames; |
| 52 using namespace std; | |
| 53 | 52 |
| 54 static const int numberDefaultStep = 1; | 53 static const int numberDefaultStep = 1; |
| 55 static const int numberDefaultStepBase = 0; | 54 static const int numberDefaultStepBase = 0; |
| 56 static const int numberStepScaleFactor = 1; | 55 static const int numberStepScaleFactor = 1; |
| 57 | 56 |
| 58 struct RealNumberRenderSize { | 57 struct RealNumberRenderSize { |
| 59 unsigned sizeBeforeDecimalPoint; | 58 unsigned sizeBeforeDecimalPoint; |
| 60 unsigned sizeAfteDecimalPoint; | 59 unsigned sizeAfteDecimalPoint; |
| 61 | 60 |
| 62 RealNumberRenderSize(unsigned before, unsigned after) | 61 RealNumberRenderSize(unsigned before, unsigned after) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 137 |
| 139 bool NumberInputType::typeMismatch() const | 138 bool NumberInputType::typeMismatch() const |
| 140 { | 139 { |
| 141 ASSERT(!typeMismatchFor(element().value())); | 140 ASSERT(!typeMismatchFor(element().value())); |
| 142 return false; | 141 return false; |
| 143 } | 142 } |
| 144 | 143 |
| 145 StepRange NumberInputType::createStepRange(AnyStepHandling anyStepHandling) cons
t | 144 StepRange NumberInputType::createStepRange(AnyStepHandling anyStepHandling) cons
t |
| 146 { | 145 { |
| 147 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (numb
erDefaultStep, numberDefaultStepBase, numberStepScaleFactor)); | 146 DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (numb
erDefaultStep, numberDefaultStepBase, numberStepScaleFactor)); |
| 148 const Decimal doubleMax = Decimal::fromDouble(numeric_limits<double>::max())
; | 147 const Decimal doubleMax = Decimal::fromDouble(std::numeric_limits<double>::m
ax()); |
| 149 return InputType::createStepRange(anyStepHandling, numberDefaultStepBase, -d
oubleMax, doubleMax, stepDescription); | 148 return InputType::createStepRange(anyStepHandling, numberDefaultStepBase, -d
oubleMax, doubleMax, stepDescription); |
| 150 } | 149 } |
| 151 | 150 |
| 152 bool NumberInputType::sizeShouldIncludeDecoration(int defaultSize, int& preferre
dSize) const | 151 bool NumberInputType::sizeShouldIncludeDecoration(int defaultSize, int& preferre
dSize) const |
| 153 { | 152 { |
| 154 preferredSize = defaultSize; | 153 preferredSize = defaultSize; |
| 155 | 154 |
| 156 const String stepString = element().fastGetAttribute(stepAttr); | 155 const String stepString = element().fastGetAttribute(stepAttr); |
| 157 if (equalIgnoringCase(stepString, "any")) | 156 if (equalIgnoringCase(stepString, "any")) |
| 158 return false; | 157 return false; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 if (element().renderer()) | 286 if (element().renderer()) |
| 288 element().renderer()->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); | 287 element().renderer()->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
| 289 } | 288 } |
| 290 | 289 |
| 291 bool NumberInputType::supportsSelectionAPI() const | 290 bool NumberInputType::supportsSelectionAPI() const |
| 292 { | 291 { |
| 293 return false; | 292 return false; |
| 294 } | 293 } |
| 295 | 294 |
| 296 } // namespace WebCore | 295 } // namespace WebCore |
| OLD | NEW |