Changeset 118677 in webkit
- Timestamp:
- May 28, 2012 5:50:01 AM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r118674 r118677 1 2012-05-28 Keishi Hattori <keishi@webkit.org> 2 3 Expose value localization function of HTMLInputElement 4 https://bugs.webkit.org/show_bug.cgi?id=84356 5 6 Reviewed by Kent Tamura. 7 8 No new tests. 9 10 We want to localize the values that are defined in the datalist element. 11 This adds HTMLInputElement::localizeValue() which will localize a given 12 value. 13 14 * html/BaseDateAndTimeInputType.cpp: 15 (WebCore::BaseDateAndTimeInputType::localizeValue): 16 (WebCore): 17 (WebCore::BaseDateAndTimeInputType::visibleValue): 18 * html/BaseDateAndTimeInputType.h: 19 (BaseDateAndTimeInputType): 20 * html/HTMLInputElement.cpp: 21 (WebCore::HTMLInputElement::localizeValue): 22 (WebCore): 23 * html/HTMLInputElement.h: 24 (HTMLInputElement): 25 * html/InputType.cpp: 26 (WebCore::InputType::localizeValue): 27 (WebCore): 28 * html/InputType.h: 29 (InputType): 30 * html/NumberInputType.cpp: 31 (WebCore::NumberInputType::localizeValue): 32 (WebCore): 33 (WebCore::NumberInputType::visibleValue): 34 * html/NumberInputType.h: 35 (NumberInputType): 36 1 37 2012-05-28 Yury Semikhatsky <yurys@chromium.org> 2 38 -
trunk/Source/WebCore/html/BaseDateAndTimeInputType.cpp
r117738 r118677 156 156 } 157 157 158 String BaseDateAndTimeInputType::localizeValue(const String& proposedValue) const 159 { 160 DateComponents date; 161 if (!parseToDateComponents(proposedValue, &date)) 162 return proposedValue; 163 164 String localized = formatLocalizedDate(date); 165 return localized.isEmpty() ? proposedValue : localized; 166 } 167 158 168 String BaseDateAndTimeInputType::visibleValue() const 159 169 { 160 String currentValue = element()->value(); 161 DateComponents date; 162 if (!parseToDateComponents(currentValue, &date)) 163 return currentValue; 164 165 String localized = formatLocalizedDate(date); 166 return localized.isEmpty() ? currentValue : localized; 170 return localizeValue(element()->value()); 167 171 } 168 172 -
trunk/Source/WebCore/html/BaseDateAndTimeInputType.h
r117738 r118677 62 62 virtual String serialize(double) const OVERRIDE; 63 63 virtual String serializeWithMilliseconds(double) const; 64 virtual String localizeValue(const String&) const OVERRIDE; 64 65 virtual String visibleValue() const OVERRIDE; 65 66 virtual String convertFromVisibleValue(const String&) const OVERRIDE; -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r118192 r118677 1267 1267 } 1268 1268 1269 String HTMLInputElement::localizeValue(const String& proposedValue) const 1270 { 1271 if (proposedValue.isNull()) 1272 return proposedValue; 1273 return m_inputType->localizeValue(proposedValue); 1274 } 1275 1269 1276 bool HTMLInputElement::hasUnacceptableValue() const 1270 1277 { -
trunk/Source/WebCore/html/HTMLInputElement.h
r118192 r118677 148 148 String sanitizeValue(const String&) const; 149 149 150 String localizeValue(const String&) const; 151 150 152 void updateInnerTextValue(); 151 153 -
trunk/Source/WebCore/html/InputType.cpp
r117738 r118677 630 630 } 631 631 632 String InputType::localizeValue(const String& proposedValue) const 633 { 634 return proposedValue; 635 } 636 632 637 String InputType::visibleValue() const 633 638 { -
trunk/Source/WebCore/html/InputType.h
r117738 r118677 168 168 virtual String valueMissingText() const; 169 169 virtual bool canSetStringValue() const; 170 virtual String localizeValue(const String&) const; 170 171 virtual String visibleValue() const; 171 172 virtual String convertFromVisibleValue(const String&) const; -
trunk/Source/WebCore/html/NumberInputType.cpp
r117929 r118677 219 219 } 220 220 221 String NumberInputType::visibleValue() const 222 { 223 String currentValue = element()->value(); 224 if (currentValue.isEmpty()) 225 return currentValue; 221 String NumberInputType::localizeValue(const String& proposedValue) const 222 { 223 if (proposedValue.isEmpty()) 224 return proposedValue; 226 225 // We don't localize scientific notations. 227 if ( currentValue.find(isE) != notFound)228 return currentValue;226 if (proposedValue.find(isE) != notFound) 227 return proposedValue; 229 228 // FIXME: The following three lines should be removed when we 230 229 // remove the second argument of convertToLocalizedNumber(). … … 232 231 // if currentValue isn't valid floating pointer number. 233 232 unsigned decimalPlace; 234 parseToDoubleForNumberTypeWithDecimalPlaces(currentValue, &decimalPlace); 235 return convertToLocalizedNumber(currentValue, decimalPlace); 233 parseToDoubleForNumberTypeWithDecimalPlaces(proposedValue, &decimalPlace); 234 return convertToLocalizedNumber(proposedValue, decimalPlace); 235 } 236 237 String NumberInputType::visibleValue() const 238 { 239 return localizeValue(element()->value()); 236 240 } 237 241 -
trunk/Source/WebCore/html/NumberInputType.h
r117738 r118677 56 56 virtual String serialize(double) const OVERRIDE; 57 57 virtual void handleBlurEvent() OVERRIDE; 58 virtual String localizeValue(const String&) const OVERRIDE; 58 59 virtual String visibleValue() const OVERRIDE; 59 60 virtual String convertFromVisibleValue(const String&) const OVERRIDE; -
trunk/Source/WebKit/chromium/ChangeLog
r118660 r118677 1 2012-05-28 Keishi Hattori <keishi@webkit.org> 2 3 Expose value localization function of HTMLInputElement 4 https://bugs.webkit.org/show_bug.cgi?id=84356 5 6 Reviewed by Kent Tamura. 7 8 * public/WebInputElement.h: 9 (WebInputElement): 10 * src/WebInputElement.cpp: 11 (WebKit::WebInputElement::localizeValue): 12 (WebKit): 13 1 14 2012-05-28 MORITA Hajime <morrita@google.com> 2 15 -
trunk/Source/WebKit/chromium/public/WebInputElement.h
r118601 r118677 97 97 WEBKIT_EXPORT WebNodeCollection dataListOptions() const; 98 98 99 // Return the localized value for this input type. 100 WEBKIT_EXPORT WebString localizeValue(const WebString&) const; 101 99 102 WEBKIT_EXPORT bool isSpeechInputEnabled() const; 100 103 WEBKIT_EXPORT SpeechInputState getSpeechInputState() const; -
trunk/Source/WebKit/chromium/src/WebInputElement.cpp
r118601 r118677 184 184 } 185 185 186 WebString WebInputElement::localizeValue(const WebString& proposedValue) const 187 { 188 return constUnwrap<HTMLInputElement>()->localizeValue(proposedValue); 189 } 190 186 191 bool WebInputElement::isSpeechInputEnabled() const 187 192 {
Note: See TracChangeset
for help on using the changeset viewer.