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

Side by Side Diff: Source/WebCore/html/NumberInputType.cpp

Issue 11884049: Merge 139151 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « Source/WebCore/html/NumberInputType.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 PassOwnPtr<InputType> NumberInputType::create(HTMLInputElement* element) 99 PassOwnPtr<InputType> NumberInputType::create(HTMLInputElement* element)
100 { 100 {
101 return adoptPtr(new NumberInputType(element)); 101 return adoptPtr(new NumberInputType(element));
102 } 102 }
103 103
104 const AtomicString& NumberInputType::formControlType() const 104 const AtomicString& NumberInputType::formControlType() const
105 { 105 {
106 return InputTypeNames::number(); 106 return InputTypeNames::number();
107 } 107 }
108 108
109 void NumberInputType::setValue(const String& sanitizedValue, bool valueChanged, TextFieldEventBehavior eventBehavior)
110 {
111 if (!valueChanged && sanitizedValue.isEmpty() && !element()->innerTextValue( ).isEmpty())
112 updateInnerTextValue();
113 TextFieldInputType::setValue(sanitizedValue, valueChanged, eventBehavior);
114 }
115
109 double NumberInputType::valueAsDouble() const 116 double NumberInputType::valueAsDouble() const
110 { 117 {
111 return parseToDoubleForNumberType(element()->value()); 118 return parseToDoubleForNumberType(element()->value());
112 } 119 }
113 120
114 void NumberInputType::setValueAsDouble(double newValue, TextFieldEventBehavior e ventBehavior, ExceptionCode& ec) const 121 void NumberInputType::setValueAsDouble(double newValue, TextFieldEventBehavior e ventBehavior, ExceptionCode& ec) const
115 { 122 {
116 // FIXME: We should use numeric_limits<double>::max for number input type. 123 // FIXME: We should use numeric_limits<double>::max for number input type.
117 const double floatMax = numeric_limits<float>::max(); 124 const double floatMax = numeric_limits<float>::max();
118 if (newValue < -floatMax) { 125 if (newValue < -floatMax) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 294
288 void NumberInputType::stepAttributeChanged() 295 void NumberInputType::stepAttributeChanged()
289 { 296 {
290 InputType::stepAttributeChanged(); 297 InputType::stepAttributeChanged();
291 298
292 if (element()->renderer()) 299 if (element()->renderer())
293 element()->renderer()->setNeedsLayoutAndPrefWidthsRecalc(); 300 element()->renderer()->setNeedsLayoutAndPrefWidthsRecalc();
294 } 301 }
295 302
296 } // namespace WebCore 303 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/html/NumberInputType.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698