| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 String EmailInputType::sanitizeValue(const String& proposedValue) const | 250 String EmailInputType::sanitizeValue(const String& proposedValue) const |
| 251 { | 251 { |
| 252 String noLineBreakValue = proposedValue.removeCharacters(isHTMLLineBreak); | 252 String noLineBreakValue = proposedValue.removeCharacters(isHTMLLineBreak); |
| 253 if (!element().multiple()) | 253 if (!element().multiple()) |
| 254 return stripLeadingAndTrailingHTMLSpaces(noLineBreakValue); | 254 return stripLeadingAndTrailingHTMLSpaces(noLineBreakValue); |
| 255 Vector<String> addresses; | 255 Vector<String> addresses; |
| 256 noLineBreakValue.split(',', true, addresses); | 256 noLineBreakValue.split(',', true, addresses); |
| 257 StringBuilder strippedValue; | 257 StringBuilder strippedValue; |
| 258 for (size_t i = 0; i < addresses.size(); ++i) { | 258 for (size_t i = 0; i < addresses.size(); ++i) { |
| 259 if (i > 0) | 259 if (i > 0) |
| 260 strippedValue.append(","); | 260 strippedValue.append(','); |
| 261 strippedValue.append(stripLeadingAndTrailingHTMLSpaces(addresses[i])); | 261 strippedValue.append(stripLeadingAndTrailingHTMLSpaces(addresses[i])); |
| 262 } | 262 } |
| 263 return strippedValue.toString(); | 263 return strippedValue.toString(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 String EmailInputType::convertFromVisibleValue(const String& visibleValue) const | 266 String EmailInputType::convertFromVisibleValue(const String& visibleValue) const |
| 267 { | 267 { |
| 268 String sanitizedValue = sanitizeValue(visibleValue); | 268 String sanitizedValue = sanitizeValue(visibleValue); |
| 269 if (!element().multiple()) | 269 if (!element().multiple()) |
| 270 return convertEmailAddressToASCII(sanitizedValue); | 270 return convertEmailAddressToASCII(sanitizedValue); |
| 271 Vector<String> addresses; | 271 Vector<String> addresses; |
| 272 sanitizedValue.split(',', true, addresses); | 272 sanitizedValue.split(',', true, addresses); |
| 273 StringBuilder builder; | 273 StringBuilder builder; |
| 274 builder.reserveCapacity(sanitizedValue.length()); | 274 builder.reserveCapacity(sanitizedValue.length()); |
| 275 for (size_t i = 0; i < addresses.size(); ++i) { | 275 for (size_t i = 0; i < addresses.size(); ++i) { |
| 276 if (i > 0) | 276 if (i > 0) |
| 277 builder.append(","); | 277 builder.append(','); |
| 278 builder.append(convertEmailAddressToASCII(addresses[i])); | 278 builder.append(convertEmailAddressToASCII(addresses[i])); |
| 279 } | 279 } |
| 280 return builder.toString(); | 280 return builder.toString(); |
| 281 } | 281 } |
| 282 | 282 |
| 283 String EmailInputType::visibleValue() const | 283 String EmailInputType::visibleValue() const |
| 284 { | 284 { |
| 285 String value = element().value(); | 285 String value = element().value(); |
| 286 if (!element().multiple()) | 286 if (!element().multiple()) |
| 287 return convertEmailAddressToUnicode(value); | 287 return convertEmailAddressToUnicode(value); |
| 288 | 288 |
| 289 Vector<String> addresses; | 289 Vector<String> addresses; |
| 290 value.split(',', true, addresses); | 290 value.split(',', true, addresses); |
| 291 StringBuilder builder; | 291 StringBuilder builder; |
| 292 builder.reserveCapacity(value.length()); | 292 builder.reserveCapacity(value.length()); |
| 293 for (size_t i = 0; i < addresses.size(); ++i) { | 293 for (size_t i = 0; i < addresses.size(); ++i) { |
| 294 if (i > 0) | 294 if (i > 0) |
| 295 builder.append(","); | 295 builder.append(','); |
| 296 builder.append(convertEmailAddressToUnicode(addresses[i])); | 296 builder.append(convertEmailAddressToUnicode(addresses[i])); |
| 297 } | 297 } |
| 298 return builder.toString(); | 298 return builder.toString(); |
| 299 } | 299 } |
| 300 | 300 |
| 301 } // namespace blink | 301 } // namespace blink |
| OLD | NEW |