Bug 1518401 - Exclude caret position within ligated emoji sequence where the second component was a BMP symbol + VS16. r=m_kato
authorJonathan Kew <jkew@mozilla.com>
Wed, 09 Jan 2019 10:13:40 +0000
changeset 510140 a43422e9e4da8252bf1b48eb05206d0520b06f39
parent 510139 d6d035ab7f9317583ba2e2930ad530b89278d927
child 510141 a11f752f828ceca6aed6cda69fc336f4624434fc
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1518401
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1518401 - Exclude caret position within ligated emoji sequence where the second component was a BMP symbol + VS16. r=m_kato
layout/generic/nsTextFrame.cpp
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -7809,17 +7809,20 @@ static bool IsAcceptableCaretPosition(co
     uint32_t offs = aIter.GetOriginalOffset();
     const nsTextFragment* frag = aFrame->GetContent()->GetText();
     uint32_t ch = frag->CharAt(offs);
 
     if (gfxFontUtils::IsVarSelector(ch) ||
         (NS_IS_LOW_SURROGATE(ch) && offs > 0 &&
          NS_IS_HIGH_SURROGATE(frag->CharAt(offs - 1))) ||
         (!aTextRun->IsLigatureGroupStart(index) &&
-         unicode::GetEmojiPresentation(ch) == unicode::EmojiDefault)) {
+         (unicode::GetEmojiPresentation(ch) == unicode::EmojiDefault ||
+          (unicode::GetEmojiPresentation(ch) == unicode::TextDefault &&
+           offs + 1 < frag->GetLength() &&
+           frag->CharAt(offs + 1) == gfxFontUtils::kUnicodeVS16)))) {
       return false;
     }
 
     // If the proposed position is before a high surrogate, we need to decode
     // the surrogate pair (if valid) and check the resulting character.
     if (NS_IS_HIGH_SURROGATE(ch) && offs + 1 < frag->GetLength()) {
       uint32_t ch2 = frag->CharAt(offs + 1);
       if (NS_IS_LOW_SURROGATE(ch2)) {