Changeset 114999 in webkit
- Timestamp:
- Apr 23, 2012 10:57:33 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r114998 r114999 1 2012-04-23 Kent Tamura <tkent@chromium.org> 2 3 Show the format indicator in a date field 4 https://bugs.webkit.org/show_bug.cgi?id=83872 5 6 Reviewed by Hajime Morita. 7 8 * fast/forms/date/date-fixed-placeholder-expected.txt: Added. 9 * fast/forms/date/date-fixed-placeholder.html: Added. 10 * platform/chromium/test_expectations.txt: 11 Mark date-appearance.html FAIL because of render dump change. 12 1 13 2012-04-23 Dmitry Titov <dimich@chromium.org> 2 14 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r114995 r114999 1098 1098 BUGWK29359 : fast/forms/time = PASS FAIL 1099 1099 BUGWK29359 : fast/forms/week = PASS FAIL 1100 // Need rebaseline 1101 BUGWK83872 : fast/forms/date/date-appearance.html = FAIL 1100 1102 1101 1103 BUGCR78376 : http/tests/media/video-play-stall-seek.html = TIMEOUT -
trunk/Source/WebCore/ChangeLog
r114997 r114999 1 2012-04-23 Kent Tamura <tkent@chromium.org> 2 3 Show the format indicator in a date field 4 https://bugs.webkit.org/show_bug.cgi?id=83872 5 6 Reviewed by Hajime Morita. 7 8 Enable the fixed placeholder feature for the date type, and show 9 the editable date format as the fixed placeholder. 10 The format string is created by the following steps. 11 1. Obtain a pattern string from ICU 12 http://icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details 13 2. Replace a sequence of 'y', 'Y', 'M', or 'd' in the pattern with 14 a natural language string such as "year", "month", or "day". 15 16 Test: fast/forms/date/date-fixed-placeholder.html 17 18 * html/DateInputType.cpp: 19 (WebCore::DateInputType::supportsPlaceholder): Added. Returns true. 20 (WebCore::DateInputType::usesFixedPlaceholder): Added. Returns true. 21 (WebCore::DateInputType::fixedPlaceholder): 22 Added. Calls localizedDateFormatText() provided by LocalizedDate.h. 23 * html/DateInputType.h: 24 (DateInputType): Add declarations of new override functions. 25 * platform/LocalizedStrings.h: 26 (WebCore): Add dateFormat{Year,Month,DayInMonth}Text() 27 * platform/text/ICULocale.cpp: 28 (WebCore::isICUYearSymbol): A function to improve redability. 29 (WebCore::isICUMonthSymbol): ditto. 30 (WebCore::isICUDayInMonthSymbol): ditto. 31 (WebCore::localizeFormat): Step 2 of the above description. 32 (WebCore::ICULocale::initializeLocalizedDateFormatText): 33 Step 1 of the above description. 34 (WebCore::ICULocale::localizedDateFormatText): 35 * platform/text/ICULocale.h: 36 (ICULocale): Add new functions and a data member. 37 * platform/text/LocalizedDate.h: 38 (WebCore): Add localizedDateFormatText(). 39 * platform/text/LocalizedDateICU.cpp: 40 (WebCore::localizedDateFormatText): 41 Just call ICULocale::localizedDateFormatText(). 42 1 43 2012-04-23 Kentaro Hara <haraken@chromium.org> 2 44 -
trunk/Source/WebCore/html/DateInputType.cpp
r114092 r114999 36 36 #include "HTMLInputElement.h" 37 37 #include "HTMLNames.h" 38 #include "LocalizedDate.h" 38 39 #include <wtf/PassOwnPtr.h> 39 40 … … 140 141 element()->updateInnerTextValue(); 141 142 } 143 144 bool DateInputType::supportsPlaceholder() const 145 { 146 return true; 147 } 148 149 bool DateInputType::usesFixedPlaceholder() const 150 { 151 return true; 152 } 153 154 String DateInputType::fixedPlaceholder() 155 { 156 return localizedDateFormatText(); 157 } 142 158 #endif // ENABLE(CALENDAR_PICKER) 143 159 -
trunk/Source/WebCore/html/DateInputType.h
r113972 r114999 60 60 virtual void destroyShadowSubtree() OVERRIDE; 61 61 virtual void handleBlurEvent() OVERRIDE; 62 virtual bool supportsPlaceholder() const OVERRIDE; 63 virtual bool usesFixedPlaceholder() const OVERRIDE; 64 virtual String fixedPlaceholder() OVERRIDE; 62 65 63 66 // TextFieldInputType functions -
trunk/Source/WebCore/platform/LocalizedStrings.h
r113166 r114999 215 215 String calendarTodayText(); 216 216 String calendarClearText(); 217 String dateFormatYearText(); 218 String dateFormatMonthText(); 219 String dateFormatDayInMonthText(); 217 220 #endif 218 221 -
trunk/Source/WebCore/platform/text/ICULocale.cpp
r114971 r114999 32 32 #include "ICULocale.h" 33 33 34 #include "LocalizedStrings.h" 34 35 #include <limits> 35 36 #include <wtf/PassOwnPtr.h> … … 312 313 313 314 #if ENABLE(CALENDAR_PICKER) 315 static inline bool isICUYearSymbol(UChar letter) 316 { 317 return letter == 'y' || letter == 'Y'; 318 } 319 320 static inline bool isICUMonthSymbol(UChar letter) 321 { 322 return letter == 'M'; 323 } 324 325 static inline bool isICUDayInMonthSymbol(UChar letter) 326 { 327 return letter == 'd'; 328 } 329 330 // Specification of the input: 331 // http://icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details 332 static String localizeFormat(const Vector<UChar>& buffer) 333 { 334 StringBuilder builder; 335 UChar lastChar = 0; 336 bool inQuote = false; 337 for (unsigned i = 0; i < buffer.size(); ++i) { 338 if (inQuote) { 339 if (buffer[i] == '\'') { 340 inQuote = false; 341 lastChar = 0; 342 ASSERT(i); 343 if (buffer[i - 1] == '\'') 344 builder.append('\''); 345 } else 346 builder.append(buffer[i]); 347 } else { 348 if (isASCIIAlpha(lastChar) && lastChar == buffer[i]) 349 continue; 350 lastChar = buffer[i]; 351 if (isICUYearSymbol(lastChar)) { 352 String text = dateFormatYearText(); 353 builder.append(text.isEmpty() ? "Year" : text); 354 } else if (isICUMonthSymbol(lastChar)) { 355 String text = dateFormatMonthText(); 356 builder.append(text.isEmpty() ? "Month" : text); 357 } else if (isICUDayInMonthSymbol(lastChar)) { 358 String text = dateFormatDayInMonthText(); 359 builder.append(text.isEmpty() ? "Day" : text); 360 } else if (lastChar == '\'') 361 inQuote = true; 362 else 363 builder.append(lastChar); 364 } 365 } 366 return builder.toString(); 367 } 368 369 void ICULocale::initializeLocalizedDateFormatText() 370 { 371 if (!m_localizedDateFormatText.isNull()) 372 return; 373 m_localizedDateFormatText = String(""); 374 if (!initializeShortDateFormat()) 375 return; 376 UErrorCode status = U_ZERO_ERROR; 377 int32_t length = udat_toPattern(m_shortDateFormat, TRUE, 0, 0, &status); 378 if (status != U_BUFFER_OVERFLOW_ERROR) 379 return; 380 Vector<UChar> buffer(length); 381 status = U_ZERO_ERROR; 382 udat_toPattern(m_shortDateFormat, TRUE, buffer.data(), length, &status); 383 if (U_FAILURE(status)) 384 return; 385 m_localizedDateFormatText = localizeFormat(buffer); 386 } 387 388 String ICULocale::localizedDateFormatText() 389 { 390 initializeLocalizedDateFormatText(); 391 return m_localizedDateFormatText; 392 } 393 314 394 PassOwnPtr<Vector<String> > ICULocale::createLabelVector(UDateFormatSymbolType type, int32_t startIndex, int32_t size) 315 395 { -
trunk/Source/WebCore/platform/text/ICULocale.h
r114971 r114999 57 57 double parseLocalizedDate(const String&); 58 58 String formatLocalizedDate(const DateComponents&); 59 #if ENABLE(CALENDAR_PICKER) 60 String localizedDateFormatText(); 59 61 60 #if ENABLE(CALENDAR_PICKER)61 62 // For LocalizedCalendar 62 63 const Vector<String>& monthLabels(); … … 78 79 79 80 #if ENABLE(CALENDAR_PICKER) 81 void initializeLocalizedDateFormatText(); 80 82 PassOwnPtr<Vector<String> > createLabelVector(UDateFormatSymbolType, int32_t startIndex, int32_t size); 81 83 void initializeCalendar(); … … 100 102 101 103 #if ENABLE(CALENDAR_PICKER) 104 String m_localizedDateFormatText; 102 105 OwnPtr<Vector<String> > m_monthLabels; 103 106 OwnPtr<Vector<String> > m_weekDayShortLabels; -
trunk/Source/WebCore/platform/text/LocalizedDate.h
r95901 r114999 45 45 String formatLocalizedDate(const DateComponents& dateComponents); 46 46 47 #if ENABLE(CALENDAR_PICKER) 48 String localizedDateFormatText(); 49 #endif 47 50 } // namespace WebCore 48 51 -
trunk/Source/WebCore/platform/text/LocalizedDateICU.cpp
r114971 r114999 71 71 } 72 72 73 #if ENABLE(CALENDAR_PICKER) 74 String localizedDateFormatText() 75 { 76 return ICULocale::currentLocale()->localizedDateFormatText(); 73 77 } 78 #endif 79 80 } -
trunk/Source/WebKit/chromium/ChangeLog
r114993 r114999 1 2012-04-23 Kent Tamura <tkent@chromium.org> 2 3 Show the format indicator in a date field 4 https://bugs.webkit.org/show_bug.cgi?id=83872 5 6 Reviewed by Hajime Morita. 7 8 * src/LocalizedStrings.cpp: 9 (WebCore::dateFormatYearText): Added a stub. 10 (WebCore::dateFormatMonthText): ditto. 11 (WebCore::dateFormatDayInMonthText): ditto. 12 1 13 2012-04-23 Michael Nordman <michaeln@google.com> 2 14 -
trunk/Source/WebKit/chromium/src/LocalizedStrings.cpp
r114186 r114999 407 407 return query(WebLocalizedString::CalendarClear); 408 408 } 409 410 String dateFormatYearText() 411 { 412 // FXIME: Implement. 413 return String(); 414 } 415 416 String dateFormatMonthText() 417 { 418 // FXIME: Implement. 419 return String(); 420 } 421 422 String dateFormatDayInMonthText() 423 { 424 // FXIME: Implement. 425 return String(); 426 } 409 427 #endif 410 428
Note: See TracChangeset
for help on using the changeset viewer.