OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
396 return c == '\r' || c == '\n'; | 396 return c == '\r' || c == '\n'; |
397 } | 397 } |
398 | 398 |
399 static String limitLength(const String& string, unsigned maxLength) | 399 static String limitLength(const String& string, unsigned maxLength) |
400 { | 400 { |
401 unsigned newLength = std::min(maxLength, string.length()); | 401 unsigned newLength = std::min(maxLength, string.length()); |
402 // FIXME: We should not truncate the string at a control character. It's not | 402 // FIXME: We should not truncate the string at a control character. It's not |
403 // compatible with IE and Firefox. | 403 // compatible with IE and Firefox. |
404 for (unsigned i = 0; i < newLength; ++i) { | 404 for (unsigned i = 0; i < newLength; ++i) { |
405 const UChar current = string[i]; | 405 const UChar current = string[i]; |
406 if (current < ' ' && current != '\t') { | 406 if (current < ' ' && current != '\t' && current != '\v') { |
tkent
2014/03/07 17:26:34
Please follow the FIXME comment above.
Habib Virji
2014/03/10 12:02:56
Done.
| |
407 newLength = i; | 407 newLength = i; |
408 break; | 408 break; |
409 } | 409 } |
410 } | 410 } |
411 if (newLength == string.length()) | 411 if (newLength == string.length()) |
412 return string; | 412 return string; |
413 if (newLength > 0 && U16_IS_LEAD(string[newLength - 1])) | 413 if (newLength > 0 && U16_IS_LEAD(string[newLength - 1])) |
414 --newLength; | 414 --newLength; |
415 return string.left(newLength); | 415 return string.left(newLength); |
416 } | 416 } |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
559 { | 559 { |
560 return !element().isDisabledOrReadOnly(); | 560 return !element().isDisabledOrReadOnly(); |
561 } | 561 } |
562 | 562 |
563 bool TextFieldInputType::shouldSpinButtonRespondToWheelEvents() | 563 bool TextFieldInputType::shouldSpinButtonRespondToWheelEvents() |
564 { | 564 { |
565 return shouldSpinButtonRespondToMouseEvents() && element().focused(); | 565 return shouldSpinButtonRespondToMouseEvents() && element().focused(); |
566 } | 566 } |
567 | 567 |
568 } // namespace WebCore | 568 } // namespace WebCore |
OLD | NEW |