|
Lines 48-54
a/Source/WebCore/html/NumberInputType.cpp_sec1
|
| 48 |
namespace WebCore { |
48 |
namespace WebCore { |
| 49 |
|
49 |
|
| 50 |
using namespace HTMLNames; |
50 |
using namespace HTMLNames; |
| 51 |
using namespace std; |
|
|
| 52 |
|
51 |
|
| 53 |
static const double numberDefaultStep = 1.0; |
52 |
static const double numberDefaultStep = 1.0; |
| 54 |
static const double numberStepScaleFactor = 1.0; |
53 |
static const double numberStepScaleFactor = 1.0; |
|
Lines 65-80
const AtomicString& NumberInputType::formControlType() const
a/Source/WebCore/html/NumberInputType.cpp_sec2
|
| 65 |
|
64 |
|
| 66 |
double NumberInputType::valueAsNumber() const |
65 |
double NumberInputType::valueAsNumber() const |
| 67 |
{ |
66 |
{ |
| 68 |
return parseToDouble(element()->value(), numeric_limits<double>::quiet_NaN()); |
67 |
return parseToDouble(element()->value(), std::numeric_limits<double>::quiet_NaN()); |
| 69 |
} |
68 |
} |
| 70 |
|
69 |
|
| 71 |
void NumberInputType::setValueAsNumber(double newValue, ExceptionCode& ec) const |
70 |
void NumberInputType::setValueAsNumber(double newValue, ExceptionCode& ec) const |
| 72 |
{ |
71 |
{ |
| 73 |
if (newValue < -numeric_limits<float>::max()) { |
72 |
if (newValue < -std::numeric_limits<float>::max()) { |
| 74 |
ec = INVALID_STATE_ERR; |
73 |
ec = INVALID_STATE_ERR; |
| 75 |
return; |
74 |
return; |
| 76 |
} |
75 |
} |
| 77 |
if (newValue > numeric_limits<float>::max()) { |
76 |
if (newValue > std::numeric_limits<float>::max()) { |
| 78 |
ec = INVALID_STATE_ERR; |
77 |
ec = INVALID_STATE_ERR; |
| 79 |
return; |
78 |
return; |
| 80 |
} |
79 |
} |
|
Lines 94-107
bool NumberInputType::typeMismatch() const
a/Source/WebCore/html/NumberInputType.cpp_sec3
|
| 94 |
|
93 |
|
| 95 |
bool NumberInputType::rangeUnderflow(const String& value) const |
94 |
bool NumberInputType::rangeUnderflow(const String& value) const |
| 96 |
{ |
95 |
{ |
| 97 |
const double nan = numeric_limits<double>::quiet_NaN(); |
96 |
const double nan = std::numeric_limits<double>::quiet_NaN(); |
| 98 |
double doubleValue = parseToDouble(value, nan); |
97 |
double doubleValue = parseToDouble(value, nan); |
| 99 |
return isfinite(doubleValue) && doubleValue < minimum(); |
98 |
return isfinite(doubleValue) && doubleValue < minimum(); |
| 100 |
} |
99 |
} |
| 101 |
|
100 |
|
| 102 |
bool NumberInputType::rangeOverflow(const String& value) const |
101 |
bool NumberInputType::rangeOverflow(const String& value) const |
| 103 |
{ |
102 |
{ |
| 104 |
const double nan = numeric_limits<double>::quiet_NaN(); |
103 |
const double nan = std::numeric_limits<double>::quiet_NaN(); |
| 105 |
double doubleValue = parseToDouble(value, nan); |
104 |
double doubleValue = parseToDouble(value, nan); |
| 106 |
return isfinite(doubleValue) && doubleValue > maximum(); |
105 |
return isfinite(doubleValue) && doubleValue > maximum(); |
| 107 |
} |
106 |
} |
|
Lines 113-124
bool NumberInputType::supportsRangeLimitation() const
a/Source/WebCore/html/NumberInputType.cpp_sec4
|
| 113 |
|
112 |
|
| 114 |
double NumberInputType::minimum() const |
113 |
double NumberInputType::minimum() const |
| 115 |
{ |
114 |
{ |
| 116 |
return parseToDouble(element()->fastGetAttribute(minAttr), -numeric_limits<float>::max()); |
115 |
return parseToDouble(element()->fastGetAttribute(minAttr), -std::numeric_limits<float>::max()); |
| 117 |
} |
116 |
} |
| 118 |
|
117 |
|
| 119 |
double NumberInputType::maximum() const |
118 |
double NumberInputType::maximum() const |
| 120 |
{ |
119 |
{ |
| 121 |
return parseToDouble(element()->fastGetAttribute(maxAttr), numeric_limits<float>::max()); |
120 |
return parseToDouble(element()->fastGetAttribute(maxAttr), std::numeric_limits<float>::max()); |
| 122 |
} |
121 |
} |
| 123 |
|
122 |
|
| 124 |
bool NumberInputType::stepMismatch(const String& value, double step) const |
123 |
bool NumberInputType::stepMismatch(const String& value, double step) const |
|
Lines 222-228
String NumberInputType::visibleValue() const
a/Source/WebCore/html/NumberInputType.cpp_sec5
|
| 222 |
String currentValue = element()->value(); |
221 |
String currentValue = element()->value(); |
| 223 |
if (currentValue.isEmpty()) |
222 |
if (currentValue.isEmpty()) |
| 224 |
return currentValue; |
223 |
return currentValue; |
| 225 |
double doubleValue = numeric_limits<double>::quiet_NaN(); |
224 |
double doubleValue = std::numeric_limits<double>::quiet_NaN(); |
| 226 |
unsigned decimalPlace; |
225 |
unsigned decimalPlace; |
| 227 |
parseToDoubleForNumberTypeWithDecimalPlaces(currentValue, &doubleValue, &decimalPlace); |
226 |
parseToDoubleForNumberTypeWithDecimalPlaces(currentValue, &doubleValue, &decimalPlace); |
| 228 |
String localized = formatLocalizedNumber(doubleValue, decimalPlace); |
227 |
String localized = formatLocalizedNumber(doubleValue, decimalPlace); |
| 229 |
- |
|
|