Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: Source/core/html/forms/InputType.cpp

Issue 149413004: HTMLInputElement.valueAsNumber compliance (NaN handling.) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
8 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 9 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
10 * 10 *
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 exceptionState.throwDOMException(InvalidStateError, "This input element does not support Date values."); 215 exceptionState.throwDOMException(InvalidStateError, "This input element does not support Date values.");
216 } 216 }
217 217
218 double InputType::valueAsDouble() const 218 double InputType::valueAsDouble() const
219 { 219 {
220 return numeric_limits<double>::quiet_NaN(); 220 return numeric_limits<double>::quiet_NaN();
221 } 221 }
222 222
223 void InputType::setValueAsDouble(double doubleValue, TextFieldEventBehavior even tBehavior, ExceptionState& exceptionState) const 223 void InputType::setValueAsDouble(double doubleValue, TextFieldEventBehavior even tBehavior, ExceptionState& exceptionState) const
224 { 224 {
225 setValueAsDecimal(Decimal::fromDouble(doubleValue), eventBehavior, exception State); 225 exceptionState.throwDOMException(InvalidStateError, "This input element does not support Number values.");
226 } 226 }
227 227
228 void InputType::setValueAsDecimal(const Decimal&, TextFieldEventBehavior, Except ionState& exceptionState) const 228 void InputType::setValueAsDecimal(const Decimal& newValue, TextFieldEventBehavio r eventBehavior, ExceptionState&) const
229 { 229 {
230 exceptionState.throwDOMException(InvalidStateError, "This input element does not support Decimal values."); 230 element().setValue(serialize(newValue), eventBehavior);
231 } 231 }
232 232
233 bool InputType::supportsValidation() const 233 bool InputType::supportsValidation() const
234 { 234 {
235 return true; 235 return true;
236 } 236 }
237 237
238 bool InputType::typeMismatchFor(const String&) const 238 bool InputType::typeMismatchFor(const String&) const
239 { 239 {
240 return false; 240 return false;
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 StepRange InputType::createStepRange(AnyStepHandling anyStepHandling, const Deci mal& stepBaseDefault, const Decimal& minimumDefault, const Decimal& maximumDefau lt, const StepRange::StepDescription& stepDescription) const 982 StepRange InputType::createStepRange(AnyStepHandling anyStepHandling, const Deci mal& stepBaseDefault, const Decimal& minimumDefault, const Decimal& maximumDefau lt, const StepRange::StepDescription& stepDescription) const
983 { 983 {
984 const Decimal stepBase = findStepBase(stepBaseDefault); 984 const Decimal stepBase = findStepBase(stepBaseDefault);
985 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), m inimumDefault); 985 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), m inimumDefault);
986 const Decimal maximum = parseToNumber(element().fastGetAttribute(maxAttr), m aximumDefault); 986 const Decimal maximum = parseToNumber(element().fastGetAttribute(maxAttr), m aximumDefault);
987 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().fastGetAttribute(stepAttr)); 987 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().fastGetAttribute(stepAttr));
988 return StepRange(stepBase, minimum, maximum, step, stepDescription); 988 return StepRange(stepBase, minimum, maximum, step, stepDescription);
989 } 989 }
990 990
991 } // namespace WebCore 991 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698