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

Side by Side Diff: Source/platform/text/PlatformLocale.cpp

Issue 435753003: Implement minlength for <input> and <textarea>. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add layout tests for minlength & maxlength together; fix comments Created 6 years, 2 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) 2011,2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011,2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 { 206 {
207 // FIXME: Returns a string locazlied for this locale. 207 // FIXME: Returns a string locazlied for this locale.
208 return Platform::current()->queryLocalizedString(name, parameter1, parameter 2); 208 return Platform::current()->queryLocalizedString(name, parameter1, parameter 2);
209 } 209 }
210 210
211 String Locale::validationMessageTooLongText(unsigned valueLength, int maxLength) 211 String Locale::validationMessageTooLongText(unsigned valueLength, int maxLength)
212 { 212 {
213 return queryString(WebLocalizedString::ValidationTooLong, convertToLocalized Number(String::number(valueLength)), convertToLocalizedNumber(String::number(max Length))); 213 return queryString(WebLocalizedString::ValidationTooLong, convertToLocalized Number(String::number(valueLength)), convertToLocalizedNumber(String::number(max Length)));
214 } 214 }
215 215
216 String Locale::validationMessageTooShortText(unsigned valueLength, int minLength )
217 {
218 return queryString(WebLocalizedString::ValidationTooShort, convertToLocalize dNumber(String::number(valueLength)), convertToLocalizedNumber(String::number(mi nLength)));
219 }
220
216 String Locale::weekFormatInLDML() 221 String Locale::weekFormatInLDML()
217 { 222 {
218 String templ = queryString(WebLocalizedString::WeekFormatTemplate); 223 String templ = queryString(WebLocalizedString::WeekFormatTemplate);
219 // Converts a string like "Week $2, $1" to an LDML date format pattern like 224 // Converts a string like "Week $2, $1" to an LDML date format pattern like
220 // "'Week 'ww', 'yyyy". 225 // "'Week 'ww', 'yyyy".
221 StringBuilder builder; 226 StringBuilder builder;
222 unsigned literalStart = 0; 227 unsigned literalStart = 0;
223 unsigned length = templ.length(); 228 unsigned length = templ.length();
224 for (unsigned i = 0; i + 1 < length; ++i) { 229 for (unsigned i = 0; i + 1 < length; ++i) {
225 if (templ[i] == '$' && (templ[i + 1] == '1' || templ[i + 1] == '2')) { 230 if (templ[i] == '$' && (templ[i + 1] == '1' || templ[i + 1] == '2')) {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 builder.build(formatType == FormatTypeShort ? dateTimeFormatWithoutSecon ds() : dateTimeFormatWithSeconds()); 416 builder.build(formatType == FormatTypeShort ? dateTimeFormatWithoutSecon ds() : dateTimeFormatWithSeconds());
412 break; 417 break;
413 case DateComponents::Invalid: 418 case DateComponents::Invalid:
414 ASSERT_NOT_REACHED(); 419 ASSERT_NOT_REACHED();
415 break; 420 break;
416 } 421 }
417 return builder.toString(); 422 return builder.toString();
418 } 423 }
419 424
420 } 425 }
OLDNEW
« Source/core/html/HTMLTextAreaElement.cpp ('K') | « Source/platform/text/PlatformLocale.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698