| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 for (size_t i = 0; i < sizeof(localeScriptList) / sizeof(localeScriptLis
t[0]); ++i) | 384 for (size_t i = 0; i < sizeof(localeScriptList) / sizeof(localeScriptLis
t[0]); ++i) |
| 385 localeScriptMap.set(localeScriptList[i].locale, localeScriptList[i].
script); | 385 localeScriptMap.set(localeScriptList[i].locale, localeScriptList[i].
script); |
| 386 } | 386 } |
| 387 | 387 |
| 388 String canonicalLocale = locale.lower().replace('-', '_'); | 388 String canonicalLocale = locale.lower().replace('-', '_'); |
| 389 while (!canonicalLocale.isEmpty()) { | 389 while (!canonicalLocale.isEmpty()) { |
| 390 HashMap<String, UScriptCode>::iterator it = localeScriptMap.find(canonic
alLocale); | 390 HashMap<String, UScriptCode>::iterator it = localeScriptMap.find(canonic
alLocale); |
| 391 if (it != localeScriptMap.end()) | 391 if (it != localeScriptMap.end()) |
| 392 return it->value; | 392 return it->value; |
| 393 size_t pos = canonicalLocale.reverseFind('_'); | 393 size_t pos = canonicalLocale.reverseFind('_'); |
| 394 if (pos == notFound) | 394 if (pos == kNotFound) |
| 395 break; | 395 break; |
| 396 UScriptCode code = scriptNameToCode(canonicalLocale.substring(pos + 1)); | 396 UScriptCode code = scriptNameToCode(canonicalLocale.substring(pos + 1)); |
| 397 if (code != USCRIPT_INVALID_CODE && code != USCRIPT_UNKNOWN) | 397 if (code != USCRIPT_INVALID_CODE && code != USCRIPT_UNKNOWN) |
| 398 return code; | 398 return code; |
| 399 canonicalLocale = canonicalLocale.substring(0, pos); | 399 canonicalLocale = canonicalLocale.substring(0, pos); |
| 400 } | 400 } |
| 401 return USCRIPT_COMMON; | 401 return USCRIPT_COMMON; |
| 402 } | 402 } |
| 403 | 403 |
| 404 } // namespace WebCore | 404 } // namespace WebCore |
| OLD | NEW |