| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 using namespace std; | 50 using namespace std; |
| 51 | 51 |
| 52 namespace WebCore { | 52 namespace WebCore { |
| 53 | 53 |
| 54 typedef LCID (WINAPI* LocaleNameToLCIDPtr)(LPCWSTR, DWORD); | 54 typedef LCID (WINAPI* LocaleNameToLCIDPtr)(LPCWSTR, DWORD); |
| 55 typedef HashMap<String, LCID> NameToLCIDMap; | 55 typedef HashMap<String, LCID> NameToLCIDMap; |
| 56 | 56 |
| 57 static String extractLanguageCode(const String& locale) | 57 static String extractLanguageCode(const String& locale) |
| 58 { | 58 { |
| 59 size_t dashPosition = locale.find('-'); | 59 size_t dashPosition = locale.find('-'); |
| 60 if (dashPosition == notFound) | 60 if (dashPosition == kNotFound) |
| 61 return locale; | 61 return locale; |
| 62 return locale.left(dashPosition); | 62 return locale.left(dashPosition); |
| 63 } | 63 } |
| 64 | 64 |
| 65 static String removeLastComponent(const String& name) | 65 static String removeLastComponent(const String& name) |
| 66 { | 66 { |
| 67 size_t lastSeparator = name.reverseFind('-'); | 67 size_t lastSeparator = name.reverseFind('-'); |
| 68 if (lastSeparator == notFound) | 68 if (lastSeparator == kNotFound) |
| 69 return emptyString(); | 69 return emptyString(); |
| 70 return name.left(lastSeparator); | 70 return name.left(lastSeparator); |
| 71 } | 71 } |
| 72 | 72 |
| 73 static void ensureNameToLCIDMap(NameToLCIDMap& map) | 73 static void ensureNameToLCIDMap(NameToLCIDMap& map) |
| 74 { | 74 { |
| 75 if (!map.isEmpty()) | 75 if (!map.isEmpty()) |
| 76 return; | 76 return; |
| 77 // http://www.microsoft.com/resources/msdn/goglobal/default.mspx | 77 // http://www.microsoft.com/resources/msdn/goglobal/default.mspx |
| 78 // We add only locales used in layout tests for now. | 78 // We add only locales used in layout tests for now. |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 if (!m_timeFormatWithoutSeconds.isNull()) | 448 if (!m_timeFormatWithoutSeconds.isNull()) |
| 449 return m_timeFormatWithoutSeconds; | 449 return m_timeFormatWithoutSeconds; |
| 450 String format = getLocaleInfoString(LOCALE_SSHORTTIME); | 450 String format = getLocaleInfoString(LOCALE_SSHORTTIME); |
| 451 // Vista or older Windows doesn't support LOCALE_SSHORTTIME. | 451 // Vista or older Windows doesn't support LOCALE_SSHORTTIME. |
| 452 if (format.isEmpty()) { | 452 if (format.isEmpty()) { |
| 453 format = getLocaleInfoString(LOCALE_STIMEFORMAT); | 453 format = getLocaleInfoString(LOCALE_STIMEFORMAT); |
| 454 StringBuilder builder; | 454 StringBuilder builder; |
| 455 builder.append(getLocaleInfoString(LOCALE_STIME)); | 455 builder.append(getLocaleInfoString(LOCALE_STIME)); |
| 456 builder.append("ss"); | 456 builder.append("ss"); |
| 457 size_t pos = format.reverseFind(builder.toString()); | 457 size_t pos = format.reverseFind(builder.toString()); |
| 458 if (pos != notFound) | 458 if (pos != kNotFound) |
| 459 format.remove(pos, builder.length()); | 459 format.remove(pos, builder.length()); |
| 460 } | 460 } |
| 461 m_timeFormatWithoutSeconds = convertWindowsDateTimeFormat(format); | 461 m_timeFormatWithoutSeconds = convertWindowsDateTimeFormat(format); |
| 462 return m_timeFormatWithoutSeconds; | 462 return m_timeFormatWithoutSeconds; |
| 463 } | 463 } |
| 464 | 464 |
| 465 String LocaleWin::dateTimeFormatWithSeconds() | 465 String LocaleWin::dateTimeFormatWithSeconds() |
| 466 { | 466 { |
| 467 if (!m_dateTimeFormatWithSeconds.isNull()) | 467 if (!m_dateTimeFormatWithSeconds.isNull()) |
| 468 return m_dateTimeFormatWithSeconds; | 468 return m_dateTimeFormatWithSeconds; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 case NegativeFormatSignPrefix: // Fall through. | 578 case NegativeFormatSignPrefix: // Fall through. |
| 579 default: | 579 default: |
| 580 negativePrefix = negativeSign; | 580 negativePrefix = negativeSign; |
| 581 break; | 581 break; |
| 582 } | 582 } |
| 583 m_didInitializeNumberData = true; | 583 m_didInitializeNumberData = true; |
| 584 setLocaleData(symbols, emptyString(), emptyString(), negativePrefix, negativ
eSuffix); | 584 setLocaleData(symbols, emptyString(), emptyString(), negativePrefix, negativ
eSuffix); |
| 585 } | 585 } |
| 586 | 586 |
| 587 } | 587 } |
| OLD | NEW |