| 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 UChar32 character = characters[i]; | 371 UChar32 character = characters[i]; |
| 372 if (treatAsSpace(character)) { | 372 if (treatAsSpace(character)) { |
| 373 count++; | 373 count++; |
| 374 isAfterExpansion = true; | 374 isAfterExpansion = true; |
| 375 continue; | 375 continue; |
| 376 } | 376 } |
| 377 if (U16_IS_LEAD(character) && i + 1 < length && U16_IS_TRAIL(charact
ers[i + 1])) { | 377 if (U16_IS_LEAD(character) && i + 1 < length && U16_IS_TRAIL(charact
ers[i + 1])) { |
| 378 character = U16_GET_SUPPLEMENTARY(character, characters[i + 1]); | 378 character = U16_GET_SUPPLEMENTARY(character, characters[i + 1]); |
| 379 i++; | 379 i++; |
| 380 } | 380 } |
| 381 if (textJustify == TextJustify::TextJustifyAuto && isCJKIdeographOrS
ymbol(character)) { |
| 382 if (!isAfterExpansion) |
| 383 count++; |
| 384 count++; |
| 385 isAfterExpansion = true; |
| 386 continue; |
| 387 } |
| 381 isAfterExpansion = false; | 388 isAfterExpansion = false; |
| 382 } | 389 } |
| 383 } else { | 390 } else { |
| 384 for (size_t i = length; i > 0; --i) { | 391 for (size_t i = length; i > 0; --i) { |
| 385 UChar32 character = characters[i - 1]; | 392 UChar32 character = characters[i - 1]; |
| 386 if (treatAsSpace(character)) { | 393 if (treatAsSpace(character)) { |
| 387 count++; | 394 count++; |
| 388 isAfterExpansion = true; | 395 isAfterExpansion = true; |
| 389 continue; | 396 continue; |
| 390 } | 397 } |
| 391 if (U16_IS_TRAIL(character) && i > 1 && U16_IS_LEAD(characters[i - 2
])) { | 398 if (U16_IS_TRAIL(character) && i > 1 && U16_IS_LEAD(characters[i - 2
])) { |
| 392 character = U16_GET_SUPPLEMENTARY(characters[i - 2], character); | 399 character = U16_GET_SUPPLEMENTARY(characters[i - 2], character); |
| 393 i--; | 400 i--; |
| 394 } | 401 } |
| 402 if (textJustify == TextJustify::TextJustifyAuto && isCJKIdeographOrS
ymbol(character)) { |
| 403 if (!isAfterExpansion) |
| 404 count++; |
| 405 count++; |
| 406 isAfterExpansion = true; |
| 407 continue; |
| 408 } |
| 395 isAfterExpansion = false; | 409 isAfterExpansion = false; |
| 396 } | 410 } |
| 397 } | 411 } |
| 398 return count; | 412 return count; |
| 399 } | 413 } |
| 400 | 414 |
| 401 bool Character::canReceiveTextEmphasis(UChar32 c) | 415 bool Character::canReceiveTextEmphasis(UChar32 c) |
| 402 { | 416 { |
| 403 CharCategory category = Unicode::category(c); | 417 CharCategory category = Unicode::category(c); |
| 404 if (category & (Separator_Space | Separator_Line | Separator_Paragraph | Oth
er_NotAssigned | Other_Control | Other_Format)) | 418 if (category & (Separator_Space | Separator_Line | Separator_Paragraph | Oth
er_NotAssigned | Other_Control | Other_Format)) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 428 { | 442 { |
| 429 return normalizeSpacesInternal(characters, length); | 443 return normalizeSpacesInternal(characters, length); |
| 430 } | 444 } |
| 431 | 445 |
| 432 String Character::normalizeSpaces(const UChar* characters, unsigned length) | 446 String Character::normalizeSpaces(const UChar* characters, unsigned length) |
| 433 { | 447 { |
| 434 return normalizeSpacesInternal(characters, length); | 448 return normalizeSpacesInternal(characters, length); |
| 435 } | 449 } |
| 436 | 450 |
| 437 } // namespace blink | 451 } // namespace blink |
| OLD | NEW |