OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the WebKit project. | 2 * This file is part of the WebKit project. |
3 * | 3 * |
4 * Copyright (C) 2009 Michelangelo De Simone <micdesim@gmail.com> | 4 * Copyright (C) 2009 Michelangelo De Simone <micdesim@gmail.com> |
5 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 DCHECK(idna); | 86 DCHECK(idna); |
87 icu::IDNAInfo idna_info; | 87 icu::IDNAInfo idna_info; |
88 idna->nameToASCII(idn_domain_name, domain_name, idna_info, error_code); | 88 idna->nameToASCII(idn_domain_name, domain_name, idna_info, error_code); |
89 if (U_FAILURE(error_code) || idna_info.hasErrors() || | 89 if (U_FAILURE(error_code) || idna_info.hasErrors() || |
90 domain_name.length() > kMaximumDomainNameLength) | 90 domain_name.length() > kMaximumDomainNameLength) |
91 return address; | 91 return address; |
92 | 92 |
93 StringBuilder builder; | 93 StringBuilder builder; |
94 builder.Append(address, 0, at_position + 1); | 94 builder.Append(address, 0, at_position + 1); |
95 #if U_ICU_VERSION_MAJOR_NUM >= 59 | 95 #if U_ICU_VERSION_MAJOR_NUM >= 59 |
96 builder.Append(icu::toUCharPtr(domain_name.getBuffer()), domain_name.length())
; | 96 builder.Append(icu::toUCharPtr(domain_name.getBuffer()), |
| 97 domain_name.length()); |
97 #else | 98 #else |
98 builder.Append(domain_name.getBuffer(), domain_name.length()); | 99 builder.Append(domain_name.getBuffer(), domain_name.length()); |
99 #endif | 100 #endif |
100 String ascii_email = builder.ToString(); | 101 String ascii_email = builder.ToString(); |
101 return IsValidEmailAddress(regexp, ascii_email) ? ascii_email : address; | 102 return IsValidEmailAddress(regexp, ascii_email) ? ascii_email : address; |
102 } | 103 } |
103 | 104 |
104 String EmailInputType::ConvertEmailAddressToUnicode( | 105 String EmailInputType::ConvertEmailAddressToUnicode( |
105 const String& address) const { | 106 const String& address) const { |
106 if (!address.ContainsOnlyASCII()) | 107 if (!address.ContainsOnlyASCII()) |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 builder.ReserveCapacity(value.length()); | 313 builder.ReserveCapacity(value.length()); |
313 for (size_t i = 0; i < addresses.size(); ++i) { | 314 for (size_t i = 0; i < addresses.size(); ++i) { |
314 if (i > 0) | 315 if (i > 0) |
315 builder.Append(','); | 316 builder.Append(','); |
316 builder.Append(ConvertEmailAddressToUnicode(addresses[i])); | 317 builder.Append(ConvertEmailAddressToUnicode(addresses[i])); |
317 } | 318 } |
318 return builder.ToString(); | 319 return builder.ToString(); |
319 } | 320 } |
320 | 321 |
321 } // namespace blink | 322 } // namespace blink |
OLD | NEW |