Bug 1032671 - Part 1. Add emoji presentation API for UTR#51. r=jfkthame
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Sun, 12 Nov 2017 16:06:18 +0900
changeset 394788 e5b43d990d7029f9666225c0fa7eddd3b751a8c8
parent 394787 8295eb601d27dbb4aaa15d879bc9795a200789ee
child 394789 69219385100a1b5ebced5b323bf5d5de27c76566
push id56450
push userm_kato@ga2.so-net.ne.jp
push dateMon, 04 Dec 2017 07:32:34 +0000
treeherderautoland@f16b41dbddee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1032671
milestone59.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 1032671 - Part 1. Add emoji presentation API for UTR#51. r=jfkthame From ICU 57, ICU supports emoji presentation as draft API. MozReview-Commit-ID: 6JgQMv4Ky9m
intl/unicharutil/util/nsUnicodeProperties.h
--- a/intl/unicharutil/util/nsUnicodeProperties.h
+++ b/intl/unicharutil/util/nsUnicodeProperties.h
@@ -41,16 +41,22 @@ enum PairedBracketType {
 /* Flags for Unicode security IdentifierType.txt attributes. Only a subset
    of these are currently checked by Gecko, so we only define flags for the
    ones we need. */
 enum IdentifierType {
   IDTYPE_RESTRICTED = 0,
   IDTYPE_ALLOWED = 1,
 };
 
+enum EmojiPresentation {
+  TextOnly = 0,
+  TextDefault = 1,
+  EmojiDefault = 2
+};
+
 extern const hb_unicode_general_category_t sICUtoHBcategory[];
 
 inline uint32_t
 GetMirroredChar(uint32_t aCh)
 {
   return u_charMirror(aCh);
 }
 
@@ -167,16 +173,29 @@ IsEastAsianWidthFWH(uint32_t aCh)
 }
 
 inline bool
 IsDefaultIgnorable(uint32_t aCh)
 {
   return u_hasBinaryProperty(aCh, UCHAR_DEFAULT_IGNORABLE_CODE_POINT);
 }
 
+inline EmojiPresentation
+GetEmojiPresentation(uint32_t aCh)
+{
+  if (!u_hasBinaryProperty(aCh, UCHAR_EMOJI)) {
+    return TextOnly;
+  }
+
+  if (u_hasBinaryProperty(aCh, UCHAR_EMOJI_PRESENTATION)) {
+    return EmojiDefault;
+  }
+  return TextDefault;
+}
+
 // returns the simplified Gen Category as defined in nsUGenCategory
 inline nsUGenCategory GetGenCategory(uint32_t aCh) {
   return sDetailedToGeneralCategory[GetGeneralCategory(aCh)];
 }
 
 inline VerticalOrientation GetVerticalOrientation(uint32_t aCh) {
   return VerticalOrientation(GetCharProps2(aCh).mVertOrient);
 }