| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 return count; | 420 return count; |
| 421 } | 421 } |
| 422 | 422 |
| 423 bool Character::canReceiveTextEmphasis(UChar32 c) | 423 bool Character::canReceiveTextEmphasis(UChar32 c) |
| 424 { | 424 { |
| 425 CharCategory category = Unicode::category(c); | 425 CharCategory category = Unicode::category(c); |
| 426 if (category & (Separator_Space | Separator_Line | Separator_Paragraph | Oth
er_NotAssigned | Other_Control | Other_Format)) | 426 if (category & (Separator_Space | Separator_Line | Separator_Paragraph | Oth
er_NotAssigned | Other_Control | Other_Format)) |
| 427 return false; | 427 return false; |
| 428 | 428 |
| 429 // Additional word-separator characters listed in CSS Text Level 3 Editor's
Draft 3 November 2010. | 429 // Additional word-separator characters listed in CSS Text Level 3 Editor's
Draft 3 November 2010. |
| 430 if (c == ethiopicWordspace || c == aegeanWordSeparatorLine || c == aegeanWor
dSeparatorDot | 430 if (c == ethiopicWordspaceCharacter || c == aegeanWordSeparatorLineCharacter
|| c == aegeanWordSeparatorDotCharacter |
| 431 || c == ugariticWordDivider || c == tibetanMarkIntersyllabicTsheg || c =
= tibetanMarkDelimiterTshegBstar) | 431 || c == ugariticWordDividerCharacter || c == tibetanMarkIntersyllabicTsh
egCharacter || c == tibetanMarkDelimiterTshegBstarCharacter) |
| 432 return false; | 432 return false; |
| 433 | 433 |
| 434 return true; | 434 return true; |
| 435 } | 435 } |
| 436 | 436 |
| 437 template <typename CharacterType> | 437 template <typename CharacterType> |
| 438 static inline String normalizeSpacesInternal(const CharacterType* characters, un
signed length) | 438 static inline String normalizeSpacesInternal(const CharacterType* characters, un
signed length) |
| 439 { | 439 { |
| 440 StringBuilder normalized; | 440 StringBuilder normalized; |
| 441 normalized.reserveCapacity(length); | 441 normalized.reserveCapacity(length); |
| 442 | 442 |
| 443 for (unsigned i = 0; i < length; ++i) | 443 for (unsigned i = 0; i < length; ++i) |
| 444 normalized.append(Character::normalizeSpaces(characters[i])); | 444 normalized.append(Character::normalizeSpaces(characters[i])); |
| 445 | 445 |
| 446 return normalized.toString(); | 446 return normalized.toString(); |
| 447 } | 447 } |
| 448 | 448 |
| 449 String Character::normalizeSpaces(const LChar* characters, unsigned length) | 449 String Character::normalizeSpaces(const LChar* characters, unsigned length) |
| 450 { | 450 { |
| 451 return normalizeSpacesInternal(characters, length); | 451 return normalizeSpacesInternal(characters, length); |
| 452 } | 452 } |
| 453 | 453 |
| 454 String Character::normalizeSpaces(const UChar* characters, unsigned length) | 454 String Character::normalizeSpaces(const UChar* characters, unsigned length) |
| 455 { | 455 { |
| 456 return normalizeSpacesInternal(characters, length); | 456 return normalizeSpacesInternal(characters, length); |
| 457 } | 457 } |
| 458 | 458 |
| 459 } // namespace blink | 459 } // namespace blink |
| OLD | NEW |