Changeset 179735 in webkit
- Timestamp:
- Feb 5, 2015, 6:04:19 PM (12 years ago)
- Location:
- branches/safari-600.1.4.15-branch
- Files:
-
- 5 edited
- 2 copied
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/editing/deleting/delete-emoji-expected.txt (copied) (copied from trunk/LayoutTests/editing/deleting/delete-emoji-expected.txt )
-
LayoutTests/editing/deleting/delete-emoji.html (copied) (copied from trunk/LayoutTests/editing/deleting/delete-emoji.html )
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/graphics/Font.cpp (modified) (2 diffs)
-
Source/WebCore/platform/text/TextBreakIterator.cpp (modified) (8 diffs)
-
Source/WebCore/rendering/RenderText.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-600.1.4.15-branch/LayoutTests/ChangeLog
r179734 r179735 1 2015-02-05 Lucas Forschler <lforschler@apple.com> 2 3 Merge r179567 4 5 2015-02-02 Enrica Casucci <enrica@apple.com> 6 7 Additional emoji support. 8 https://bugs.webkit.org/show_bug.cgi?id=141047 9 rdar://problem/19045135 10 11 Reviewed by Darin Adler. 12 13 * editing/deleting/delete-emoji.html: Added. 14 * editing/deleting/delete-emoji-expected.txt: Added. 15 1 16 2015-02-05 David Kilzer <ddkilzer@apple.com> 2 17 -
branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog
r179734 r179735 1 2015-02-05 Lucas Forschler <lforschler@apple.com> 2 3 Merge r179567 4 5 2015-02-02 Enrica Casucci <enrica@apple.com> 6 7 Additional emoji support. 8 https://bugs.webkit.org/show_bug.cgi?id=141047 9 rdar://problem/19045135 10 11 Reviewed by Darin Adler. 12 13 Adds support for emoji modifiers and group emoji. 14 15 Test: editing/deleting/delete-emoji.html 16 17 * platform/graphics/FontCascade.cpp: 18 (WebCore::FontCascade::characterRangeCodePath): 19 * platform/text/TextBreakIterator.cpp: 20 (WebCore::cursorMovementIterator): 21 * rendering/RenderText.cpp: 22 (WebCore::isEmojiGroupCandidate): 23 (WebCore::isEmojiModifier): 24 (WebCore::RenderText::previousOffsetForBackwardDeletion): 25 1 26 2015-02-05 David Kilzer <ddkilzer@apple.com> 2 27 -
branches/safari-600.1.4.15-branch/Source/WebCore/platform/graphics/Font.cpp
r179730 r179735 621 621 // list of ranges. 622 622 CodePath result = Simple; 623 bool previousCharacterIsEmojiGroupCandidate = false; 623 624 for (unsigned i = 0; i < len; i++) { 624 625 const UChar c = characters[i]; 626 if (c == zeroWidthJoiner && previousCharacterIsEmojiGroupCandidate) 627 return Complex; 628 629 previousCharacterIsEmojiGroupCandidate = false; 625 630 if (c < 0x2E5) // U+02E5 through U+02E9 (Modifier Letters : Tone letters) 626 631 continue; … … 743 748 return Complex; 744 749 750 if (supplementaryCharacter >= 0x1F466 && supplementaryCharacter <= 0x1F469) { 751 previousCharacterIsEmojiGroupCandidate = true; 752 continue; 753 } 745 754 if (supplementaryCharacter < 0xE0100) // U+E0100 through U+E01EF Unicode variation selectors. 746 755 continue; -
branches/safari-600.1.4.15-branch/Source/WebCore/platform/text/TextBreakIterator.cpp
r179734 r179735 208 208 "$Mal1 = [\\u0D15-\\u0D39];" // Malayalam Letter A,...,Ha 209 209 "$RI = [\\U0001F1E6-\\U0001F1FF];" // Emoji regional indicators 210 "$ZWJ = \\u200D;" // Zero width joiner 211 "$EmojiForModsAndSeqs = [\\U0001F466-\\U0001F469];" // Emoji that take Fitzpatrick modifiers AND participate in ZWJ sequences 212 "$EmojiForModsOnly = [\\u261D \\u270A-\\u270C \\U0001F385 \\U0001F3C3-\\U0001F3C4 \\U0001F3C7 \\U0001F3CA \\U0001F442-\\U0001F443 \\U0001F446-\\U0001F450 \\U0001F46E-\\U0001F478 \\U0001F47C \\U0001F481-\\U0001F483 \\U0001F485-\\U0001F487 \\U0001F4AA \\U0001F645-\\U0001F647 \\U0001F64B-\\U0001F64F \\U0001F6B4-\\U0001F6B6 \\U0001F6C0];" // Emoji that take Fitzpatrick modifiers 213 "$EmojiMods = [\\U0001F3FB-\\U0001F3FF];" // Fitzpatrick modifiers 210 214 "!!chain;" 211 215 "!!forward;" … … 226 230 "$Kan0 $KanV $Kan1;" // Kannada Virama (forward) 227 231 "$Mal0 $MalV $Mal1;" // Malayalam Virama (forward) 232 "$ZWJ $EmojiForModsAndSeqs;" // Don't break in emoji ZWJ sequences 233 "[$EmojiForModsAndSeqs $EmojiForModsOnly] $EmojiMods;" // Don't break between relevant emoji and Fitzpatrick modifier 228 234 "!!reverse;" 229 235 "$LF $CR;" … … 243 249 "$Kan1 $KanV $Kan0;" // Kannada Virama (backward) 244 250 "$Mal1 $MalV $Mal0;" // Malayalam Virama (backward) 251 "$EmojiForModsAndSeqs $ZWJ;" // Don't break in emoji ZWJ sequences 252 "$EmojiMods [$EmojiForModsAndSeqs $EmojiForModsOnly];" // Don't break between relevant emoji and Fitzpatrick modifier 245 253 "!!safe_reverse;" 246 254 "!!safe_forward;"; … … 398 406 "$XX = [:LineBreak = Unknown:];" 399 407 "$ZW = [:LineBreak = ZWSpace:];" 408 "$ZWJ = \\u200D;" 409 "$EmojiForModsAndSeqs = [\\U0001F466-\\U0001F469];" 410 "$EmojiForModsOnly = [\\u261D \\u270A-\\u270C \\U0001F385 \\U0001F3C3-\\U0001F3C4 \\U0001F3C7 \\U0001F3CA \\U0001F442-\\U0001F443 \\U0001F446-\\U0001F450 \\U0001F46E-\\U0001F478 \\U0001F47C \\U0001F481-\\U0001F483 \\U0001F485-\\U0001F487 \\U0001F4AA \\U0001F645-\\U0001F647 \\U0001F64B-\\U0001F64F \\U0001F6B4-\\U0001F6B6 \\U0001F6C0];" 411 "$EmojiMods = [\\U0001F3FB-\\U0001F3FF];" 400 412 "$dictionary = [:LineBreak = Complex_Context:];" 401 413 "$ALPlus = [$AL $AI $SA $SG $XX];" … … 474 486 "$CAN_CM $CM* [$SP $ZW];" 475 487 "$CM+ [$SP $ZW];" 488 "[$EmojiForModsAndSeqs $EmojiMods] $ZWJ $EmojiForModsAndSeqs;" 476 489 "$CAN_CM $CM+;" 477 490 "$CM+;" … … 540 553 "($ALcm | $HLcm | $NUcm) $OPcm;" 541 554 "$CM+ $OPcm;" 542 "$CPcm ($ALcm | $HLcm | $NUcm);"; 555 "$CPcm ($ALcm | $HLcm | $NUcm);" 556 "[$EmojiForModsAndSeqs $EmojiForModsOnly] $EmojiMods;"; 543 557 544 558 static const char* uax14Reverse = … … 578 592 "[$SP $ZW] [$LB4NonBreaks-$CM];" 579 593 "[$SP $ZW] $CM+ $CAN_CM;" 594 "$EmojiForModsAndSeqs $ZWJ [$EmojiForModsAndSeqs $EmojiMods];" 580 595 "$CM+ $CAN_CM;" 581 596 "$CM* $WJ $CM* $CAN_CM;" … … 634 649 "$CM* ($ALPlus | $HL) $CM* $IS;" 635 650 "$CM* $OP $CM* ($ALPlus | $HL | $NU);" 636 "$CM* ($ALPlus | $HL | $NU) $CM* $CP;"; 651 "$CM* ($ALPlus | $HL | $NU) $CM* $CP;" 652 "$EmojiMods [$EmojiForModsAndSeqs $EmojiForModsOnly];"; 637 653 638 654 static const char* uax14SafeForward = -
branches/safari-600.1.4.15-branch/Source/WebCore/rendering/RenderText.cpp
r179734 r179735 1398 1398 }; 1399 1399 1400 inline bool isHangulLVT(UChar32 character)1400 static inline bool isHangulLVT(UChar32 character) 1401 1401 { 1402 1402 return (character - HANGUL_SYLLABLE_START) % HANGUL_JONGSEONG_COUNT; 1403 1403 } 1404 1404 1405 inline bool isMark(UChar32 c)1406 { 1407 int8_t charType = u_charType(c );1405 static inline bool isMark(UChar32 character) 1406 { 1407 int8_t charType = u_charType(character); 1408 1408 return charType == U_NON_SPACING_MARK || charType == U_ENCLOSING_MARK || charType == U_COMBINING_SPACING_MARK; 1409 1409 } 1410 1410 1411 inline bool isRegionalIndicator(UChar32 c)1411 static inline bool isRegionalIndicator(UChar32 character) 1412 1412 { 1413 1413 // National flag emoji each consists of a pair of regional indicator symbols. 1414 return 0x1F1E6 <= c && c <= 0x1F1FF; 1414 return 0x1F1E6 <= character && character <= 0x1F1FF; 1415 } 1416 1417 static inline bool isEmojiGroupCandidate(UChar32 character) 1418 { 1419 return character >= 0x1F466 && character <= 0x1F469; 1420 } 1421 1422 static inline bool isEmojiModifier(UChar32 character) 1423 { 1424 return character >= 0x1F3FB && character <= 0x1F3FF; 1415 1425 } 1416 1426 … … 1424 1434 UChar32 character; 1425 1435 bool sawRegionalIndicator = false; 1436 bool sawEmojiGroupCandidate = false; 1437 bool sawEmojiModifier = false; 1438 1426 1439 while (current > 0) { 1427 1440 if (U16_IS_TRAIL(text[--current])) … … 1431 1444 1432 1445 UChar32 character = text.characterStartingAt(current); 1446 1447 if (sawEmojiGroupCandidate) { 1448 sawEmojiGroupCandidate = false; 1449 if (character == zeroWidthJoiner) 1450 continue; 1451 // We could have two emoji group candidates without a joiner in between. 1452 // Those should not be treated as a group. 1453 U16_FWD_1_UNSAFE(text, current); 1454 break; 1455 } 1456 1457 if (sawEmojiModifier) { 1458 if (isEmojiModifier(character)) 1459 U16_FWD_1_UNSAFE(text, current); 1460 break; 1461 } 1433 1462 1434 1463 if (sawRegionalIndicator) { … … 1448 1477 if (isRegionalIndicator(character)) { 1449 1478 sawRegionalIndicator = true; 1479 continue; 1480 } 1481 1482 if (isEmojiModifier(character)) { 1483 sawEmojiModifier = true; 1484 continue; 1485 } 1486 1487 if (isEmojiGroupCandidate(character)) { 1488 sawEmojiGroupCandidate = true; 1450 1489 continue; 1451 1490 }
Note:
See TracChangeset
for help on using the changeset viewer.